Client LuaCsForBarotrauma
BarotraumaShared/SharedSource/Events/EventActions/HighlightAction.cs
1 #nullable enable
2 using Microsoft.Xna.Framework;
3 using System.Collections.Generic;
4 using System.Linq;
5 
6 namespace Barotrauma;
7 
11 partial class HighlightAction : EventAction
12 {
13  private static readonly Color highlightColor = Color.Orange;
14 
15  [Serialize("", IsPropertySaveable.Yes, description: "Tag of the entity to highlight.")]
16  public Identifier TargetTag { get; set; }
17 
18  [Serialize("", IsPropertySaveable.Yes, description: "Only the player controlling this character will see the highlight. If empty, all players will see it.")]
19  public Identifier TargetCharacter { get; set; }
20 
21  [Serialize(true, IsPropertySaveable.Yes, description: "Should the highlight be turned on or off?")]
22  public bool State { get; set; }
23 
24  private bool isFinished;
25 
26  public HighlightAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element)
27  {
28  }
29 
30  public override void Update(float deltaTime)
31  {
32  if (isFinished) { return; }
33  var targetCharacters = TargetCharacter.IsEmpty ? null : ParentEvent.GetTargets(TargetCharacter).OfType<Character>();
34  foreach (var target in ParentEvent.GetTargets(TargetTag))
35  {
36  SetHighlightProjSpecific(target, targetCharacters);
37  }
38  isFinished = true;
39  }
40 
41  partial void SetHighlightProjSpecific(Entity entity, IEnumerable<Character>? targetCharacters);
42 
43  public override bool IsFinished(ref string goToLabel) => isFinished;
44 
45  public override void Reset() => isFinished = false;
46 }
override void Reset()
override bool IsFinished(ref string goToLabel)
HighlightAction(ScriptedEvent parentEvent, ContentXElement element)