コード例 #1
0
 void Awake()
 {
     if(globalGameManager == null)				 // S'assure qu'il n'y a qu'une instance du GameController
     {
         DontDestroyOnLoad(gameObject);
         globalGameManager = this;
     }
     else if(globalGameManager != this)
     {
         Destroy(gameObject);
     }
 }
 void Start()
 {
     globalGameManager = GameObject.FindGameObjectWithTag("GlobalGameManager").GetComponent<_GlobalGameManager>(); // Récupere le GameController actif
 }
コード例 #3
0
 void Start()
 {
     gameController = GameObject.FindGameObjectWithTag("GlobalGameManager").GetComponent<_GlobalGameManager>();	// Récupere le game controller existant
     if(gameController.newGame)																					// Si new game
     {
         Save ();																								// Sauvegarde la partie vanilla
         Debug.Log ("Saved");
     }
     if(gameController.loadGame)																					// Si load game
     {
         Load ();																								// Charge la partie
         Debug.Log ("loaded");
     }
     gameController.newGame = false;																				// reinitialise GameController
     gameController.loadGame = false;																			// ...
 }