Beispiel #1
0
 private void SetDirection(Direction direction)
 {
     currentDirection = direction;
     // Clear area
     foreach (Tile oldTile in area.AllTiles())
     {
         oldTile.ResetDisplay();
     }
     area.Clear();
     // Set area
     if (direction == Direction.NONE)
     {
         return;
     }
     (int x, int y) = wide ? launcher.on.GetNeighborCoords(direction.Opposite()) : (launcher.on.x, launcher.on.y);
     foreach (Tile newTile in BoardUtils.AllTiles(t => {
         if (BoardUtils.DirectionTo(x, y, t) != direction)
         {
             return(false);
         }
         float distance = BoardUtils.DistanceBetween(launcher.on, constraint, t);
         return(minRange <= distance && distance <= maxRange);
     }))
     {
         var flow = new TileFlow(newTile, direction);
         area.Add(flow);
         flow.UpdateDisplay(2, Tile.TileColor.VALID);
     }
 }
Beispiel #2
0
        public override void Start(Piece launcher)
        {
            base.Start(launcher);
            TileFlow first = new TileFlow(launcher.on);

            area.Add(first);
            first.UpdateDisplay(2, IsValid() ? Tile.TileColor.VALID : Tile.TileColor.ERROR);
        }
Beispiel #3
0
        private void SetCenter(Tile tile)
        {
            center = tile;
            // Clear area
            foreach (Tile oldTile in area.AllTiles())
            {
                oldTile.ResetDisplay();
            }
            area.Clear();
            // Set area
            bool valid = CanTarget(center);

            foreach (Tile newTile in BoardUtils.AreaOf(center, areaRange, areaConstraint))
            {
                var flow = new TileFlow(newTile);
                area.Add(flow);
                flow.UpdateDisplay(1, valid ? Tile.TileColor.SECONDARY : Tile.TileColor.ERROR);
            }
            new TileFlow(center).UpdateDisplay(CanTarget(center) ? 2 : 1, valid ? Tile.TileColor.VALID : Tile.TileColor.ERROR);
        }