Example #1
0
    public void AttackCheck()
    {
        CharacterStat targetStat =
            _manager.Target.GetComponent <CharacterStat>();

        CharacterStat.ProcessDamage(_manager.Stat, targetStat);
    }
Example #2
0
 public override void AttackBehavior()
 {
     base.AttackBehavior();
     // 플레이어의 거리로 피격 판정을 한다.
     if (Vector3.Distance(transform.position, _manager.PlayerTransform.position) <= _manager.MyStatData.GoblinHillWindRange)
     {
         CharacterStat.ProcessDamage(_manager.Stat, _manager.PlayerTransform.gameObject.GetComponent <CharacterStat>(), (int)(_manager.Stat.Str * _manager.MyStatData.GoblinHillWindDamageRate));
     }
 }
Example #3
0
    // 적이 닿았다면 데미지 입히기
    public void OnEnterCharacter(Collider collision)
    {
        CharacterStat targetStat =
            collision.gameObject.GetComponent <CharacterStat>();

        if (targetStat == null)
        {
            return;
        }

        CharacterStat.ProcessDamage(_manager.Stat, targetStat, (int)(_manager.Stat.Str * _manager.MyStatData.GoblinRushDamageRate));
    }
Example #4
0
    public virtual IEnumerator Skill2Timer()
    {
        pStat = PlayerFSMManager.Instance.pStat;
        float attackTime = 0.0f;

        while (attackTime < 0.3f)
        {
            //stats.TakeDamage(PlayerFSMManager.Instance.stats, 30);
            CharacterStat.ProcessDamage(pStat, stats, 200);
            attackTime += Time.deltaTime;
            yield return(new WaitForSeconds(0.1f));
        }
    }
Example #5
0
    public IEnumerator Skill2Timer()
    {
        PlayerStat stat = PlayerFSMManager.Instance.Stat;

        while (PlayerFSMManager.Instance.isSkill2AttackTime)
        {
            PlayerStat playerStat = PlayerFSMManager.Instance.Stat;
            float      damage     = (playerStat.GetStr() * playerStat.dmgCoefficient[4] * 0.002f);
            StartCoroutine(display.DamageDisplaying(damage));
            CharacterStat.ProcessDamage(playerStat, mac.Stat, damage);
            yield return(new WaitForSeconds(0.1f));
        }
    }
Example #6
0
    public static void AttackCheck(Transform from, Transform to)
    {
        CharacterStat fromStat = from.GetComponent <CharacterStat>();

        if (Vector3.Distance(from.position, to.position) <= fromStat.AttackRange)
        {
            RotateFromTo(from, to);

            CharacterStat toStat = to.GetComponent <CharacterStat>();

            CharacterStat.ProcessDamage(fromStat, toStat);

            RotateFromTo(to, from);
        }
    }
Example #7
0
 private void OnTriggerExit(Collider other)
 {
     if (other.transform.tag == "Skill2" && !isOne)
     {
         if (redhat.Stat.Hp > 0)
         {
             PlayerStat playerStat = PlayerFSMManager.Instance.Stat;
             float      damage     = (playerStat.GetStr() * playerStat.dmgCoefficient[4] * 0.01f);
             StartCoroutine(display.DamageDisplaying(damage));
             CharacterStat.ProcessDamage(playerStat, redhat.Stat, damage);
         }
         isOne = true;
         Invoke("isOneSet", 1f);
     }
 }
Example #8
0
    // 여러 오브젝트들에 대해 간단한 정보로 피해를 입히는 함수.
    public static CharacterStat AttackProcess(RaycastHit[] hitObjects, string targetTag, CharacterStat ownerStat,
                                              MonsterType type, float damage)
    {
        if (!PlayerFSMManager.Instance.isInvincibility)
        {
            PlayerFSMManager.Instance.StartCoroutine(Shake.instance.ShakeUI(0.2f, 4f, 3f));
            var color = new Color(1, 0.3725f, 0.3725f);
            PlayerFSMManager.Instance.StartCoroutine(Blinking(PlayerFSMManager.Instance.materialList, color));

            if (PlayerFSMManager.Instance.ShieldCount > 0)
            {
                PlayerFSMManager.Instance.ShieldCount--;
                return(null);
            }
            else
            {
                if (PlayerFSMManager.Instance.isIDLE)
                {
                    if (!PlayerFSMManager.Instance.isDead)
                    {
                        PlayerFSMManager.Instance.SetState(PlayerState.HIT);
                    }
                }

                CharacterStat lastHit = null;
                foreach (var hitObject in hitObjects)
                {
                    if (hitObject.collider.gameObject.tag == targetTag)
                    {
                        CharacterStat targetStat =
                            hitObject.collider.GetComponentInParent <CharacterStat>();

                        CharacterStat.ProcessDamage(ownerStat, targetStat, damage);
                        lastHit = targetStat;

                        if (type == MonsterType.RedHat)
                        {
                        }
                    }
                }
                return(lastHit);
            }
        }
        else
        {
            return(null);
        }
    }
Example #9
0
    // 여러 오브젝트들에 대해 간단한 정보로 피해를 입히는 함수.
    public static CharacterStat AttackProcess(RaycastHit[] hitObjects, string targetTag, CharacterStat ownerStat, int damage)
    {
        CharacterStat lastHit = null;

        foreach (var hitObject in hitObjects)
        {
            if (hitObject.collider.gameObject.tag == targetTag)
            {
                CharacterStat targetStat =
                    hitObject.collider.GetComponent <CharacterStat>();

                CharacterStat.ProcessDamage(ownerStat, targetStat, damage);
                lastHit = targetStat;
            }
        }
        return(lastHit);
    }
Example #10
0
    public override void EndState()
    {
        base.EndState();
        _time = 0;

        StartCoroutine(MCSoundManager.BGMFadeIn(1f));
        StartCoroutine(MCSoundManager.AmbFadeIn(1f));
        GameStatus.SetCurrentGameState(CurrentGameState.Start);

        UserInterface.SetAllUserInterface(true);
        _manager.TimeLine2.SetActive(false);
        _manager.isCantMove    = false;
        _manager.isAttackOne   = false;
        _manager.isAttackTwo   = false;
        _manager.isAttackThree = false;
        _manager.isSkill4CTime = true;
        _manager.isSkill4      = false;
        _manager.isCantMove    = false;
        _manager.isSkill2Dash  = false;
        foreach (GameObject mob in GameStatus.Instance.ActivedMonsterList)
        {
            Debug.Log(mob.name);
            var stat = mob.GetComponent <CharacterStat>();
            if (stat.monsterType == MonsterType.Length)
            {
                float damage = _manager.Stat.dmgCoefficient[6];

                if (stat.Hp < _manager.Stat.dmgCoefficient[6])
                {
                    damage = stat.Hp - 1;
                }

                CharacterStat.ProcessDamage(_manager.Stat, stat, damage);
            }
            else
            {
                float damage = _manager.Stat.dmgCoefficient[6];
                CharacterStat.ProcessDamage(_manager.Stat, stat, damage);
            }
            CanvasInfo.Instance.enemyHP.hpBar.HitBackFun();
        }
    }
Example #11
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();
        }
    }
Example #12
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();
        }
    }
Example #13
0
    private void OnTriggerEnter(Collider other)
    {
        if (_Dameged)
        {
            return;
        }

        if (GameStatus.currentGameState == CurrentGameState.Product ||
            GameStatus.currentGameState == CurrentGameState.Dead)
        {
            return;
        }

        if (riris.CurrentState == RirisState.PATTERNA)
        {
            if (other.transform.tag == "Player")
            {
                float damage = riris.Stat.damageCoefiiecient[1] * 0.01f *
                               (riris.Stat.Str + riris.Stat.addStrPerRound * GameStatus.Instance.StageLevel)
                               - PlayerFSMManager.Instance.Stat.Defense;

                CharacterStat.ProcessDamage(riris.Stat, PlayerFSMManager.Instance.Stat, damage);
                var hitTarget = GameLib.SimpleDamageProcess(this.transform, 1f, "Player", riris.Stat, 0);
                if (!PlayerFSMManager.Instance.isDead)
                {
                    PlayerFSMManager.Instance.SetState(PlayerState.HIT2);
                }

                Invoke("AttackSupport", 0.5f);
                _Dameged = true;
            }
        }
        else if (riris.CurrentState == RirisState.PATTERNB)
        {
            if (other.transform.tag == "Player")
            {
                float damage = riris.Stat.damageCoefiiecient[2] * 0.01f *
                               (riris.Stat.Str + riris.Stat.addStrPerRound * GameStatus.Instance.StageLevel)
                               - PlayerFSMManager.Instance.Stat.Defense;

                CharacterStat.ProcessDamage(riris.Stat, PlayerFSMManager.Instance.Stat, damage);
                var hitTarget = GameLib.SimpleDamageProcess(this.transform, 1f, "Player", riris.Stat, 0);
                if (!PlayerFSMManager.Instance.isDead)
                {
                    PlayerFSMManager.Instance.SetState(PlayerState.HIT2);
                }

                Invoke("AttackSupport", 0.5f);
                _Dameged = true;
            }
        }
        else if (riris.CurrentState == RirisState.PATTERND)
        {
            if (other.transform.tag == "Player")
            {
                float damage = riris.Stat.damageCoefiiecient[3] * 0.01f *
                               (riris.Stat.Str + riris.Stat.addStrPerRound * GameStatus.Instance.StageLevel)
                               - PlayerFSMManager.Instance.Stat.Defense;

                CharacterStat.ProcessDamage(riris.Stat, PlayerFSMManager.Instance.Stat, damage);
                var hitTarget = GameLib.SimpleDamageProcess(this.transform, 1f, "Player", riris.Stat, 0);
                PlayerFSMManager.Instance.SetState(PlayerState.HIT2);

                Invoke("AttackSupport", 0.5f);
                _Dameged = true;
            }
        }

        else if (riris.CurrentState == RirisState.ULTIMATE)
        {
            if (other.transform.tag == "Player")
            {
                float damage = riris.Stat.damageCoefiiecient[4] * 0.01f *
                               (riris.Stat.Str + riris.Stat.addStrPerRound * GameStatus.Instance.StageLevel)
                               - PlayerFSMManager.Instance.Stat.Defense;

                CharacterStat.ProcessDamage(riris.Stat, PlayerFSMManager.Instance.Stat, damage);
                var hitTarget = GameLib.SimpleDamageProcess(this.transform, 1f, "Player", riris.Stat, 0);
                PlayerFSMManager.Instance.SetState(PlayerState.HIT2);

                Invoke("AttackSupport", 0.5f);
                _Dameged = true;
            }
        }
    }
    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();
        }
    }