Example #1
0
    protected bool CheckCanAttack()
    {
        if (m_bRangedMonster)
        {
            if (StageManager.Inst.playerTransform.position.x - this.transform.position.x > -m_monsterInfo.GetAttackDistance() && StageManager.Inst.playerTransform.position.x - this.transform.position.x < m_monsterInfo.GetAttackDistance())
            {
                if (nowState == ENEMY_STATE.ATTACK)
                {
                }
                else
                {
                    nowState = ENEMY_STATE.ATTACK;
                }
                m_monsterMove.MoveDir();
                return(true);
            }
            else if (StageManager.Inst.playerTransform.position.x - this.transform.position.x > -(m_monsterInfo.GetAttackDistance() + m_attackRanged) && StageManager.Inst.playerTransform.position.x - this.transform.position.x < (m_monsterInfo.GetAttackDistance() + m_attackRanged))
            {
                int random;
                random          = Random.Range(1, 40);
                m_bRangedAttack = true;

                if (true)
                {
                    if (nowState == ENEMY_STATE.ATTACK)
                    {
                    }
                    else
                    {
                        nowState = ENEMY_STATE.ATTACK;
                    }
                    m_monsterMove.MoveDir();
                    return(true);
                }
            }
        }
        else
        {
            if (StageManager.Inst.playerTransform.position.x - this.transform.position.x > -m_monsterInfo.GetAttackDistance() && StageManager.Inst.playerTransform.position.x - this.transform.position.x < m_monsterInfo.GetAttackDistance())
            {
                if (nowState == ENEMY_STATE.ATTACK)
                {
                }
                else
                {
                    nowState = ENEMY_STATE.ATTACK;
                }
                m_monsterMove.MoveDir();
                return(true);
            }
        }
        return(false);
    }
Example #2
0
    IEnumerator Action()
    {
        while (m_bLive)
        {
            if (m_bAppear == false)
            {
                yield return(null);
            }
            //yield return null;
            yield return(m_secondsDelay);

            if (m_monsterPosition == Monster_Position.Monster_Position_Ground)
            {
                switch (m_eState)
                {
                case MONSTER_STATE.ATTACK:
                    m_monsterMove.isMove = false;
                    if (m_animFunction.GetCurrntAnimClipName() == "idle")
                    {
                        m_monsterMove.MoveDir();
                    }
                    m_monsterAttack.m_bAttack = true;
                    m_animator.SetFloat(m_hashFSpeed, 0);
                    m_monsterMove.GetMoveParent().MoveStop();
                    //m_monsterMove.SetSpeed(0.0f);
                    break;

                case MONSTER_STATE.HIT:
                    m_monsterAttack.m_bAttack = false;
                    m_animator.SetTrigger(m_hashTHit);
                    break;

                case MONSTER_STATE.DIE:
                    m_monsterAttack.m_bAttack = false;
                    m_monsterMove.isMove      = false;

                    m_animator.SetBool(m_hashBLive, false);

                    StageManager.Inst.SetMonsterCount(m_monsterInfo.bOverKill);
                    m_bLive = false;
                    //m_animator.SetTrigger("tDie");
                    //if (m_animFunction.IsTag("knockdown"))
                    //{
                    //    StageManager.Inst.SetMonsterCount(m_monsterInfo.bOverKill);
                    //    m_bLive = false;
                    //}
                    break;

                case MONSTER_STATE.APPEAR:
                    m_monsterAttack.m_bAttack = false;

                    //m_animator.SetBool(m_hashBAppear, true);
                    break;

                case MONSTER_STATE.MOVE:
                    m_monsterAttack.m_bAttack = false;
                    if (m_animFunction.GetCurrntAnimClipName() == "idle")
                    {
                        m_animator.SetFloat(m_hashFSpeed, m_monsterInfo.speed);
                        m_monsterMove.isMove = true;
                    }
                    break;

                case MONSTER_STATE.STUN:
                    break;

                default:
                    break;
                }
            }
        }
    }