Ejemplo n.º 1
0
    public void notifyTimestep()
    {
        GridPosition position = gameObject.GetComponent <GridPositionComponent>().position;

        BulletGridGenerator.GameCell cell = currentLevel.getCellAt(position);
        cell.Cell.GetComponent <Cell>().Eat(1, false);
        if (cell.Nanobot == null)
        {
            currentLevel.moveBotAnimated(position, this, new GridPosition(0, 0), 5, false, true);
            return;
        }
        for (int x = 0; x < schematic.getTransformation().Length; x++)
        {
            if (schematic.getTransformation()[x] != null)
            {
                for (int y = 0; y < schematic.getTransformation()[x].Length; y++)
                {
                    if (schematic.getTransformation()[x][y] != null)
                    {
                        currentLevel.moveBotAnimated(position, schematic.getTransformation()[x][y], new GridPosition(x - 1, y - 1), 5, false, false);
                    }
                }
            }
        }
    }
    private bool getCellIsVisible(int x, int y)
    {
        if (x >= 0 && y >= 0 && x < grid.GameGrid.Length && y < grid.GameGrid[0].Length)
        {
            return(grid.getCellAt(new GridPosition(x, y)).isExplored);
        }

        return(false);
    }
Ejemplo n.º 3
0
 void explodeTerrain(GridPosition position)
 {
     for (int x = -radius; x <= radius; x++)
     {
         for (int y = -radius; y <= radius; y++)
         {
             GridPosition offset   = new GridPosition(x, y);
             GridPosition adjacent = _grid.applyDelta(position, offset);
             if (adjacent != null)
             {
                 _grid.getCellAt(adjacent).Cell.GetComponent <Cell>().Eat(TerrainSplashDamage, true);
             }
         }
     }
 }