This is a quick prototype of a game made in 3 hours. This can be the base of a zombie escape game
Programming Structure
1. Player: The player has 2 scripts namely Player.cs and PlayerController.cs. Player.cs controls the structure of the player as it binds everything together. Every movement, Look At , Raycast is done here. The Playercontroller provides the input system (Single Responsibility Principle). If someone wanted to port this into mobile, all they need to do is change the playercontroller script codes into mobile supported controls.
2. Enemy: It has Enemy.cs script providing the structure of enemy. It derives from IDamagable.cs interface (Interface segregation) which script introduces the health and provides a structure for the type of objects those are damageable. In this case which is only the enemy. The navmeshAgent enables the enemy to move on the map and follow the player avoiding obstacles along the way
3. Gun: Gun.cs and GunController.cs controls the weapon. It is extendible and as many guns as needed can be added. Guncontroller is added to player and it can take any sort of Gun as input. So, this way we can make new type of Guns without changing the code (Open Closed Principle).
4. Wave: The enemies attack in waves. Each wave contains 2 properties. Wave enemies and time between enemy spawn. The values start at 5 and 1 respectively. The wave enemies determine how many enemies will be spawned in this wave. The time between spawn determines after how many seconds the next enemy will spawn. Thus, in the first wave 5 enemies will be spawned with 1 second difference of spawning time. After one wave is finished, that is all enemies are killed in the current wave the next wave starts. Each time a wave starts the number of enemies increased by 5 and time between spawn is decreased by 0.1 second and gets stuck at .3 seconds and doesnot decrease from then on. Enemies are spawned at random locations throughout the map.
5. Lastly we have the UIController which follows the MVC framework. This is the Controller of the framework. The UI shown the previous image is the view and Model is the above described points from 1-4.