예제 #1
0
    private void Step()
    {
        AntCell antCell = grid[currentCellIndex.x, currentCellIndex.y];

        if (antCell.isActive)
        {
            TurnLeft();
        }
        else
        {
            TurnRight();
        }
        antCell.StepOnCell();
    }
예제 #2
0
    private void Awake()
    {
        side = Side.Down;
        currentCellIndex.x = width / 2;
        currentCellIndex.y = height / 2;
        grid = new AntCell[width, height];
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                AntCell cell = Instantiate(cellPrefab);
                cell.transform.position = EvaluateCellSize(i, j);
                cell.transform.SetParent(transform);
                cell.gameObject.name = $"{i} {j}";
                grid[i, j]           = cell;
            }
        }

        StartCoroutine(nameof(UpdareLife));
    }