示例#1
0
        private void PatrolBehaviour()
        {
            Vector3 nextPosition = guardPosition;

            if (patrolPath != null)
            {
                if (AtWaypoint())
                {
                    if (timeAtWaypoint > waypointDwellTime)
                    {
                        CycleWaypoint();
                        timeAtWaypoint = 0;
                    }
                }
                nextPosition = GetCurrentWaypoint();
            }

            mover.StartMoveAction(nextPosition, patrolSpeedFraction);

            if (mover.DoneTraveling() && !patrolPath)
            {
                // assume original orientation
                transform.eulerAngles = guardRotation;
            }
        }