Exemplo n.º 1
0
        protected void Update()
        {
            foreach (ObjAction ac in waitingToAdd)
            {
                actions[ac.GetInstanceID()] = ac;
            }
            waitingToAdd.Clear();

            foreach (KeyValuePair <int, ObjAction> kv in actions)
            {
                ObjAction ac = kv.Value;
                if (ac.destroy)
                {
                    watingToDelete.Add(ac.GetInstanceID());
                }
                else if (ac.enable)
                {
                    ac.Update();
                }
            }

            foreach (int key in watingToDelete)
            {
                ObjAction ac = actions[key];
                actions.Remove(key);
                DestroyObject(ac);
            }
            watingToDelete.Clear();
        }
Exemplo n.º 2
0
 public void addAction(GameObject gameObject, ObjAction action, ActionCallback whoToNotify)
 {
     action.gameObject  = gameObject;
     action.transform   = gameObject.transform;
     action.whoToNotify = whoToNotify;
     waitingToAdd.Add(action);
     action.Start();
 }
Exemplo n.º 3
0
 public void actionDone(ObjAction source)
 {
     source.destroy = false;
     this.currentActionIndex++;
     if (this.currentActionIndex >= sequence.Count)
     {
         this.currentActionIndex = 0;
         if (repeat > 0)
         {
             repeat--;
         }
         if (repeat == 0)
         {
             this.destroy = true;
             this.whoToNotify.actionDone(this);
         }
     }
 }
        public void moveCharacter(MyCharactorController characterCtrl, Vector3 destination)
        {
            Vector3 currentPos = characterCtrl.getPos();
            Vector3 middlePos  = currentPos;

            if (destination.y > currentPos.y)                           //from low(boat) to high(coast)
            {
                middlePos.y = destination.y;
            }
            else                        //from high(coast) to low(boat)
            {
                middlePos.x = destination.x;
            }
            ObjAction action1   = MoveToAction.getAction(middlePos, characterCtrl.movingSpeed);
            ObjAction action2   = MoveToAction.getAction(destination, characterCtrl.movingSpeed);
            ObjAction seqAction = SequenceAction.getAction(1, 0, new List <ObjAction> {
                action1, action2
            });

            this.addAction(characterCtrl.getGameobj(), seqAction, this);
        }
Exemplo n.º 5
0
 public void actionDone(ObjAction source)
 {
 }