internal void AddHut(BridgeHut hut) { // TODO: This method is incomprehensible and fragile, and should be rewritten. if (huts[0] == huts[1]) { huts[1] = hut; } if (Hut == null) { Hut = hut; // Assume only one until called again if (huts[0] == null) { huts[0] = hut; // Set only first time } for (var d = 0; d <= 1; d++) { for (var b = neighbours[d]; b != null; b = b.Hut == null ? b.neighbours[d] : null) { b.huts[d] = hut; } } } else { Hut = null; } }
internal void AddHut(BridgeHut hut) { if (huts[0] == huts[1]) { huts[1] = hut; } if (Hut == null) { Hut = hut; // Assume only one until called again if (huts[0] == null) { huts[0] = hut; // Set only first time } for (var d = 0; d <= 1; d++) { for (var b = neighbours[d]; b != null; b = b.Hut == null ? b.neighbours[d] : null) { b.huts[1 - d] = hut; } } } else { Hut = null; } }
public RepairBridge(Actor self, Actor target, EnterBehaviour enterBehaviour, string notification) : base(self, target, enterBehaviour) { this.target = target; legacyHut = target.TraitOrDefault<LegacyBridgeHut>(); hut = target.TraitOrDefault<BridgeHut>(); this.notification = notification; }
public RepairBridge(Actor self, Actor target) : base(self, target) { hut = target.Trait<BridgeHut>(); }