quantum-space-buddies/QSB/TriggerSync/WorldObjects/QSBVesselCageTrigger.cs

28 lines
849 B
C#
Raw Normal View History

2022-01-13 05:35:04 +00:00
using QSB.Player;
using UnityEngine;
2022-01-13 03:43:48 +00:00
namespace QSB.TriggerSync.WorldObjects
2022-01-13 03:18:59 +00:00
{
public class QSBVesselCageTrigger : QSBTrigger<VesselWarpController>
{
public override void Init()
{
base.Init();
AttachedObject.OnExit -= TriggerOwner.OnExitCageTrigger;
}
2022-01-13 05:35:04 +00:00
protected override void OnExit(PlayerInfo player)
{
if (Occupants.Count == 0 && TriggerOwner._hasPower)
{
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-13 03:18:59 +00:00
}
}