Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BirdAgent.c
Go to the documentation of this file.
2 {
3 };
4 
5 class SCR_Bird : AIFlock
6 {
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";
10 
11  override event protected void EOnInit(IEntity owner)
12  {
13 
14  //--- Activate AI
15  //AIControlComponent control = AIControlComponent.Cast(owner.FindComponent(AIControlComponent));
16  //if (control)
17  //control.ActivateAI();
18 
19  }
20 
21  //------------------------------------------------------------------------------------------------
22  override void OnReactToDanger()
23  {
24  super.OnReactToDanger();
25 
26  SoundEvent(SOUND_FLOCK_TAKEOFF_EVENT_NAME);
27  SetIsFlyingSignal(true);
28  }
29 
30  //------------------------------------------------------------------------------------------------
31  override void OnTakeOff()
32  {
33  super.OnTakeOff();
34 
35  SetIsFlyingSignal(true);
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  override void OnLanding()
40  {
41  super.OnLanding();
42 
43  SoundEvent(SOUND_FLOCK_LAND_EVENT_NAME);
44  SetIsFlyingSignal(false);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  private void SetIsFlyingSignal(bool isFlying)
49  {
50  SignalsManagerComponent signalsManagerComponent = SignalsManagerComponent.Cast(FindComponent(SignalsManagerComponent));
51  if (signalsManagerComponent)
52  signalsManagerComponent.SetSignalValue(signalsManagerComponent.AddOrFindSignal(IS_FLYING_SIGNAL_NAME), isFlying);
53  }
54 
55  //------------------------------------------------------------------------------------------------
56  private void SoundEvent(string soundEvent)
57  {
58  SoundComponent soundComponent = SoundComponent.Cast(FindComponent(SoundComponent));
59  if (soundComponent)
60  soundComponent.SoundEvent(soundEvent);
61  }
62 }
SCR_BirdClass
Definition: SCR_BirdAgent.c:1
AIFlockClass
Definition: AIFlock.c:12
SCR_Bird
Definition: SCR_BirdAgent.c:5