public void UpdatePinShip(Ship ship, Guid guid) { if (!this.Pins.ContainsKey(ship.guid)) { ThreatMatrix.Pin pin = new ThreatMatrix.Pin() { Position = ship.Center, Strength = ship.GetStrength(), EmpireName = ship.loyalty.data.Traits.Name }; this.Pins.TryAdd(ship.guid, pin); return; } this.Pins[ship.guid].Velocity = ship.Center - this.Pins[ship.guid].Position; this.Pins[ship.guid].Position = ship.Center; }
public void UpdatePin(Ship ship, bool ShipinBorders) { ThreatMatrix.Pin pin = null; bool exists = this.Pins.TryGetValue(ship.guid, out pin); if (pin == null) { pin = new ThreatMatrix.Pin() { Position = ship.Center, Strength = ship.GetStrength(), EmpireName = ship.loyalty.data.Traits.Name, ship = ship, InBorders = ShipinBorders }; if (exists) { this.Pins[ship.guid] = pin; return; } } else { this.Pins[ship.guid].Velocity = ship.Center - this.Pins[ship.guid].Position; this.Pins[ship.guid].Position = ship.Center; this.Pins[ship.guid].InBorders = ShipinBorders; if (this.Pins[ship.guid].ship == null) //ShipinBorders && this.Pins[ship.guid].ship = ship; return; } //lock (this.Pins) this.Pins.TryAdd(ship.guid, pin); }