7 private const string IS_FLYING_SIGNAL_NAME =
"IsFlying";
8 private const string SOUND_FLOCK_TAKEOFF_EVENT_NAME =
"SOUND_FLOCK_TAKEOFF";
9 private const string SOUND_FLOCK_LAND_EVENT_NAME =
"SOUND_FLOCK_LAND";
11 override event protected void EOnInit(IEntity owner)
22 override void OnReactToDanger()
24 super.OnReactToDanger();
26 SoundEvent(SOUND_FLOCK_TAKEOFF_EVENT_NAME);
27 SetIsFlyingSignal(
true);
31 override void OnTakeOff()
35 SetIsFlyingSignal(
true);
39 override void OnLanding()
43 SoundEvent(SOUND_FLOCK_LAND_EVENT_NAME);
44 SetIsFlyingSignal(
false);
48 private void SetIsFlyingSignal(
bool isFlying)
50 SignalsManagerComponent signalsManagerComponent = SignalsManagerComponent.Cast(FindComponent(SignalsManagerComponent));
51 if (signalsManagerComponent)
52 signalsManagerComponent.SetSignalValue(signalsManagerComponent.AddOrFindSignal(IS_FLYING_SIGNAL_NAME), isFlying);
56 private void SoundEvent(
string soundEvent)
58 SoundComponent soundComponent = SoundComponent.Cast(FindComponent(SoundComponent));
60 soundComponent.SoundEvent(soundEvent);