Exemple #1
0
 public void Despawn(U3DObject uobj)
 {
     if (spwanList.Contains(uobj))
     {
         U3DMod.AddChild(null, uobj.gameObject, true);
         uobj.Hide();
         spwanList.Remove(uobj);
         despawnList.Add(uobj);
     }
 }
Exemple #2
0
        public void OnDestroy(U3DObject uobj)
        {
            if (spwanList.Contains(uobj))
            {
                spwanList.Remove(uobj);
            }

            if (despawnList.Contains(uobj))
            {
                despawnList.Remove(uobj);
            }
        }
Exemple #3
0
        public U3DObject SpawnOne()
        {
            U3DObject uobj = null;

            if (despawnList.Count > 0)
            {
                spwanList.Add(despawnList[0]);
                uobj = despawnList[0];
                despawnList.Remove(uobj);
                uobj.DespawnHandler   = Despawn;
                uobj.OnDestroyHandler = OnDestroy;
            }
            else if (spwanList.Count > 0)
            {
                uobj = U3DMod.Clone <U3DObject>(spwanList[0]);
                spwanList.Add(uobj);
                uobj.DespawnHandler   = Despawn;
                uobj.OnDestroyHandler = OnDestroy;
            }
            return(uobj);
        }
Exemple #4
0
        public List <U3DObject> despawnList; //池内元素

        public U3dCache(U3DObject uobj)
        {
            spwanList   = new List <U3DObject>();
            despawnList = new List <U3DObject>();
            despawnList.Add(uobj);
        }