28 lines
918 B
C#
Raw Normal View History

2022-01-28 20:49:07 -08:00
using Cysharp.Threading.Tasks;
using QSB.Player;
using System.Threading;
2022-01-12 21:35:04 -08:00
using UnityEngine;
2022-01-12 19:43:48 -08:00
2022-03-02 19:46:33 -08:00
namespace QSB.TriggerSync.WorldObjects;
public class QSBVesselCageTrigger : QSBTrigger<VesselWarpController>
2022-01-12 19:18:59 -08:00
{
2022-03-02 19:46:33 -08:00
public override async UniTask Init(CancellationToken ct)
2022-01-12 19:18:59 -08:00
{
2022-03-02 19:46:33 -08:00
await base.Init(ct);
AttachedObject.OnExit -= TriggerOwner.OnExitCageTrigger;
}
2022-01-12 19:18:59 -08:00
2022-03-02 19:46:33 -08:00
protected override void OnExit(PlayerInfo player)
{
if (Occupants.Count == 0 && TriggerOwner._hasPower)
2022-01-12 21:35:04 -08:00
{
2022-03-02 19:46:33 -08:00
TriggerOwner._cageClosed = true;
TriggerOwner._cageAnimator.TranslateToLocalPosition(new Vector3(0f, -8.1f, 0f), 5f);
TriggerOwner._cageAnimator.RotateToLocalEulerAngles(new Vector3(0f, 180f, 0f), 5f);
TriggerOwner._cageAnimator.OnTranslationComplete -= TriggerOwner.OnCageAnimationComplete;
TriggerOwner._cageAnimator.OnTranslationComplete += TriggerOwner.OnCageAnimationComplete;
TriggerOwner._cageLoopingAudio.FadeIn(1f);
2022-01-12 21:35:04 -08:00
}
2022-01-12 19:18:59 -08:00
}
}