Client LuaCsForBarotrauma
WaitAction.cs
1 namespace Barotrauma
2 {
7  {
8  [Serialize(0.0f, IsPropertySaveable.Yes, description: "How long to wait (in seconds).")]
9  public float Time { get; set; }
10 
11  private float timeRemaining;
12 
13  public WaitAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element)
14  {
15  timeRemaining = Time;
16  }
17 
18  public override bool IsFinished(ref string goTo)
19  {
20  return timeRemaining <= 0;
21  }
22  public override void Reset()
23  {
24  timeRemaining = Time;
25  }
26 
27  public override void Update(float deltaTime)
28  {
29  timeRemaining -= deltaTime;
30  if (timeRemaining < 0.0f) { timeRemaining = 0.0f; }
31  }
32 
33  public override string ToDebugString()
34  {
35  return $"{ToolBox.GetDebugSymbol(timeRemaining <= 0)} {nameof(WaitAction)} -> (Remaining: {timeRemaining.ColorizeObject()}, Time: {Time.ColorizeObject()})";
36  }
37  }
38 }
Waits for a specific amount of time before continuing the execution of the event.
Definition: WaitAction.cs:7
override void Update(float deltaTime)
Definition: WaitAction.cs:27
WaitAction(ScriptedEvent parentEvent, ContentXElement element)
Definition: WaitAction.cs:13
override void Reset()
Definition: WaitAction.cs:22
override bool IsFinished(ref string goTo)
Has the action finished.
Definition: WaitAction.cs:18
override string ToDebugString()
Rich test to display in debugdraw
Definition: WaitAction.cs:33