Ejemplo n.º 1
0
        public static BehaviourCallback NavPathTo(this Transform trans, float duration, List <Vector3> waypoints, Vector3 offset, IPathTrigger triggerHandler = null, NavPathFlipType flipType = NavPathFlipType.None, NavPathMoveType pathType = NavPathMoveType.LinePosLineDir, int subdivisions = 5, float pathLength = 0.0f)
        {
            NavPathController pathCtrl = new NavPathController();
            AbstractNavPath   navPath  = NavPathUtils.Create(pathType, offset, flipType, triggerHandler, waypoints, subdivisions, pathLength);

            pathCtrl.StartMove(navPath, navPath.PathLength / duration);
            pathCtrl.mCtlPosition = trans;
            pathCtrl.mCtlRotate   = trans;

            Callback2 <NavPathController, BehaviourCallback> callback = new Callback2 <NavPathController, BehaviourCallback>();

            callback.Arg1    = pathCtrl;
            callback.Handler = (Action <NavPathController, BehaviourCallback>)PathTo;
            BehaviourCallback beh = new BehaviourCallback(callback, callback, callback);

            callback.Arg2 = beh;
            return(beh);
        }
Ejemplo n.º 2
0
 private static void PathTo(NavPathController pathCtl, BehaviourCallback beh)
 {
     pathCtl.Update(Time.deltaTime);
 }