jellewie / Unity-Gnorts

Gnorts an RTS unity game
11 stars 7 forks source link

Gate and Tower should be able to be place in place of walls #75

Closed jellewie closed 5 years ago

jellewie commented 5 years ago

When a Stone||Wooden Gate||Tower is placed a wall should not be seen as an obstruction.

The wall (or spiked wall) should be removed upon placement of a gate. This would make the user able to place a wall, and then place gates and tower over the wall

jellewie commented 5 years ago
        if (this.gameObject.GetComponent<BuildingOption>().BuildingName == "Stone_Gate")        //If this is a stone gate
        {
            for (int i = 0; i < Hits.Length; i++)                                               //For each item hit
            {
                string Name = Hits[i].GetComponent<BuildingOption>().BuildingName;              //Get there building name
                if (Name == "Stone_Wall" || Name == "Stone_Wall_Spiked" || Name == "Wooden_Wall" || Name == "Wooden_Wall_Spiked")
                    ObjectsHitAmount--;                                                         //Remove one from the Amount ObjectsHit list (This entry should be ignored)
            }
        }
        Debug.Log(ObjectsHitAmount);
        return ObjectsHitAmount > 0;                                                            //Return true if there's at least 1 collider.