Exemplo n.º 1
0
    protected void Update()
    {
        foreach (SSAction myaction in waitingAdd)
        {
            actions[myaction.GetInstanceID()] = myaction;
        }
        waitingAdd.Clear();

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

        foreach (int key in waitingDelete)
        {
            SSAction myaction = actions[key];
            actions.Remove(key);
            DestroyObject(myaction);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 2
0
    protected void Update()
    {
        foreach (SSAction ac in Add)
        {
            ActionList[ac.GetInstanceID()] = ac;
        }
        Add.RemoveAll(it => true);

        foreach (KeyValuePair <int, SSAction> pair in ActionList)
        {
            SSAction ac = pair.Value;
            if (ac.destroy == true)
            {
                Delete.Add(ac.GetInstanceID());
            }
            else if (ac.enable == true)
            {
                ac.Update();
            }
        }

        foreach (int key in Delete)
        {
            SSAction ac = ActionList[key];
            ActionList.Remove(key);
            DestroyObject(ac);
        }
        Delete.RemoveAll(it => true);
    }
Exemplo n.º 3
0
    protected void Update()
    {
        //将waitingAdd中的动作保存
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();

        //运行被保存的事件
        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.Update();
            }
        }

        //销毁waitingDelete中的动作
        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            Destroy(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 4
0
    private List <int> waitingDelete           = new List <int>();      // actions need to be deleted

    protected void Update()
    {
        foreach (SSAction action in waitingAdd)
        {
            actions[action.GetInstanceID()] = action;
        }
        waitingAdd.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction action = kv.Value;
            if (action.destroy)         // delete this action
            {
                waitingDelete.Add(action.GetInstanceID());
            }
            else if (action.enable)     // run this action
            {
                action.Update();
            }
        }

        foreach (int key in waitingDelete)
        {
            SSAction action = actions[key];
            actions.Remove(key);
            Destroy(action);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 5
0
    private List <int> destroyQueue            = new List <int>();                   //等待删除的动作的key

    protected void Update()
    {
        foreach (SSAction ac in actionQueue)
        {
            //存放动作
            actions[ac.GetInstanceID()] = ac;
        }
        actionQueue.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)               //判断动作是否需要销毁
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                destroyQueue.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.Update();
            }
        }

        foreach (int key in destroyQueue)            //销毁完成后的动作
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            DestroyObject(ac);
        }
        destroyQueue.Clear();
    }
Exemplo n.º 6
0
    private List <int> waitingDelete           = new List <int>();                  //等待删除的动作的key

    public void Update()
    {
        foreach (SSAction ac in waitingAdd)
        {
            actions.Add(ac.GetInstanceID(), ac);                                      //获取动作实例的ID作为key
        }
        waitingAdd.Clear();

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

        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            Object.Destroy(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 7
0
    protected void Update()
    {
        if (Director.getInstance().CurrentSceneController.getGameStatus() != "running")
        {
            actions.Clear();
        }

        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.gameobject.active == false || ac.destroy)            //gameobject的active是false就不更新action了
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.Update();
            }
        }
        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key]; actions.Remove(key); DestroyObject(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 8
0
    private List <int> waitingDelete           = new List <int>();                  //等待删除的动作的key

    protected void Update()
    {
        //把等待去执行的动作列表放入字典集合里
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        //清空动作列表
        waitingAdd.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                //运动学运动更新
                ac.Update();
            }
        }

        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            DestroyObject(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 9
0
 protected void Update()
 {
     //将等待增加的动作列表的动作添加到动作列表中
     foreach (SSAction ac in waitingAdd)
     {
         actions[ac.GetInstanceID()] = ac;
     }
     waitingAdd.Clear();
     //向待删除列表添加待删除的动作序号
     foreach (KeyValuePair <int, SSAction> kv in actions)
     {
         SSAction ac = kv.Value;
         if (ac.destroy)
         {
             waitingDelete.Add(ac.GetInstanceID());
         }
         else if (ac.enable)
         {
             ac.Update();
         }
     }
     //删除待删除的动作
     foreach (int key in waitingDelete)
     {
         SSAction ac = actions[key];
         actions.Remove(key);
         DestroyObject(ac);
     }
     waitingDelete.Clear();
 }
    protected void FixedUpdate()
    {
        foreach (SSAction a in waitingAdd)
        {
            actions[a.GetInstanceID()] = a;
        }
        waitingAdd.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction a = kv.Value;
            if (a.destroy)
            {
                waitingDelete.Add(a.GetInstanceID());
            }
            else if (a.enable)
            {
                a.FixedUpdate();
            }
        }

        foreach (int key in waitingDelete)
        {
            SSAction a = actions[key];
            actions.Remove(key);
            DestroyObject(a);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 11
0
    // Update is called once per frame
    protected void Update()
    {
        //把等待队列里所有的动作注册到动作管理器里
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();

        //管理所有的动作,如果动作被标志为删除,则把它加入删除队列,被标志为激活,则调用其对应的Update函数
        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.Update();
            }
        }

        //把删除队列里所有的动作删除
        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            DestroyObject(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 12
0
    protected void Update()
    {
        foreach (SSAction action in actionToRun)
        {
            actionsRunning[action.GetInstanceID()] = action;
        }
        actionToRun.Clear();

        foreach (KeyValuePair <int, SSAction> actionKV in actionsRunning)
        {
            SSAction action = actionKV.Value;
            if (action.enable)
            {
                action.Update();
                action.FixedUpdate();
            }
            else
            {
                actionToDel.Add(action.GetInstanceID());
            }
        }

        foreach (int key in actionToDel)
        {
            SSAction action = actionsRunning[key];
            actionsRunning.Remove(key);
            Object.Destroy(action);
        }
        actionToDel.Clear();
    }
Exemplo n.º 13
0
    protected void FixedUpdate()
    {
        foreach (SSAction ac in watingAddAction)
        {
            dictionary[ac.GetInstanceID()] = ac;
        }
        watingAddAction.Clear();


        foreach (KeyValuePair <int, SSAction> dic in dictionary)
        {
            SSAction ac = dic.Value;
            if (ac.destroy)
            {
                watingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.FixedUpdate();
            }
        }


        foreach (int id in watingDelete)
        {
            SSAction ac = dictionary[id];
            dictionary.Remove(id);
            DestroyObject(ac);
        }
        watingDelete.Clear();
    }
Exemplo n.º 14
0
    // Update is called once per frame
    protected void Update()
    {
        //Debug.Log("ssactionmanager update");
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();
        //Debug.Log(actions.Count);
        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                //Debug.Log("ssactionmanager update");
                ac.Update();
            }
        }

        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            Destroy(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 15
0
    private List <int> waitingDelete           = new List <int>();                  //等待删除动作的key的列表

    protected void Update()
    {
        //获取动作实例将等待执行的动作加入字典并清空待执行列表
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();

        //对于字典中每一个pair,看是执行还是删除
        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.Update();
            }
        }

        //删除所有已完成的动作并清空待删除列表
        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            Object.Destroy(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 16
0
    protected void FixedUpdate()
    {
        controller = Director.getInstance().currentSceneController as Controller;

        foreach (SSAction action in waitingForAdd)
        {
            actions[action.GetInstanceID()] = action;
        }

        waitingForAdd.Clear();

        foreach (KeyValuePair <int, SSAction> pair in actions)
        {
            SSAction action = pair.Value;
            if (action.destroy)
            {
                waitingForDelete.Add(action.GetInstanceID());
            }
            else if (action.enable)
            {
                action.FixedUpdate();
            }
        }

        foreach (int key in waitingForDelete)
        {
            SSAction action = actions[key];
            actions.Remove(key);
            Destroy(action);
        }

        waitingForDelete.Clear();
    }
Exemplo n.º 17
0
    protected void FixedUpdate()
    {
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                //物理运动更新
                ac.FixedUpdate();
            }
        }

        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            Destroy(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 18
0
    //清楚所有action,


    protected void Update()
    {
        if (roundCtrl.status == "暂停")         //停止更新action
        {
            return;
        }
        foreach (SSAction ac in waitingAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingAdd.Clear();

        foreach (KeyValuePair <int, SSAction> kv in actions)
        {
            SSAction ac = kv.Value;
            if (ac.gameobject.active == false || ac.destroy)
            {
                waitingDelete.Add(ac.GetInstanceID());
            }
            else if (ac.enable)
            {
                ac.Update();
            }
        }

        foreach (int key in waitingDelete)
        {
            SSAction ac = actions[key]; actions.Remove(key); DestroyObject(ac);
        }
        waitingDelete.Clear();
    }
Exemplo n.º 19
0
    protected void Update()
    {
        foreach (SSAction ac in waitingToAdd)
        {
            actions[ac.GetInstanceID()] = ac;
        }
        waitingToAdd.Clear();

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

        foreach (int key in watingToDelete)
        {
            SSAction ac = actions[key];
            actions.Remove(key);
            DestroyObject(ac);
        }
        watingToDelete.Clear();
    }
Exemplo n.º 20
0
 public void freeSSAction(SSAction action)
 {
     foreach (SSAction a in used)
     {
         if (a.GetInstanceID() == action.GetInstanceID())
         {
             a.reset();
             free.Add(a);
             used.Remove(a);
             break;
         }
     }
 }
Exemplo n.º 21
0
    public SSAction GetSSAction()
    {
        SSAction action = null;

        if (free.Count > 0)
        {
            action = free[0];
            free.Remove(free[0]);
        }
        else
        {
            action = ScriptableObject.Instantiate <CCFlyAction>(FlyAction);
        }
        used.Add(action.GetInstanceID(), action);
        return(action);
    }
Exemplo n.º 22
0
    protected void Update()

    {
        if (sceneController.moveMode == FirstSceneController.MoveMode.CCMove)
        {
            if (sceneController.isPaused == false && sceneController.isStarted == true)
            {
                foreach (SSAction ac in waitingAdd)
                {
                    actions[ac.GetInstanceID()] = ac;
                }

                waitingAdd.Clear();



                foreach (KeyValuePair <int, SSAction> kv in actions)
                {
                    SSAction ac = kv.Value;

                    if (ac.destroy)
                    {
                        waitingDelete.Add(ac.GetInstanceID());
                    }
                    else if (ac.enable)
                    {
                        ac.Update();
                    }
                }



                foreach (int key in waitingDelete)
                {
                    SSAction ac = actions[key];

                    actions.Remove(key);

                    DestroyObject(ac);

                    sceneController.diskComp++;
                }

                waitingDelete.Clear();
            }
        }
    }
Exemplo n.º 23
0
 public void FreeSSAction(SSAction wait)
 {
     SSAction action = null;
     foreach(SSAction ac in used)
     {
         if (wait.GetInstanceID() == ac.GetInstanceID())
         {
             action = ac;
         }
     }
     if (action!=null)
     {
         action.Reset();
         free.Add(action);
         used.Remove(action);
     }
 }
Exemplo n.º 24
0
    public void FreeSSAction(SSAction action)
    {
        SSAction temp = null;
        int      id   = action.GetInstanceID();

        if (used.ContainsKey(id))
        {
            temp = used[id];
        }

        if (temp != null)
        {
            temp.reset();
            free.Add(temp);
            used.Remove(id);
        }
    }
Exemplo n.º 25
0
    public void FreeSSAction(SSAction action)
    {
        SSAction obj = null;
        int      key = action.GetInstanceID();

        if (beUsed.ContainsKey(key))
        {
            obj = beUsed[key];
        }

        if (obj != null)
        {
            obj.reset();
            free.Add(obj);
            beUsed.Remove(key);
        }
    }
Exemplo n.º 26
0
    public void FreeSSAction(SSAction action)
    {
        SSAction tmp = null;
        int      key = action.GetInstanceID();

        if (used.ContainsKey(key))
        {
            tmp = used[key];
        }

        if (tmp != null)
        {
            tmp.reset();
            free.Add(tmp);
            used.Remove(key);
        }
    }
Exemplo n.º 27
0
    public void FreeSSAction(SSAction action)
    {
        SSAction tmp = null;

        foreach (SSAction i in used)
        {
            if (action.GetInstanceID() == i.GetInstanceID())
            {
                tmp = i;
            }
        }
        if (tmp != null)
        {
            //tmp.reset();
            free.Add(tmp);
            used.Remove(tmp);
        }
    }
Exemplo n.º 28
0
    public void FreeSSAction(SSAction act)
    {
        SSAction tmp = null;

        foreach (var item in UsedDisk)
        {
            if (act.GetInstanceID() == item.GetInstanceID())
            {
                tmp = item;
            }
        }
        if (tmp != null)
        {
            tmp.Reset();
            NewDisk.Add(tmp);
            UsedDisk.Remove(tmp);
        }
    }
Exemplo n.º 29
0
    public void FreeSSAction(SSAction action)       //回收used中的动作,重新放入free
    {
        SSAction temp = null;

        foreach (SSAction i in used)
        {
            if (i.gameobject.GetInstanceID() == action.GetInstanceID())
            {
                temp = i;
            }
        }
        if (temp != null)
        {
            temp.reset();
            free.Add(temp);
            used.Remove(temp);
        }
    }
Exemplo n.º 30
0
    public void releaseSSACtion(SSAction action)
    {
        SSAction ssa = null;

        foreach (SSAction i in used)
        {
            if (action.GetInstanceID() == i.GetInstanceID())
            {
                ssa = i;
            }
        }

        if (ssa != null)
        {
            ssa.reset();
            unused.Add(ssa);
            used.Remove(ssa);
        }
    }