예제 #1
0
    // Update is called once per frame
    public void TakeTurn()
    {
        int[,] ZERO_ARRAY = new int[7, 7] //-1 is out of bounds, 1 is blocked, 0 is open
        {
            { -1, -1, -1, -1, -1, -1, -1 },
            { -1, -1, -1, -1, -1, -1, -1 },
            { -1, -1, 1, 1, 1, -1, -1 },
            { -1, -1, 1, 1, 1, -1, -1 },
            { -1, -1, 1, 1, 1, -1, -1 },
            { -1, -1, -1, -1, -1, -1, -1 },
            { -1, -1, -1, -1, -1, -1, -1 },
        };

        openTiles = new List <GameObject>();
        posArray  = ZERO_ARRAY;

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Open Tile"))
        {
            openTiles.Add(go);
            tileScript ts = go.GetComponent <tileScript>();
            posArray[ts.row + 1, ts.column + 1] = 0;
        }

        if (openTiles.Count == 0)
        {
            //End mini-game
        }
        else
        {
            DecisionMaker();
        }
    }
예제 #2
0
    private GameObject FindByCoordinates(int i, int j)
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Open Tile"))
        {
            tileScript ts = go.GetComponent <tileScript>();
            if (ts.row == i - 1 && ts.column == j - 1)
            {
                return(go);
            }
        }

        return(null);
    }