void DeathRespawnBehave() { if (wld_HealthDmg.Health <= 0) { isDying = true; if (isDying && currentTime == 0) { audioSource.PlayOneShot(deathSound); } currentTime += Time.deltaTime; anim.SetTrigger(hashIDs.deathBool); if (timeToDie <= currentTime) { isDead = true; currentTime = 0; //rb.velocity = Vector3.zero; //rb.angularVelocity = Vector3.zero; //transform.position = new Vector3(WLD_GameController.activeLevel.LevelSegments[segNumber - 1].TeleporterX, WLD_GameController.activeLevel.LevelSegments[segNumber - 1].TeleporterY, WLD_GameController.activeLevel.LevelSegments[segNumber - 1].TeleporterZ); //PlayerReset(); if (reloadLevel == false) { StartCoroutine(Death()); } else if (reloadLevel == true) { for (int i = 0; i < WLD_GameController.levels.Count; i++) { if (WLD_GameController.levels[(Scenes)i] == WLD_GameController.activeLevel) { invinsiblity = true; WLD_Teleporter teleporter = FindObjectOfType <WLD_Teleporter>(); rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; teleporter.LevelToLoad = (Scenes)i; PlayerReset(); teleporter.LoadLevelSegment(WLD_GameController.player.GetComponent <GRV_IndividualGravity>().Segment.SegmentNumber); } } } } } }
// ------------------------------------------------------------------------------ // Function Name: RestartButton // Return types: // Argument types: // Author: Kayci Lyons // Date: 10/19/17 // ------------------------------------------------------------------------------ // Purpose: When the function is called, it resets the player to the last teleporter they activated. // ------------------------------------------------------------------------------ public void RestartButton() { for (int i = 0; i < WLD_GameController.levels.Count; i++) { if (WLD_GameController.levels[(Scenes)i] == WLD_GameController.activeLevel) { WLD_Teleporter teleporter = FindObjectOfType <WLD_Teleporter>(); PLR_DeathRespawnCycle reset = FindObjectOfType <PLR_DeathRespawnCycle>(); teleporter.LevelToLoad = (Scenes)i; teleporter.LoadLevelSegment(WLD_GameController.player.GetComponent <GRV_IndividualGravity>().Segment.SegmentNumber); reset.PlayerReset(); } } ui_Pause.UnpauseButton(); EndPieceLoreElementsRestart(); SaveNotificationRestart(); FireRateRestart(); HealthOverlayReset(); ColdEffectRestart(); HeatZoneReset(); }
// ------------------------------------------------------------------------------ // Function Name: SelectSegment // Return types: NA // Argument types: NA // Author: Joseph Aranda // Date: 10/12/17 // ------------------------------------------------------------------------------ // Purpose: passes in a segment number // ------------------------------------------------------------------------------ public void SelectSegment(int i) { wld_Teleporter.LoadLevelSegment(i); }