Пример #1
0
 private void Awake()
 {
     PathCtl = new FixedPathController();
     PathCtl.mCtlPosition    = transform;
     PathCtl.mCtlRotate      = transform;
     PathCtl.mTriggerHandler = this;
     PathCtl.EnableMove(false);
     StartMove();
 }
Пример #2
0
        public static BehaviourTimeCallback PathTo(this Transform trans, float duration, List <Vector3> waypoints, NavPathType pathType = NavPathType.LinePosLineDir, int subdivisions = 5)
        {
            FixedPathController pathCtrl = new FixedPathController();
            AbstractNavPath     navPath  = NavPathUtils.Create(pathType, Vector3.zero, false, null, waypoints, subdivisions);

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

            Callback <FixedPathController, BehaviourTimeCallback> callback = new Callback <FixedPathController, BehaviourTimeCallback>();

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

            callback.Arg2 = beh;
            return(beh);
        }
Пример #3
0
 private static void PathTo(FixedPathController pathCtl, BehaviourTimeCallback beh)
 {
     pathCtl.Update(Time.deltaTime);
 }