Graphics Reference
In-Depth Information
The wave spawn controller (in the variable WaveSpawnController) keeps track of how
many enemies there are, so that it knows when to spawn new ones. Each time an enemy is
destroyed, the game controller needs to call its Fragged() function once:
// tell spawn controller that we're one enemy closer to the
// next wave
WaveSpawnController.Fragged();
}
The PlayerHit() function makes an explosion sound via the BaseSoundController
instance, then spawns an explosion wherever the player is. The player control script will
call this function when it collides with an enemy projectile:
public void PlayerHit(Transform whichPlayer)
{
// tell our sound controller to play an explosion sound
BaseSoundController.Instance.PlaySoundByIndex( 2,
whichPlayer.position );
// call the explosion function!
Explode( whichPlayer.position );
}
Each time a new enemy is added to the world, it needs to tell the radar to track it.
The game controller acts as a go-between in its AddEnemyToRadar() function, which
takes the transform of the new object to be added and passes it on to the radar via its
AddEnemyBlipToList() function:
public void AddEnemyToRadar( Transform aTransform )
{
theRadarControlScript.AddEnemyBlipToList( aTransform );
}
When an enemy is destroyed, the radar has no way to tell whether or not to keep try-
ing to track it. The game controller uses this RemoveEnemyFromRadar function to tell the
radar to stop tracking the transform passed in as a parameter:
public void RemoveEnemyFromRadar( Transform aTransform )
{
theRadarControlScript.RemoveEnemyBlip( aTransform );
}
There may be occasions when the main player script, its gameObject, or its trans-
form needs to be accessed through other scripts, so game controller provides the
GetMainPlayerScript(), GetMainPlayerTransform(), and GetMainPlayerGO() functions:
public Player_LBS GetMainPlayerScript ()
{
return focusPlayerScript;
}
public Transform GetMainPlayerTransform ()
{
return playerGO1.transform;
Search WWH ::




Custom Search