Exemplo n.º 1
0
    // NextAI -> state, 포지션, 타겟
    void SetNextAI(NextAI nextAI)
    {
        if (nextAI.TargetObject != null)
        {
            Target.ThrowEvent(ConstValue.ActorData_SetTarget,
                              nextAI.TargetObject);
        }

        if (nextAI.Position != Vector3.zero)
        {
            MovePosition = nextAI.Position;
        }

        switch (nextAI.StateType)         //스테이트에 대한 로테이션
        {
        case eStateType.STATE_IDLE:
            ProcessIdle();
            break;

        case eStateType.STATE_ATTACK:
        {
            if (nextAI.TargetObject != null)
            {
                SelfTransform.forward =
                    (nextAI.TargetObject.SelfTransform.position
                     - SelfTransform.position).normalized;
            }
            ProcessAttack();
        }
        break;

        case eStateType.STATE_WALK:
            ProcessMove();
            break;

        case eStateType.STATE_DEAD:
            processDie();
            break;

        case eStateType.STATE_SPECIAL:
        {
            if (nextAI.TargetObject != null)
            {
                SelfTransform.forward =
                    (nextAI.TargetObject.SelfTransform.position
                     - SelfTransform.position).normalized;
            }
            processSpecial();
        }
        break;
        }

        Target.ThrowEvent(ConstValue.EventKey_SelectState,
                          Target.GetComponent <NonPlayer>().AI.CURRENT_AI_STATE,
                          Target);
    }
Exemplo n.º 2
0
    public virtual void AddNextAI(eStateType nextStateType,
                                  BaseObject targetObject = null,
                                  Vector3 position        = new Vector3())
    {
        NextAI nextAI = new NextAI();

        nextAI.StateType    = nextStateType;
        nextAI.TargetObject = targetObject;
        nextAI.Position     = position;

        ListNextAI.Add(nextAI);
    }