public override void OnDefeated() { base.OnDefeated(); setState(State.Defeated, 3f); //MyRigidbody.bodyType = RigidbodyType2D.Kinematic; MyRigidbody.bodyType = RigidbodyType2D.Static; MyCollider.enabled = false; MyWeakSpot.MyCollider.enabled = false; MyAnimator.SetBool("Swooping", false); MyAnimator.SetBool("Destroyed", true); if (DefeatSplosion == null) { DefeatSplosion = ScreechParticles; } DefeatSplosion.Play(); AudioManager.AM.crossfade(AudioManager.AM.CurrentMusic, 0f, 4f); if (AudioManager.AM.GolemDestroyed) { AudioManager.AM.playGeneralSoundOneShot(AudioManager.AM.GolemDestroyed, AudioManager.AM.PlayerAudioMixer, volume: 2f, pitch: 1f, looped: false, destroyafter: 5f); } MySpriteRenderer.enabled = false; MyCollider.enabled = false; MyWeakSpot.MyCollider.enabled = false; ClawCollider.enabled = false; MyDroppedGoalElement.Collectable = false; explodeIntoPieces(); MyDroppedGoalElement.gameObject.SetActive(true); Astronaut.TheAstronaut.WatchingLocation = MyDroppedGoalElement.transform; SpriteRenderer[] rs = MyDroppedGoalElement.gameObject.GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer s in rs) { s.enabled = true; } Astronaut.TheAstronaut.Invulnerable = true; Astronaut.TheAstronaut.PlayerHasControl = false; this.Vulnerable = false; MyRigidbody.bodyType = RigidbodyType2D.Kinematic; }
public override void OnDefeated() { base.OnDefeated(); setState(State.Defeated, 3f); //MyRigidbody.bodyType = RigidbodyType2D.Kinematic; MyRigidbody.bodyType = RigidbodyType2D.Static; MyCollider.enabled = false; foreach (Lavaball lb in BallsOfLava) { if (lb.gameObject.activeInHierarchy) { GameObject.Destroy(lb.gameObject); } } BallsOfLava.Clear(); if (DefeatSplosion == null) { DefeatSplosion = RoarParticles; } DefeatSplosion.Play(); AudioManager.AM.crossfade(AudioManager.AM.CurrentMusic, 0f, 4f); if (AudioManager.AM.GolemDestroyed) { AudioManager.AM.playGeneralSoundOneShot(AudioManager.AM.GolemDestroyed, AudioManager.AM.PlayerAudioMixer, volume: 2f, pitch: 1f, looped: false, destroyafter: 5f); } MyDroppedGoalElement.Collectable = false; Astronaut.TheAstronaut.WatchingLocation = this.transform; MyDroppedGoalElement.gameObject.SetActive(true); MySpriteRenderer.enabled = false; MyCollider.enabled = false; //SlashCollider.enabled = false; Astronaut.TheAstronaut.Invulnerable = true; Astronaut.TheAstronaut.PlayerHasControl = false; this.Vulnerable = false; MyRigidbody.bodyType = RigidbodyType2D.Kinematic; }