예제 #1
0
    private void PotionClicked(GameObject potionClicked)
    {
        Potion     potion         = potionClicked.GetComponent <Potion>();
        Vector2Int potionPosition = potion.GetPosition();

        Debug.Log("Potion clicked colour: " + potion.colour + ", at position: " + potionPosition);          //TODO Remove log

        HashSet <GameObject> effectedTiles = TraverseAdjoiningTiles(potionPosition, potion.colour, Direction.None);

        effectedTiles.Add(potionClicked);

        // TODO Remove this
        foreach (var tile in effectedTiles)
        {
            Vector2Int pos = tile.GetComponent <Potion>().GetPosition();
            Debug.Log(tile.name + ", position: " + pos.x + ", " + pos.y);
        }
        // ----------------

        // TODO: Note if implementing a minimum number of potions, (e.g. 3) then we need to set traveresed back to false
        RemoveTiles(effectedTiles);
        StartCoroutine(ReplaceTiles(0.5f));
    }