Ejemplo n.º 1
0
    public override IEnumerator Execute(Board board, Lock locker = null)
    {
        if (locker != null)
        {
            locker.SignalStart();
        }
        foreach (GameObject g_ in board.tiles)
        {
            GridTile g = g_.GetComponent <GridTile>();
            if (this.InQuadrant(g.position, board.size))
            {
                g.Animate(new HueSine(), Colors.DOOM, true);
                g.MakeInAccessible();
                if (g.IsInhabited() && g.inhabitant is Agent)
                {
                    ((Agent)g.inhabitant).DoDamage(1);
                }
                // TODO: add accessibility toggle?
            }
        }
        if (locker != null)
        {
            locker.SignalStop();
        }

        yield return(null);
    }
Ejemplo n.º 2
0
 // Returns whether the tile at given position is free, i.e. accessible and unihabited.
 public bool IsFreeTile(Vector2Int pos)
 {
     if (this.InBounds(pos))
     {
         GridTile tile = this.tiles[pos.x, pos.y].GetComponent <GridTile>();
         return(tile.accessible && !tile.IsInhabited());
     }
     else
     {
         Debug.LogWarning("Asked for freeness of out of bounds tile coordinates (" + pos.x + ", " + pos.y + ")");
         return(true);
     }
 }