public static void rebuildGameFromGameState() { //We put the player in the last checkpoint CheckpointStub lastCheckpoint = checkPointManager.getLastCheckpoint(); GameManager.audioManager.RestartSong(); if (lastCheckpoint != null) { player.transform.position = lastCheckpoint.checkPointObject.transform.position; } else { Debug.Log("No checkpoint to put Big P. in"); } player.GetComponent <PlayerController>().reset(); player.GetComponent <SpaceGravityBody> ().bindToClosestPlanet(); mainCamera.GetComponent <CameraFollowingPlayer>().resetPosition(); //minimapCamera.SetActive(false); //Despawn all the enemies EnemySpawned[] enemies = (EnemySpawned[])GameObject.FindObjectsOfType(typeof(EnemySpawned)); foreach (EnemySpawned enemy in enemies) { //It works since it doesn't destroy it immediatly? enemy.OnDespawn(); } }
public void registerCheckpoint(GameObject checkpoint,int index) { CheckpointStub stub = new CheckpointStub (checkpoint, index); checkPointsList.Add (stub); }
public void registerCheckpoint(GameObject checkpoint, int index) { CheckpointStub stub = new CheckpointStub(checkpoint, index); checkPointsList.Add(stub); }