Beispiel #1
0
    public virtual void AddNextAI(eAIStateType nextStateType, BaseObject targetObject = null, Vector3 position = new Vector3())
    {
        stNextAI nextAi = new stNextAI();
        nextAi.m_StateType = nextStateType;
        nextAi.m_TargetObject = targetObject;
        nextAi.m_Position = position;

        m_listNextAi.Add(nextAi);
    }
Beispiel #2
0
    void _NextAI(stNextAI nextAI)
    {
        if (nextAI.m_TargetObject != null)
            TargetComponent.ThrowEvent("SET_TARGET", nextAI.m_TargetObject);

        if (nextAI.m_Position != Vector3.zero)
            m_MovePosition = nextAI.m_Position;
        // 전처리
        switch (nextAI.m_StateType)
        {
            case eAIStateType.AI_STATE_IDLE:
                _ProcessIdle();
                break;
            case eAIStateType.AI_STATE_ATTACK:
                {
                    if(nextAI.m_TargetObject != null)
                    {
                        SelfTransform.forward = (nextAI.m_TargetObject.SelfTransform.position - SelfTransform.position).normalized;
                    }
                    _ProcessAttack();
                }
                break;
            case eAIStateType.AI_STATE_RUN:
                _ProcessRun();
                break;
            case eAIStateType.AI_STATE_DIE:
                _ProcessDie();
                break;
            default:
                break;
        }
    }