Graphics Reference
In-Depth Information
references as it just did for the first player but this time for the second player and placed
into variables suffixed with a 2 instead of a 1:
// now, if there *is* a player 2, let's tell it to get going
if(totalPlayers>1)
{
// find the player's control script and hold it in
// playerScript
playerScript2=
playerGO2.GetComponent<Player_SpaceShip_IP>();
mainPlayerDataManager2=
playerGO2.GetComponent<BasePlayerManager>().DataManager;
Just as with the first player, a message is sent to the player's Player_SpaceShip_IP com-
ponent to prepare the player by calling upon its GameStart() function:
playerGO2.SendMessage( "GameStart" );
}
}
StopMovingForward() and ContinueForward() will be called from another script
component when movement through the level is required to stop.
public void StopMovingForward ()
{
isStopped=true;
}
public void ContinueForward()
{
isStopped=false;
}
In this game, when the player reaches the boss at the end of the level, Stop
MovingForward() is called, then ContinueForward() will be called once the boss has been
defeated just before the next level loading is started by FinishedLevel() 3 s later:
public void BossDestroyed()
{
ContinueForward();
if( BossWinToNextLevel )
{
// go to next level
Invoke("FinishedLevel", 3f);
}
}
After the big boss battle at the end of the game levels, when the boss is defeated,
FinishedLevel() is called upon to move on to the next level:
public void FinishedLevel ()
{
Search WWH ::




Custom Search