/// <summary> /// Travel a path from the start /// </summary> public void Play(RFPathData newPath = null) { CacheStartPosition(); // If a path was passed in, use that if (newPath != null) { SetPath(newPath); } // If no path is to play, but the Start Path has been set, use it else if (currentPath == null && StartPath != null) { SetPath(StartPath); } // If the current path is not null, Update the current path based on the cached start position else if (currentPath != null) { updateCurrentPath(); } else if (currentPath == null && StartPath == null) { Debug.LogError("RFPathTraveller has no path to follow!"); } currentStepInPath = 0; moveToNextStep(); isMoving = true; }
public RFPathData CurrentPathData; // Current path set to modify public void Init() { if (CurrentPathData == null) { CurrentPathData = ScriptableObject.CreateInstance <RFPathData>(); CurrentPathData.name = "new_path"; } }
/// <summary> /// Sets the path to follow /// </summary> /// <param name="path">Path data</param> public void SetPath(RFPathData path) { currentPath = path.GetAllPathPoints(); updateCurrentPath(); currentStepInPath = 0; }