public void HitSound(Damager damager, Damageable damageable)
 {
     Debug.Log("HIT");
     //CrowdManager.instance.SetState(CrowdManager.STATES.CHEER, 1000);
     AudioManager.Instance.PlaySfx(CheerSounds[Random.Range(0, CheerSounds.Length)], "arena_ambience");
     AudioManager.Instance.PlayRandomSfx3D("player_hit", ref audio);
 }
Exemple #2
0
 public void onTakeDamage(Damager damager, Damageable damageable)
 {
     CrowdManager.instance.SetState(CrowdManager.STATES.OOH, 1000);
     AudioManager.Instance.PlaySfx(BoohSounds[Random.Range(0, BoohSounds.Length)], "arena_ambience");
     animator.SetInteger("life", damageable.CurrentHealth);
     animator.SetTrigger("hit");
 }
Exemple #3
0
        public void TakeDamage(Damager damager, bool ignoreInvincible = false)
        {
            if ((m_Invulnerable && !ignoreInvincible) || m_CurrentHealth <= 0)
            {
                return;
            }

            //we can reach that point if the damager was one that was ignoring invincible state.
            //We still want the callback that we were hit, but not the damage to be removed from health.
            if (!m_Invulnerable)
            {
                m_CurrentHealth -= damager.damage;
                OnHealthSet.Invoke(this);
            }

            m_DamageDirection = transform.position + (Vector3)centreOffset - damager.transform.position;
            OnTakeDamage.Invoke(damager, this);
            OnTakeDamageBt.Invoke(damager, this);

            if (gameObject.CompareTag("Player"))
            {
                SpeechBubbleManager.Instance.AddSpeechBubble
                    (transform, Speech.GetSpeech(EnumAction.PLAYER_TAKESDAMAGE, EnumLevel.ANY));
            }
            else if (gameObject.CompareTag("Minotaur"))
            {
                SpeechBubbleManager.Instance.AddSpeechBubble
                    (transform, Speech.GetSpeech(EnumAction.MINOTAUR_TAKESDAMAGE, EnumLevel.ANY),
                    SpeechBubbleManager.SpeechbubbleType.ANGRY);
            }

            if (m_CurrentHealth <= 0)
            {
                OnDie.Invoke(damager, this);
                m_ResetHealthOnSceneReload = true;
                EnableInvulnerability();
                if (disableOnDeath)
                {
                    gameObject.SetActive(false);
                }
            }
        }
 public void DeathSound(Damager damager, Damageable damageable)
 {
     CrowdManager.instance.SetState(CrowdManager.STATES.OOH, 1000);
     AudioManager.Instance.PlayRandomSfx3D("player_death", ref audio);
     AudioManager.Instance.PlaySfx(DeathSounds[Random.Range(0, DeathSounds.Length)], "arena_ambience");
 }