示例#1
0
        void CreateEffect(GameObject prefab, LVector2 pos)
        {
            var go = GameObject.Instantiate(prefab, transform.position + pos.ToVector3(),
                                            Quaternion.identity);
            var comp = go.GetComponent <RollbackableRes>();

            if (comp != null)
            {
                if (tail == null)
                {
                    head = tail = comp;
                }
                else
                {
                    comp.pre  = tail;
                    tail.next = comp;
                    tail      = comp;
                }

                comp.DoStart(CurTick);
            }
        }
示例#2
0
        public override void Backup(int tick)
        {
            var node = head;
            var temp = node;

            while (node != null)
            {
                temp = node;
                node = node.next;
                if (temp.IsLive(tick))
                {
                    temp.DoUpdate(tick);
                }
                else
                {
                    if (head == temp)
                    {
                        head = temp.next;
                    }

                    if (tail == temp)
                    {
                        tail = temp.pre;
                    }

                    if (temp.pre != null)
                    {
                        temp.pre.next = temp.next;
                    }

                    if (temp.next != null)
                    {
                        temp.next.pre = temp.pre;
                    }

                    Destroy(temp);
                }
            }
        }
示例#3
0
 void Destroy(RollbackableRes node)
 {
     GameObject.Destroy(node.gameObject);
 }