Ejemplo n.º 1
0
    private bool ShouldStunPlayer(AttackArea attackArea)
    {
        bool chanceToRandomlyHurtPlayer = attackArea.GetComponentInParent <Transform>().tag == "Boss" || random.Next() > 0.5;
        bool isAttackKnife = attackArea && attackArea.GetAttackType() == Weapon.AttackType.Knife;

        return(chanceToRandomlyHurtPlayer && !isAttackKnife);
    }
Ejemplo n.º 2
0
    private void OnCollision(Collider2D collider)
    {
        AttackArea attackArea = collider.GetComponent <AttackArea>();

        if (attackArea && attackArea.IsShootType())
        {
            return;
        }

        if (collider.tag == "Damage")
        {
            damageAmount = collider.transform.GetComponentInParent <Attack>().GetDamageAmount();
            ExecuteDamage(damageAmount, collider);

            if (name.Contains("Bear"))
            {
                if (UnityEngine.Random.value < 0.33f)
                {
                    SoundPlayer.Play("Damage React Bear");
                }
            }
            else if (name.Contains("Officer-Boss"))
            {
                SoundPlayer.Play("Battlefield Boss Hit");
            }
            else if (name.Contains("RobertELee"))
            {
                SoundPlayer.Play("Lee Hit");
            }
            //else if (name.Contains("Officer"))
            //    SoundPlayer.Play("Officer Hit");
            else if (name.Contains("Rifleman"))
            {
                SoundPlayer.Play("Rifleman Hit");
            }
            else if (name.Contains("Bushwhacker"))
            {
                SoundPlayer.Play("BushWhacker Hit");
            }
            else if (name.Contains("Officer"))
            {
                SoundPlayer.Play("Officer Hit");
            }
            else if (name.Contains("Woman"))
            {
                SoundPlayer.Play("Woman Hit");
            }
            else if (tag != "Player")
            {
                SoundPlayer.Play("Damage React Light");
            }

            if (attackArea)
            {
                if (attackArea.GetAttackState() == Attack.State.Heavy)
                {
                    if (attackArea.GetAttackType() == Weapon.AttackType.Swing)
                    {
                        SoundPlayer.Play("Heavy Axe Impact 1");
                        SoundPlayer.Play("Heavy Axe Impact 1.1");
                    }
                    else if (attackArea.GetAttackType() == Weapon.AttackType.Melee)
                    {
                        SoundPlayer.Play("Heavy Punch Impact 1");
                        SoundPlayer.Play("Heavy Punch Impact 1.2");
                        SoundPlayer.Play("Heavy Punch Impact 1.3");
                    }
                    else if (attackArea.GetAttackType() == Weapon.AttackType.Slash)
                    {
                        SoundPlayer.Play("Saber Impact");
                    }

                    else if (attackArea.GetAttackType() == Weapon.AttackType.Knife)
                    {
                        SoundPlayer.Play("Knife Impact");
                    }
                }
                else
                {
                    if (attackArea.GetAttackType() == Weapon.AttackType.Swing)
                    {
                        if (attackArea.GetAttackChainNumber() >= 2)
                        {
                            SoundPlayer.Play("Light Axe Impact 3");
                        }
                        else if (attackArea.GetAttackChainNumber() >= 1)
                        {
                            SoundPlayer.Play("Light Axe Impact 2");
                        }
                        else
                        {
                            SoundPlayer.Play("Light Axe Impact 1");
                        }
                    }
                    else if (attackArea.GetAttackType() == Weapon.AttackType.Melee)
                    {
                        SoundPlayer.Play("Light Punch Impact");
                    }

                    else if (attackArea.GetAttackType() == Weapon.AttackType.Slash)
                    {
                        SoundPlayer.Play("Saber Impact");
                    }

                    else if (attackArea.GetAttackType() == Weapon.AttackType.Knife)
                    {
                        SoundPlayer.Play("Knife Impact");
                    }
                }
            }
        }
    }