private void DeathEffect() { SlowMotion.SlowTime(deathSlowdown, slowFadeIn, slowFadeOut); CameraHandler.ScreenShake(0.7f, 0.3f, 1f); if (deathEffect == null) { return; } var effect = Instantiate(deathEffect, transform.position, transform.rotation); effect.transform.parent = null; Destroy(effect, deathEffectLifetime); if (trail != null) { trail.transform.parent = null; trail.Stop(); Destroy(trail, 10f); } if (isGameOverOnDeath) { LevelHandler.Instance.GameOver(); } }
private void PlayerRolled(CharacterController charController) { gameObject.layer = INV_LAYER; invTimer = invTime; dodgeTimer = dodgeCooldown; SlowMotion.SlowTime(0.3f, 0.2f, 0.6f); animator.SetTrigger("Dodge"); dodgeEffect.Play(); dodgeSound.pitch = Random.Range(0.9f, 1.1f); dodgeSound.Play(); }
public void TakeDamage(float damage) { currentHealthPoints = Mathf.Clamp(currentHealthPoints - damage, 0f, maximumHealthPoints); if (currentHealthPoints <= 0) { StartCoroutine(KillCharacter()); } else { PlayAudioHit(); } slowMotion.SlowTime(); }
void OnCollisionEnter(Collision collision) { GameObject target = collision.gameObject; HealthSystem healthSystem = target.GetComponent <HealthSystem>(); SlowMotion slowMotion = Camera.main.GetComponent <SlowMotion>(); if (healthSystem) { healthSystem.TakeDamage(damageToDeal); slowMotion.SlowTime(); ParticleUtility.PlayParticleEffect( target.transform, particleEffectPrefab, target.transform.position, ParticleUtility.PARTICLE_STD_Y_OFFSET ); } Destroy(gameObject); }