FireControl.cs
The game is controlled by the FireControl class.
Public Variables
First let’s look at the public variables.
public GameObject m_crossHair;
public GameObject m_missile;
public GameObject m_bomb;
public GameObject m_city;
public int m_numCity = 3;
public float m_bombMinTime = 0.25f;
public float m_bombMaxTime = 1.0f;
public GameObject m_pauseMenu;
The GameObjects are prefabs that you’ll need to create and assign.
These things will be spawned by the script when the game begins.
To learn more about prefabs, check out this video: Prefabs
Private Variables
List<GameObject> m_targets; // a list of all the targeting reticles (one for each finger that's touching the screen)
List<City> m_cities;
bool m_isPaused = false;
m_cities is a list of the cities that get spawned in when the game begins.
m_targets isn’t used yet. You’re going to set that up as a list of aiming reticles that indicate where the player is touching the screen.
FireMissile()
Most of the game’s functionality is already set up for you.
The FireMissile() function takes care of creating a Missile based on the prefab and sending it towards the specified location.
DropBomb()
The enemy’s weapons are called “bombs” to differentiate them from the player’s “missiles”.
DropBomb() spawns a Bomb based on the prefab and randomly aims it at one of the player’s cities.
It then repeats that process after a random delay until the player has run out of cities to attack.
Missile.cs
Missiles take a straight path towards their target, and then they explode.
In this case, exploding means they spawn a prefab with a MissileExplosion on it.
You’ll be creating the prefab for that.
Bomb.cs
Bombs take a straight path towards one of the player’s cities, and explode when they get there.
They explode by creating a new instance of a prefab m_explosion which you will also be creating.
The Bomb class also has a LineRenderer set up for you.
We won’t really be covering that topic in class, but maybe you’ll want to take a look at how it works for your own reference.