// 巡回 void Patrol() { //Debug.Log("Patrol"); visionCone.SetViewAngle(patrolViewAngle); visionCone.SetViewDistance(patrolViewDistance, true); // Nowhere to go. if (waypoints.Count == 0) { return; } // Make sure the waypoint isn't null. // Assert.AreNotEqual(null, waypoints[activeWaypoint]); if (waypoints[activeWaypoint] == null) { return; } Vector3 destination = waypoints[activeWaypoint].position; Vector3 currentPos = transform.position; MoveTowards(destination, patrolVelocity); RotateTowards(destination); }