Graphics Reference
In-Depth Information
Once the PlayerDied() function has established that the game is over for all players,
the Exit() function is called to shut things down and leave the game, loading the menu
scene:
void Exit()
{
Any references held by the spawn controller are wiped out at the end of the game, with
SpawnController.Restart(), and this game control script is destroyed:
SpawnController.Instance.Restart();
Destroy( this.gameObject );
SceneManager will be used to load the menu scene. GetSceneManager() makes sure
that we have a reference to it, then a call to its LoadLevel() function passes the name of the
menu scene to be loaded:
// make sure we have a scene manager to talk to
GetSceneManager ();
sceneManager.LoadLevel( mainMenuSceneName );
}
}
14.3.3 Player Spaceship
BaseTopDownSpaceShip is a movement control class discussed in Chapter 5 of this topic.
using UnityEngine;
using System.Collections;
public class Player_SpaceShip_IP : BaseTopDownSpaceShip
{
private Standard_SlotWeaponController weaponControl;
private bool isInvulnerable;
private bool isRespawning;
public bool isMouseControlled;
private bool fire_input;
// alternative control method
private Mouse_Input mouse_input;
public GameObject theMeshGO;
public GameObject shieldMesh;
public BasePlayerManager myPlayerManager;
public BaseUserManager myDataManager;
public bool godMode =true;
public int ownerID =-1;
public override void Start()
{
Search WWH ::




Custom Search