Esempio n. 1
0
    void JudgeAndDoAction()
    {
        if (currentTarget == null)
        {
            return;
        }
        if (isLookLeft && transform.position.x < (forceTarget != null ? forceTarget.transform.position.x : currentTarget.transform.position.x))
        {
            isLookLeft = false;
            transform.Rotate(0, 180, 0);
        }
        else if (!isLookLeft && transform.position.x > (forceTarget != null ? forceTarget.transform.position.x : currentTarget.transform.position.x))
        {
            isLookLeft = true;
            transform.Rotate(0, 180, 0);
        }

        if (pm.IsRunning())
        {
            return;                 // 패턴이 실행 중이면 기본 동작 스킵
        }
        if (state == ActorState.chase)
        {
            if (!pm.IsRunning())
            {
                MoveToPosition(currentTarget.position);
            }
        }
        else if (state == ActorState.idle)
        {
        }
    }