2 using System.Collections.Generic;
10 private readonly List<Pump> allAvailablePumps =
new List<Pump>();
11 private readonly List<Door> allAvailableDoors =
new List<Door>();
12 private readonly List<Pump> targetPumps =
new List<Pump>();
13 private readonly List<Door> jammedDoors =
new List<Door>();
15 private bool isFinished;
16 private float timer = 10f;
18 private bool tryDrown;
23 targetBranch = branch;
24 this.attacker = attacker;
26 foreach (
Item item
in items)
28 if (item.GetComponent<
Pump>() is { } pump)
30 allAvailablePumps.Add(pump);
33 if (item.GetComponent<
Door>() is { } door)
35 allAvailableDoors.Add(door);
42 if (isFinished) {
return ExitState.ReturnLast; }
43 if (targetBranch.CurrentHull ==
null) {
return ExitState.ReturnLast; }
49 foreach (
Pump pump
in allAvailablePumps)
53 targetPumps.Add(pump);
59 if (!targetPumps.Any() || targetPumps.All(p => !p.HasPower))
65 if (targetBranch.CurrentHull !=
null && attacker !=
null && attacker.CurrentHull == targetBranch.CurrentHull)
67 foreach (
Door door
in allAvailableDoors)
73 jammedDoors.Add(door);
83 foreach (
Pump pump
in targetPumps)
88 foreach (
Door door
in jammedDoors)
94 private void SetPump(
Pump pump)
108 foreach (
Pump pump
in targetPumps)
113 if (tryDrown && !filled)
116 if (targetBranch.CurrentHull ==
null || targetBranch.CurrentHull.WaterPercentage >= 95f)
void TrySetState(bool open, bool isNetworkMessage, bool sendNetworkMessage=false)
DefendWithPumpState(BallastFloraBranch branch, IEnumerable< Item > items, Character attacker)
void Update(float deltaTime)
readonly List< MapEntity > linkedTo