youvsvirus / youvsvirus-unity

Unity version of the you vs virus game.
GNU General Public License v3.0
1 stars 1 forks source link

Create non-spawnable space #103

Closed holke closed 4 years ago

holke commented 4 years ago

We need something to restrict the spawnable space for smileys. Example: In the hospital level, we do not want smileys to spawn inside the hospital.

A solution should be modular and easily applicable for all levels.

holke commented 4 years ago

I just had the idea to create a gameobject with multiple circle Colliders. The circle colliders define the non-spawnable space. We can then attach a script to this object that gets a point and checks whether this point is inside any of the colliders. If so it returns false.

Thus a smiley creation routine can determine random coordinates, then ask this script if they are ok and if not start over again.

I think we must take circle colliders because otherwise an IsInsideCollider function is hard to get.