public override void BodyInit() { base.BodyInit(); //Get the custom AStarAIPath script used to communicate with AIPath and Seeker. _aStarAIPath = base.AI.Body.GetComponentInChildren <AstarAIPath>(); if (_aStarAIPath == null) { Debug.Log("You must assign the script type AstarAIPath."); } _aStarAIPath.endReachedDistance = base.AI.Motor.DefaultCloseEnoughDistance; _aStarAIPath.speed = base.AI.Motor.DefaultSpeed; _aStarAIPath.turningSpeed = base.AI.Motor.RotationSpeed; //Get the WayPoint Set from the RAIN Navigation manager instance var wpSetName = _aStarAIPath.WayPointRouteName; if (string.IsNullOrEmpty(wpSetName)) { Debug.Log("You must provide the name of the waypoint route to use."); } wpSet = NavigationManager.Instance.GetWaypointSet(wpSetName); //Instead of using the RAIN path, we'll set the property of the next waypoint NextWaypoint = 0; //Get the next waypoint from the waypoint set getNextWayPoint(); //Subscribe to arrived at target event AstarAIPath.ArrivedAtTarget += getNextWayPoint; }
public override void BodyInit() { base.BodyInit(); //Get the custom AStarAIPath script used to communicate with AIPath and Seeker. _aStarAIPath = base.AI.Body.GetComponentInChildren<AstarAIPath>(); if (_aStarAIPath == null) Debug.Log("You must assign the script type AstarAIPath."); _aStarAIPath.endReachedDistance = base.AI.Motor.DefaultCloseEnoughDistance; _aStarAIPath.speed = base.AI.Motor.DefaultSpeed; _aStarAIPath.turningSpeed = base.AI.Motor.RotationSpeed; //Get the WayPoint Set from the RAIN Navigation manager instance var wpSetName = _aStarAIPath.WayPointRouteName; if (string.IsNullOrEmpty(wpSetName)) Debug.Log("You must provide the name of the waypoint route to use."); wpSet = NavigationManager.Instance.GetWaypointSet(wpSetName); //Instead of using the RAIN path, we'll set the property of the next waypoint NextWaypoint = 0; //Get the next waypoint from the waypoint set getNextWayPoint(); //Subscribe to arrived at target event AstarAIPath.ArrivedAtTarget += getNextWayPoint; }