void OnTriggerEnter(Collider other) { if (other.tag == "PlayerHuman" && !reached) { Debug.Log("Checkpoint: " + transform.name); reached = true; LastCheckpoint = this; StartCoroutine(SetupOthersOnCheckpoint()); InstantiatePlayers(); //InstantiatePlayerParts(); InstantiateObjects(); } }
public static void RestartScene(bool OnCheckpoint = true, bool HumanDeathCounter = false, bool DogDeathCounter = false) { if (instance.restartLoading) { return; } instance.restartLoading = true; instance.HumanDeaths += HumanDeathCounter ? 1 : 0; instance.DogDeaths += DogDeathCounter ? 1 : 0; if (instance.checkpoint && OnCheckpoint) { Checkpoint3 c = instance.checkpoint.GetComponent <Checkpoint3>(); if (c) { c.ResetOnCheckpoint(); return; } } instance.StartCoroutine(LoadSceneIndexCoroutine(SceneManager.GetActiveScene().buildIndex, false)); }