コード例 #1
0
    public void OnHitForMonster(AttackType attackType)
    {
        if ((attackType == AttackType.ATTACK1 ||
             attackType == AttackType.ATTACK2 ||
             attackType == AttackType.ATTACK3) &&
            ((int)redhat.CurrentAttackType & (int)attackType) != 0)
        {
            return;
        }

        if (redhat.CurrentState == RedHatState.DEAD)
        {
            return;
        }

        if (PlayerFSMManager.Instance.isNormal)
        {
            PlayerEffects.Instance.basicNormal.ItemSetActive(redhat.hitLocation, "Effect");
        }

        if (!PlayerFSMManager.Instance.isNormal)
        {
            PlayerEffects.Instance.basicSpecial.ItemSetActive(redhat.hitLocation, "Effect");
        }

        redhat.CurrentAttackType = attackType;
        int        value      = GameLib.TransformTypeToInt(attackType);
        PlayerStat playerStat = PlayerFSMManager.Instance.Stat;

        float damage = (playerStat.GetStr() * playerStat.dmgCoefficient[value] * 0.01f);

        StartCoroutine(display.DamageDisplaying(damage));

        CharacterStat.ProcessDamage(playerStat, redhat.Stat, damage);

        if (MCSoundManager.SoundCall >= MCSoundManager.SoundSkill3Break)
        {
            var sound = GetComponentInParent <MonsterSound>().monsterSFX;
            sound.PlayMonsterSFX(this.gameObject, sound.attackSFX[value]);

            if (attackType == AttackType.SKILL3)
            {
                MCSoundManager.SoundCall = 0;
            }
        }

        //SetKnockBack(playerStat, value);
        Invoke("AttackSupport", 0.5f);

        redhat.RigidBody.velocity = Vector3.zero;
        redhat.RigidBody.velocity = -PlayerFSMManager.Instance.Anim.transform.forward
                                    * PlayerFSMManager.Instance.Stat.KnockBackPower;

        if (attackType == AttackType.ATTACK1)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f));
        }
        if (attackType == AttackType.ATTACK2)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f));
        }
        if (attackType == AttackType.ATTACK3)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.07f, 0.07f, 0.1f));
        }
        if (attackType == AttackType.SKILL1)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.05f, 0.1f, 0.1f));
        }
        if (attackType == AttackType.SKILL2)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.15f, 0.1f, 0.1f));
        }

        if (redhat.Stat.Hp > 0)
        {
            if (redhat.CurrentState == RedHatState.HIT)
            {
                return;
            }
            if (redhat.isNotChangeState)
            {
                return;
            }

            redhat.SetState(RedHatState.HIT);
        }
        else
        {
            StopAllCoroutines();
            redhat.SetDeadState();
        }
    }
コード例 #2
0
    public void OnHitForMonster(AttackType attackType)
    {
        if ((attackType == AttackType.ATTACK1 ||
             attackType == AttackType.ATTACK2 ||
             attackType == AttackType.ATTACK3) &&
            ((int)mac.currentAttackType & (int)attackType) != 0)
        {
            return;
        }

        if (mac.CurrentState == MacState.DEAD)
        {
            return;
        }

        if (PlayerFSMManager.Instance.isNormal)
        {
            PlayerEffects.Instance.basicNormal.ItemSetActive(mac.hitLocation, "Effect");
        }

        if (!PlayerFSMManager.Instance.isNormal)
        {
            PlayerEffects.Instance.basicSpecial.ItemSetActive(mac.hitLocation, "Effect");
        }

        mac.currentAttackType = attackType;
        int value = GameLib.TransformTypeToInt(attackType);

        PlayerStat playerStat = PlayerFSMManager.Instance.Stat;

        float damage = (playerStat.GetStr() * playerStat.dmgCoefficient[value] * 0.01f);

        StartCoroutine(display.DamageDisplaying(damage));
        CharacterStat.ProcessDamage(playerStat, mac.Stat, damage);

        if (MCSoundManager.SoundCall >= MCSoundManager.SoundSkill3Break)
        {
            var sound = GetComponentInParent <MonsterSound>().monsterSFX;
            sound.PlayMonsterSFX(this.gameObject, sound.attackSFX[value]);

            if (attackType == AttackType.SKILL3)
            {
                MCSoundManager.SoundCall = 0;
            }
        }

        Invoke("AttackSupport", 0.5f);


        if (attackType == AttackType.ATTACK1)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f));
        }
        if (attackType == AttackType.ATTACK2)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f));
        }
        if (attackType == AttackType.ATTACK3)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.07f, 0.07f, 0.1f));
        }
        if (attackType == AttackType.SKILL1)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.2f, 0.1f, 0.1f));
        }
        if (attackType == AttackType.SKILL2)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.15f, 0.1f, 0.1f));
        }

        if (mac.Stat.Hp > 0)
        {
            if (mac.CurrentState == MacState.HIT)
            {
                return;
            }

            mac.SetState(MacState.HIT);
        }
        else
        {
            mac.SetDeadState();
        }
    }
コード例 #3
0
    public void OnHitForBoss(AttackType attackType)
    {
        if ((attackType == AttackType.ATTACK1 ||
             attackType == AttackType.ATTACK2 ||
             attackType == AttackType.ATTACK3) &&
            ((int)riris.CurrentAttackType & (int)attackType) != 0)
        {
            return;
        }

        if (riris.CurrentState == RirisState.DEAD)
        {
            return;
        }

        if (PlayerFSMManager.Instance.isNormal)
        {
            PlayerEffects.Instance.basicNormal.ItemSetActive(riris.Pevis, "Effect");
        }

        if (!PlayerFSMManager.Instance.isNormal)
        {
            PlayerEffects.Instance.basicSpecial.ItemSetActive(riris.Pevis, "Effect");
        }

        riris.CurrentAttackType = attackType;
        int        value      = GameLib.TransformTypeToInt(attackType);
        PlayerStat playerStat = PlayerFSMManager.Instance.Stat;

        float damage = (playerStat.GetStr() * playerStat.dmgCoefficient[value] * 0.01f);

        if (damage <= 10.0f)
        {
            damage = 10.0f;
        }
        StartCoroutine(display.DamageDisplaying(damage));

        //riris.Stat.TakeDamage(playerStat, damage);
        CharacterStat.ProcessDamage(playerStat, riris.Stat, damage);

        if (MCSoundManager.SoundCall >= MCSoundManager.SoundSkill3Break)
        {
            var sound = GetComponentInParent <MonsterSound>().monsterSFX;
            sound.PlayMonsterSFX(this.gameObject, sound.attackSFX[value]);

            if (attackType == AttackType.SKILL3)
            {
                MCSoundManager.SoundCall = 0;
            }
        }

        //SetKnockBack(playerStat, value);
        Invoke("AttackSupport", 0.5f);

        if (attackType == AttackType.ATTACK1)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f));
        }
        if (attackType == AttackType.ATTACK2)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.03f, 0.04f, 0.1f));
        }
        if (attackType == AttackType.ATTACK3)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.07f, 0.07f, 0.1f));
        }
        if (attackType == AttackType.SKILL1)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.05f, 0.1f, 0.1f));
        }
        if (attackType == AttackType.SKILL2)
        {
            StartCoroutine(Shake.instance.ShakeCamera(0.15f, 0.1f, 0.1f));
        }
        //if (attackType == AttackType.SKILL3)
        //    StartCoroutine(Shake.instance.ShakeCamera(0.01f, 0.01f, 0.01f));

        if (riris.Stat.Hp > 0)
        {
            if (damage > 0)
            {
                StartCoroutine(GameLib.Blinking(riris.materials, Color.white));
            }
        }
        else
        {
            riris.SetDeadState();
            StopAllCoroutines();
        }
    }