Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public void AddComponent(ShipComponent component, IntPair location)
 {
     locations.Add(component, new LocationInformation(location, Rotation.UP));
 }
Exemplo n.º 3
0
 public LocationInformation(IntPair location, Rotation rotation)
 {
     this.location = location;
     this.rotation = rotation;
 }