private void Awake() { ObjectPoolSingleton.Instance.RegisterComPool <ZombieController>(Resources.Load <GameObject>("Prefabs/Zombie/One")); zombiePool = ObjectPoolSingleton.Instance.GetPool <ZombieController>(); FacadeSingleton.Instance.RegisterEvent("RefreshZombieSpawner", CheckIfCanSpwan); FacadeSingleton.Instance.RegisterEvent("RefreshZombie", ClearDeadZombie); }
void AddConstructionIcon() { ISubPool remindPool = ObjectPoolSingleton.Instance.GetPool <ConstructionIcon>(); FloatingIcon icon = remindPool.Take() as FloatingIcon; GameObject go = icon.gameObject; go.transform.parent = floatingIconTrans.transform; go.transform.localPosition = Vector3.zero; }
public void ReleaseComPool <UnitType>() where UnitType : Component, IPoolUnit { var type = typeof(UnitType); if (!mSubPoolMap.ContainsKey(type)) { print(string.Format("Type{0} has not been registered", type.Name)); return; } ISubPool subPool = mSubPoolMap[type]; subPool.Release(); }
GameObject CreateHudInstance(HudInfo info, Vector3 pos, Quaternion quat) { ISubPool pool = null; if (info.type == HudType.Collect) { pool = ObjectPoolSingleton.Instance.GetPool <HudCollect>(); HudCollect hud = pool.Take(pos, quat, uirootTrans) as HudCollect; return(hud.gameObject); } else if (info.type == HudType.CountDown) { pool = ObjectPoolSingleton.Instance.GetPool <HudCountDown>(); HudCountDown hud = pool.Take(pos, quat, uirootTrans) as HudCountDown; if (info.args != null) { hud.SetTimer(info.args.Value <long>("finishtime")); } return(hud.gameObject); } else if (info.type == HudType.NameBoard) { pool = ObjectPoolSingleton.Instance.GetPool <HudNameBoard>(); HudNameBoard hud = pool.Take(pos, quat, uirootTrans) as HudNameBoard; return(hud.gameObject); } else if (info.type == HudType.ProduceBar) { pool = ObjectPoolSingleton.Instance.GetPool <HudProduceBar>(); HudProduceBar hud = pool.Take(pos, quat, uirootTrans) as HudProduceBar; return(hud.gameObject); } else if (info.type == HudType.Exmind) { pool = ObjectPoolSingleton.Instance.GetPool <HudExmind>(); HudExmind hud = pool.Take(pos, quat, uirootTrans) as HudExmind; return(hud.gameObject); } return(null); }
public void Restore() { ISubPool pool = ObjectPoolSingleton.Instance.GetPool <HudCollect>(); pool.Restore(this); }
public void Restore() { ISubPool pool = ObjectPoolSingleton.Instance.GetPool <TimerIcon>(); pool.Restore(this); }
public void Restore() { ISubPool pool = ObjectPoolSingleton.Instance.GetPool <HudProduceBar>(); pool.Restore(this); }