コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: Minotaur.cs プロジェクト: MarcBrout/god-games
 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");
 }
コード例 #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);
                }
            }
        }
コード例 #4
0
 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");
 }