IEnumerator Move() { Reset(true); yield return(new WaitForSeconds(delayBeforeStart)); StartCoroutine(EmitRoutine()); while (true) { //move to next point, return true if reach if (MoveToPoint(indicatorT, subPath[subWaypointID])) { subWaypointID += 1; //sub waypoint reach, get the next subwaypoint if (subWaypointID >= subPath.Count) //if reach subpath destination, get subpath for next waypoint { subWaypointID = 0; waypointID += 1; if (waypointID >= path.GetPathWPCount()) //if reach path destination, reset to starting pos { Reset(); } else //else get next subpath { subPath = path.GetWPSectionPath(waypointID); } } } yield return(null); } }
public override void FixedUpdate() { base.FixedUpdate(); if (!stunned && !dead) { if (MoveToPoint(subPath[subWaypointID])) { subWaypointID += 1; if (subWaypointID >= subPath.Count) { subWaypointID = 0; waypointID += 1; if (waypointID >= path.GetPathWPCount()) { ReachDestination(); } else { subPath = path.GetWPSectionPath(waypointID); } } } } }
public override void FixedUpdate() { base.FixedUpdate(); if (!stunned && !destroyed) { if (MoveToPoint(subPath[subWaypointID])) { subWaypointID += 1; if (subWaypointID >= subPath.Count) { subWaypointID = 0; waypointID += 1; if (waypointID >= path.GetPathWPCount()) { ReachDestination(); } else { SetSubPath(path.GetWPSectionPath(waypointID)); } } } /* * if(!path.IsLinearPath()){ * if(MoveToPoint(subPath[subWaypointID])){ * subWaypointID+=1; * if(subWaypointID>=subPath.Count){ * subWaypointID=0; * waypointID+=1; * if(waypointID>=path.GetPathWPCount()){ * ReachDestination(); * } * else{ * subPath=path.GetWPSectionPath(waypointID); * } * } * } * } * else{ * if(MoveToPoint(path.GetWaypointPos(waypointID))){//path.wpList[waypointID].position)){ * waypointID+=1; * //~ if(waypointID>=path.wpList.Count){ * if(path.ReachEndOfPath(waypointID)){ * ReachDestination(); * } * } * } */ } }
public override void FixedUpdate() { base.FixedUpdate(); if (!stunned && !dead) { if (MoveToPoint(waypointList[waypointID])) { waypointID += 1; if (waypointID >= path.GetPathWPCount()) { ReachDestination(); } } } }
public override void FixedUpdate() { base.FixedUpdate(); if (!stunned && !destroyed) { if (!path.IsLinearPath()) { if (MoveToPoint(subPath[subWaypointID])) { subWaypointID += 1; if (subWaypointID >= subPath.Count) { subWaypointID = 0; waypointID += 1; if (waypointID >= path.GetPathWPCount()) { ReachDestination(); } else { subPath = path.GetWPSectionPath(waypointID); } } } } else { if (MoveToPoint(path.wpList[waypointID].position)) { waypointID += 1; if (waypointID >= path.wpList.Count) { ReachDestination(); } } } } }
IEnumerator Move() { Reset(true); yield return(new WaitForSeconds(delayBeforeStart)); StartCoroutine(EmitRoutine()); while (true) { //move to next point, return true if reach if (MoveToPoint(indicatorT, waypointList[waypointID])) { waypointID += 1; if (waypointID >= path.GetPathWPCount()) //if reach path destination, reset to starting pos { Reset(); } } yield return(null); } }