public void DeathSetup() //Setting up the player for dying. { if (!deathSetupHasBEgun) { deathSetupHasBEgun = true; Game.current.Progress.PlayerDeathCount++; LevelGM.Instance.PlayDeathTune(); LevelGM.Instance.PlayerDeath(PlayerObj); //Calls the GM's function for player death to take care of the rest. //myVoiceBox.clip = DeathGrunt; //myVoiceBox.Play(); // DeadAudioSource.Play(); Debug.Log("Death Setup"); HealthScript.HP = 0; PlayerHealthState = Player_States.PlayerHealthStates.Dead; //myColl.enabled = false; myRB.gravityScale = 5; //myRB.isKinematic = true; myRB.velocity = new Vector2(0, 0); RigidbodyConstraints2D DeathConstraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation; myRB.constraints = DeathConstraints; MeleeScript.ResetMeleeState(); LevelGM.Instance.ClearMind = false; ClearMindOverlay.SetActive(false); myAnim.SetBool("Dashing", false); myAnim.SetBool("ClearMind", false); myAnim.SetBool("WallSlash", false); myAnim.SetBool("DashEnder", false); myAnim.SetBool("AerialSlash", false); myAnim.SetBool("CrouchSlash", false); myAnim.SetBool("WallCling", false); myAnim.SetBool("Crouching", false); myAnim.SetBool("Jump", false); myAnim.SetBool("Airborne", false); myAnim.SetBool("Death", true); //SmokeTrail.Stop(); DashEffect.SetActive(false); myAnim.SetTrigger("DeathCall"); deathWaiting = true; Invoke("PlayerDeath", DeathAnimation.length / 2); } }
// Use this for initialization void Start() { PlayerObj = this.gameObject; //sets the player object PlayerState = Player_States.PlayerStates.Normal; //sets state to default PlayerHealthState = Player_States.PlayerHealthStates.Normal; //sets health state to default. // DeadAudioSource.Stop(); //AudioListener.pause = true; // JumpFall.Stop(); // myVoiceBox.Stop(); foreach (GameObject gos in OutfitModels) { gos.SetActive(true); } switch (Game.current.Progress.CurrentOutfit) { case Player_States.OutfitSettings.Default: myModel = OutfitModels[0]; myAnim = OutfitAnim[0]; BackspotMain = Backspot[0]; LeftSpotMain = LeftSpot[0]; RightSpotMain = RightSpot[0]; HeadBonePosition = HeadBones[0]; Destroy(OutfitModels[1]); Destroy(OutfitModels[2]); Destroy(OutfitModels[3]); Destroy(OutfitModels[4]); Destroy(OutfitModels[5]); break; case Player_States.OutfitSettings.Enemy: myModel = OutfitModels[1]; myAnim = OutfitAnim[1]; BackspotMain = Backspot[1]; LeftSpotMain = LeftSpot[1]; RightSpotMain = RightSpot[1]; HeadBonePosition = HeadBones[1]; Destroy(OutfitModels[0]); Destroy(OutfitModels[2]); Destroy(OutfitModels[3]); Destroy(OutfitModels[4]); Destroy(OutfitModels[5]); break; case Player_States.OutfitSettings.Shadow: myModel = OutfitModels[2]; myAnim = OutfitAnim[2]; BackspotMain = Backspot[2]; LeftSpotMain = LeftSpot[2]; RightSpotMain = RightSpot[2]; HeadBonePosition = HeadBones[2]; Destroy(OutfitModels[1]); Destroy(OutfitModels[0]); Destroy(OutfitModels[3]); Destroy(OutfitModels[4]); Destroy(OutfitModels[5]); break; case Player_States.OutfitSettings.Enlightened: myModel = OutfitModels[3]; myAnim = OutfitAnim[3]; BackspotMain = Backspot[3]; LeftSpotMain = LeftSpot[3]; RightSpotMain = RightSpot[3]; HeadBonePosition = HeadBones[3]; Destroy(OutfitModels[1]); Destroy(OutfitModels[2]); Destroy(OutfitModels[0]); Destroy(OutfitModels[4]); Destroy(OutfitModels[5]); break; case Player_States.OutfitSettings.Boss: myModel = OutfitModels[4]; myAnim = OutfitAnim[4]; BackspotMain = Backspot[4]; LeftSpotMain = LeftSpot[4]; RightSpotMain = RightSpot[4]; HeadBonePosition = HeadBones[4]; Destroy(OutfitModels[1]); Destroy(OutfitModels[2]); Destroy(OutfitModels[3]); Destroy(OutfitModels[0]); Destroy(OutfitModels[5]); break; case Player_States.OutfitSettings.Basic: myModel = OutfitModels[5]; myAnim = OutfitAnim[5]; BackspotMain = Backspot[5]; LeftSpotMain = LeftSpot[5]; RightSpotMain = RightSpot[5]; HeadBonePosition = HeadBones[5]; Destroy(OutfitModels[1]); Destroy(OutfitModels[2]); Destroy(OutfitModels[3]); Destroy(OutfitModels[0]); Destroy(OutfitModels[4]); break; } myModel.name = "Model"; BackSword1.transform.parent = BackspotMain.transform; //Backsword2.transform.parent = BackspotMain.transform; LeftSword.transform.parent = LeftSpotMain.transform; RightSword.transform.parent = RightSpotMain.transform; LeftSword.transform.position = LeftSpotMain.transform.position; RightSword.transform.position = RightSpotMain.transform.position; myModel.transform.parent = ParentToModel; ClearMindOverlay.SetActive(false); DashEffect.SetActive(false); ClearMindOverused = false; if (Game.current.Progress.Sword1 != Player_States.SwordsObtainedStatus.NotReached && Game.current.Progress.ClearMindLevel == Player_States.ClearMindUpgrade.NotReached) { ClearMindOverused = true; } if (LevelGM.Instance.RespawnSFXCanPlay) { ReviveSFX.Play(); } //SmokeTrail.Stop(); //if (SmokeTrail != null) //{ // if (ClingToWall) // { // SmokeTrail.Play(); // } // else // { // SmokeTrail.Stop(); // } // } // DamageInvuln = DamageAnimation.length/4; //Sets the DamageInvuln float to the length of the referenced animation clip. Overrides whatever float was put in in inspector }