Exemplo 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 void OnVisibilityChanged(BulletGridGenerator.GameCell cell, bool newVisibility)
    {
        updateOverlayForCell(cell.Cell.GetComponent <Cell>(), newVisibility);

        GridPosition cellPosition = cell.Cell.GetComponent <Cell>().GridPosition;
        int          x            = cellPosition.X;
        int          y            = cellPosition.Y;

        updateCornerSprite(x, y);
        updateCornerSprite(x + 1, y);
        updateCornerSprite(x, y + 1);
        updateCornerSprite(x + 1, y + 1);

        updateHorizontalEdgeSprite(x, y);
        updateHorizontalEdgeSprite(x, y + 1);

        updateVerticalEdgeSprite(x, y);
        updateVerticalEdgeSprite(x + 1, y);
    }