private void RespondTo_HeroWasHit_Event() { // Fire event: Hero was hit HeroWasHit?.Invoke(); // Set hero as dead on boss manager bossManager.SetHeroAsDead(); // Set state as serenity obstacleManager.SetStateAs_Serenity(); }
// ---------- COLLISIONS AND OTHER ACTIONS ----------------------------------------------------+ #region REACT TO PROJECTILE COLLISION public void ReactTo_ProjectileCollision() { // Do not react to projectiles if hero is dead if ((heroState == HeroStates.DEAD) || (heroState == HeroStates.GAME_OVER)) { return; } // ----- CHANGE ANIMATIONS ----- // Start getting hit animation animatorController.StartDeadAnimation(); // Deny player input DenyPlayerInput(); // Stop dodging StopDodging(true); // Stop jumping animation if possible if (!IsGrounded()) { animatorController.StopJumpingAnimation(); } // Start VFX animation //vfxTakeHit.StartAnimationCycle(); // ----- OTHER ACTIONS ----- // Physically react to hit PhysicallyReactToHit(); // Set collider as trigger fullCollider.isTrigger = true; // Change tag hero.tag = "Hero Dying"; // Set match state as "hero dying" heroState = HeroStates.DEAD; // Fire event: Hero was hit HeroWasHit?.Invoke(); // Add slow mo Time.timeScale = 0.75f; }