示例#1
0
 public void SetDefaultCurPatrolWaypoint()
 {
     curPatrolWaypoint = new PatrolWaypoint
     {
         position = transform.position,
         rotation = transform.rotation.eulerAngles,
         stayTime = 10.0f
     };
 }
示例#2
0
        public PatrolWaypoint GetNextPatrolWaypoint(bool loop = true)
        {
            if (patrolWaypoints == null)
            {
                return(curPatrolWaypoint);
            }

            int newIndex;

            if (loop)
            {
                newIndex = destinationCount % patrolWaypoints.Count;
            }
            else
            {
                newIndex = Utils.PingPong(destinationCount, patrolWaypoints.Count - 1);
            }

            destinationCount++;

            curPatrolWaypoint = patrolWaypoints[newIndex];
            return(curPatrolWaypoint);
        }