public override void OnUpdate()
        {
            goo = InputPath.Value as FsmPath;
            if(goo.Value == null)
            {
                Finish();
                return;
            }

            if(FsmConverter.GetPath(InputPath).vectorPath.Count == 0)
            { return; } // wait until path's ready

            var go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;
            goo = InputPath.Value as FsmPath;

            var moo = (SimpleSmoothModifier)go.AddComponent(typeof(SimpleSmoothModifier));
            goo.Value.vectorPath = moo.SmoothSimple (goo.Value.vectorPath);

            GameObject.Destroy(moo);
            Finish();
        }
 public void OnPathComplete(Path path)
 {
     doo = new FsmPath(); // this needs to be an instance even if the actual path is the same.
     doo.Value = p;
     OutputPath = doo;
     path = p;// this distinction makes it work with the previous path until the new one is finished
     currentWaypoint = 0; // new path, then it obviously has to start back at 0;
     if(noStepBack) currentWaypoint += 1;
     Update();//start Update again to avoid any problems whatsoever, especially when stopping and resuming the script.
 }
Esempio n. 3
0
        public void OnPathComplete(Path path1)
        {
            if (go == null)
            {
                Finish();
                return;
            }

            doo = new FsmPath(); // this needs to be an instance even if the actual path is the same.
            //if(path != null)
                //path.Release(path);

            path = path1;

            currentWaypoint = 1;
            if(moveMode == MoveMode.followPath)
            { currentWaypoint = 0; }// used to be getClosest() + 1;
            else if(moveMode == MoveMode.follow || moveMode == MoveMode.followTo || moveMode == MoveMode.fleeContinuously)
            { currentWaypoint = (path.vectorPath.Count >= 2 && (path.vectorPath[0]-go.transform.position).sqrMagnitude <= (path.vectorPath[1]-go.transform.position).sqrMagnitude) ? 0 : 1; }

            doo.Value = path;
            OutputPath.Value = doo;

            if (LogEvents.Value)
            {	Debug.Log(" Time needed to create path : " + (Time.time - time)); }

            pathLoading = false;
            if(exactFinish.Value)
            {	path.vectorPath.Add(target.Value == null ? targetPosition.Value : target.Value.transform.position);}

            return;
        }
Esempio n. 4
0
 public void FinishConnectionX(Path path)
 {
     path.path.InsertRange(currentWaypoint,p.path);// node path, necessary if you want to run modifiers on top of it lateron I think
     path.vectorPath.InsertRange(currentWaypoint,p.vectorPath);// concat lists by adding everything at the currentWaypoint index . That way nothing before this needs to be reset
     doo = new FsmPath();
     doo.Value = path;
     OutputPath.Value = doo;
     return;
 }