コード例 #1
0
    IEnumerator Attack()
    {
        //enter


        while (state == CharacterState.Attack)
        {
            yield return(null);

            //stay

            MoveUtil.RotateBurst(transform, attackPoint.transform);

            if (Vector3.Distance(transform.position,
                                 attackPoint.transform.position) > attackRange && RemainTime(0.7f))
            {
                SetState(CharacterState.AttackRun);
                break;
            }

            if (monsterFSM.state == CharacterState.Dead &&
                (a.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f) > 0.7)
            {
                attackPoint.SetActive(false);
                SetState(CharacterState.Idle);
                break;
            }
        }
        //exit
    }
コード例 #2
0
ファイル: MonsterFSM.cs プロジェクト: minseokyang/RPG
    IEnumerator Attack()
    {
        //enter


        while (state == CharacterState.Attack)
        {
            yield return(null);

            //stay

            MoveUtil.RotateBurst(transform, player);

            if (Vector3.Distance(transform.position, player.position) > attackRange)
            {
                SetState(CharacterState.Run);
                break;
            }
            if (playerFSM.IsDead())
            {
                SetState(CharacterState.Idle);
                break;
            }
        }
        //exit
    }
コード例 #3
0
ファイル: MonsterFSM.cs プロジェクト: minseokyang/RPG
    public void ProcessDamage(float damage)
    {
        currentHP -= (int)damage;

        if (currentHP <= 0)
        {
            SetState(CharacterState.Dead);
            currentHP = 0;
        }
        else
        {
            SetState(CharacterState.Run);
            MoveUtil.RotateBurst(transform, player);
        }
    }