Client LuaCsForBarotrauma
FireAction.cs
1 using Microsoft.Xna.Framework;
2 
3 namespace Barotrauma
4 {
9  {
10  [Serialize(10.0f, IsPropertySaveable.Yes, description: "Size of the fire (width in pixels).")]
11  public float Size { get; set; }
12 
13  [Serialize("", IsPropertySaveable.Yes, description: "Tag of the entity to start the fire at.")]
14  public Identifier TargetTag { get; set; }
15 
16  public FireAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
17 
18  private bool isFinished = false;
19 
20  public override bool IsFinished(ref string goTo)
21  {
22  return isFinished;
23  }
24  public override void Reset()
25  {
26  isFinished = false;
27  }
28 
29  public override void Update(float deltaTime)
30  {
31  if (isFinished) { return; }
32  var targets = ParentEvent.GetTargets(TargetTag);
33  foreach (var target in targets)
34  {
35  Vector2 pos = target.WorldPosition;
36 
37  var newFire = new FireSource(pos);
38  newFire.Size = new Vector2(Size, Size);
39  }
40  isFinished = true;
41  }
42 
43  public override string ToDebugString()
44  {
45  return $"{ToolBox.GetDebugSymbol(isFinished)} {nameof(FireAction)} -> (TargetTag: {TargetTag.ColorizeObject()}, " +
46  $"Size: {Size.ColorizeObject()})";
47  }
48  }
49 }
readonly ScriptedEvent ParentEvent
Definition: EventAction.cs:106
Starts a fire at the position of a specific target.
Definition: FireAction.cs:9
override void Reset()
Definition: FireAction.cs:24
Identifier TargetTag
Definition: FireAction.cs:14
override bool IsFinished(ref string goTo)
Has the action finished.
Definition: FireAction.cs:20
override string ToDebugString()
Rich test to display in debugdraw
Definition: FireAction.cs:43
FireAction(ScriptedEvent parentEvent, ContentXElement element)
Definition: FireAction.cs:16
override void Update(float deltaTime)
Definition: FireAction.cs:29
IEnumerable< Entity > GetTargets(Identifier tag)