예제 #1
0
        /// <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;
        }
예제 #2
0
        public RFPathData CurrentPathData;                      // Current path set to modify


        public void Init()
        {
            if (CurrentPathData == null)
            {
                CurrentPathData      = ScriptableObject.CreateInstance <RFPathData>();
                CurrentPathData.name = "new_path";
            }
        }
예제 #3
0
 /// <summary>
 /// Sets the path to follow
 /// </summary>
 /// <param name="path">Path data</param>
 public void SetPath(RFPathData path)
 {
     currentPath = path.GetAllPathPoints();
     updateCurrentPath();
     currentStepInPath = 0;
 }