Client LuaCsForBarotrauma
GoTo.cs
1 namespace Barotrauma
2 {
6  class GoTo : EventAction
7  {
8  [Serialize("", IsPropertySaveable.Yes, description: "Name of the label to jump to.")]
9  public string Name { get; set; }
10 
11  [Serialize(-1, IsPropertySaveable.Yes, description: "How many times can this GoTo action be repeated? Can be used to make some parts of an event repeat a limited number of times. If negative or zero, there's no limit.")]
12  public int MaxTimes { get; set; }
13 
14  private int counter;
15 
16  public GoTo(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
17 
18  public override bool IsFinished(ref string goTo)
19  {
20  if (counter < MaxTimes || MaxTimes <= 0)
21  {
22  goTo = Name;
23  counter++;
24  }
25  return true;
26  }
27 
28  public override string ToDebugString()
29  {
30  string msg = $"[-] Go to label \"{Name}\"";
31  if (MaxTimes > 0)
32  {
33  msg += $" ({counter}/{MaxTimes})";
34  }
35  return msg;
36  }
37 
38  public override void Reset() { }
39  }
40 }
Makes the event jump to a Label somewhere else in the event.
Definition: GoTo.cs:7
override bool IsFinished(ref string goTo)
Has the action finished.
Definition: GoTo.cs:18
override string ToDebugString()
Rich test to display in debugdraw
Definition: GoTo.cs:28
GoTo(ScriptedEvent parentEvent, ContentXElement element)
Definition: GoTo.cs:16
int MaxTimes
Definition: GoTo.cs:12
string Name
Definition: GoTo.cs:9
override void Reset()
Definition: GoTo.cs:38