Esempio n. 1
0
 private void Clear()
 {
     if (this.seeker != null && !this.seeker.IsDone())
     {
         this.seeker.ReleaseClaimedPath();
     }
     if (this.path != null)
     {
         this.path.Release(this, false);
     }
     this.path         = null;
     this.inProcess    = false;
     this.curQueueItem = null;
     this.moveQueue.Clear();
 }
Esempio n. 2
0
 private void LateUpdate()
 {
     if (this.moveQueue.Count > 0 && !this.inProcess && this.canMove)
     {
         this.inProcess    = true;
         this.curQueueItem = this.moveQueue[0];
         this.moveQueue.RemoveAt(0);
         float num = Vector3.Distance(this._self.transform.position, this.curQueueItem.target);
         if (num < 0.5f)
         {
             this.curQueueItem.callback();
         }
         else
         {
             this.WalkTo(this.curQueueItem.target, this.curQueueItem.radius, this.curQueueItem.walkType, this.curQueueItem.callback, true);
         }
     }
 }
Esempio n. 3
0
 public void MoveEnqueue(Vector3 position, int type, int walkType = 0, float radius = 0.1f, Move.PathFinished callback = null, string module = "", string func = "", params object[] param)
 {
     if (this._self == null)
     {
         return;
     }
     if (this.moveQueue.Count >= 2)
     {
         this.speed = this.defaultSpeed * 1.5f;
     }
     else if (this.speed != this.defaultSpeed && this.defaultSpeed != 0f)
     {
         this.speed = this.defaultSpeed;
     }
     if ((float)this.moveQueue.Count >= 3f && this.inProcess)
     {
         this.moveQueue.Clear();
         this.inProcess = false;
         this.speed     = this.defaultSpeed;
     }
     if (this.inProcess && type == 1)
     {
         if (this.moveQueue.Count > 0)
         {
             Move.QueueItem queueItem = this.moveQueue[this.moveQueue.Count - 1];
             if (queueItem.action == Move.TargetAction.Skill)
             {
                 if (Vector3.Distance(queueItem.target, position) < 0.5f)
                 {
                     return;
                 }
             }
             else if (queueItem.action == Move.TargetAction.Move)
             {
                 walkType = queueItem.walkType;
                 this.moveQueue.RemoveAt(this.moveQueue.Count - 1);
                 this.inProcess = false;
             }
         }
         else if (this.curQueueItem != null)
         {
             if (this.curQueueItem.action == Move.TargetAction.Skill)
             {
                 if (Vector3.Distance(this.curQueueItem.target, position) < 0.5f)
                 {
                     return;
                 }
             }
             else if (this.curQueueItem.action == Move.TargetAction.Move && this.curQueueItem.walkType != 1)
             {
                 this.inProcess = false;
             }
         }
     }
     this.moveQueue.Add(new Move.QueueItem(walkType, radius, position, (Move.TargetAction)type, delegate
     {
         this.inProcess = false;
         if (!string.IsNullOrEmpty(module) && !string.IsNullOrEmpty(func))
         {
             Util.CallMethod(module, func, param);
         }
         else if (callback != null)
         {
             callback();
         }
     }));
 }