Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MineAnimationComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Mines", description: "Base component for handling animation.")]
3 {
4 }
5 
6 class SCR_MineAnimationComponent : WeaponAnimationComponent
7 {
8  protected AnimationEventID m_iMineDown = -1;
9  protected AnimationEventID m_iMineActivated = -1;
10  protected IEntity m_Owner;
11 
12  //------------------------------------------------------------------------------------------------
13  // constructor
17  void SCR_MineAnimationComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
18  {
19  m_Owner = ent;
20  m_iMineDown = GameAnimationUtils.RegisterAnimationEvent("MineDown");
21  m_iMineActivated = GameAnimationUtils.RegisterAnimationEvent("MineActivated");
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  protected override event void OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd)
26  {
27  super.OnAnimationEvent(animEventType, animUserString, intParam, timeFromStart, timeToEnd);
28  if (!m_Owner)
29  return;
30 
31  if (animEventType == m_iMineDown)
32  {
33  SoundComponent soundComponent = SoundComponent.Cast(m_Owner.FindComponent(SoundComponent));
34  if (!soundComponent)
35  return;
36 
37  TraceParam param = new TraceParam();
38  param.Start = m_Owner.GetOrigin();
39  param.End = param.Start - vector.Up;
40  param.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
41  param.Exclude = m_Owner;
42  param.LayerMask = EPhysicsLayerPresets.Projectile;
43  m_Owner.GetWorld().TraceMove(param, null);
44 
45  GameMaterial material = param.SurfaceProps;
46  if (!material)
47  return;
48 
49  soundComponent.SetSignalValueStr("Surface", material.GetSoundInfo().GetSignalValue());
50  }
51 
52  // Master only
53  RplComponent rplComponent = RplComponent.Cast(m_Owner.FindComponent(RplComponent));
54  if (!rplComponent || rplComponent.IsProxy())
55  return;
56 
57  if (animEventType == m_iMineActivated)
58  {
59  SCR_PressureTriggerComponent pressureTriggerComponent = SCR_PressureTriggerComponent.Cast(m_Owner.FindComponent(SCR_PressureTriggerComponent));
60  if (!pressureTriggerComponent)
61  return;
62 
63  pressureTriggerComponent.ActivateTrigger();
64  }
65  }
66 }
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
m_iMineActivated
protected AnimationEventID m_iMineActivated
Definition: SCR_MineAnimationComponent.c:9
SCR_MineAnimationComponentClass
Definition: SCR_MineAnimationComponent.c:2
m_Owner
protected IEntity m_Owner
Definition: SCR_MineAnimationComponent.c:10
SCR_MineAnimationComponent
void SCR_MineAnimationComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_MineAnimationComponent.c:17
GameAnimationUtils
Definition: GameAnimationUtils.c:7
m_iMineDown
SCR_MineAnimationComponentClass m_iMineDown
OnAnimationEvent
protected override event void OnAnimationEvent(AnimationEventID animEventType, AnimationEventID animUserString, int intParam, float timeFromStart, float timeToEnd)
Definition: SCR_MineAnimationComponent.c:25
WeaponAnimationComponentClass
Definition: WeaponAnimationComponent.c:12
GameMaterial
Definition: GameMaterial.c:12
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180