예제 #1
0
    // --------------------------------------------------------------------

    private void GoToNextPoint()
    {
        ++mCurrentPointIndex;
        if (mCurrentPointIndex >= PatrollingPoints.Count)
        {
            mCurrentPointIndex = 0;
        }

        mCurrentPoint             = PatrollingPoints[mCurrentPointIndex];
        mNavMeshAgent.destination = mCurrentPoint.Point.position;
    }
예제 #2
0
    // --------------------------------------------------------------------

    void Start()
    {
        Assert.IsTrue(PatrollingPoints.Count > 1, "The soldier doesn't have enough patrolling points");

        mAnimator     = GetComponent <Animator>();
        mNavMeshAgent = GetComponent <NavMeshAgent>();

        mCurrentPoint      = PatrollingPoints[0];
        mCurrentPointIndex = 0;

        transform.position = PatrollingPoints[0].Point.position;
        GoToNextPoint();
    }