public Facing GetZone(ShipComponent component) { IntPair p = locations[component].location; int mid = (int)Math.Floor(width / 2f); bool upOrLeft = (p.x >= mid ? p.x - 1 : p.x) + p.y < height; if ((p.x > mid ? p.x - 1 : p.x) > p.y) { return(upOrLeft ? Facing.UP : Facing.RIGHT); } else { return(upOrLeft ? Facing.LEFT : Facing.DOWN); } }
public void AddComponent(ShipComponent component, IntPair location) { locations.Add(component, new LocationInformation(location, Rotation.UP)); }
public LocationInformation(IntPair location, Rotation rotation) { this.location = location; this.rotation = rotation; }