Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
    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();
    }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
    public void Restore()
    {
        ISubPool pool = ObjectPoolSingleton.Instance.GetPool <HudCollect>();

        pool.Restore(this);
    }
Exemplo n.º 6
0
    public void Restore()
    {
        ISubPool pool = ObjectPoolSingleton.Instance.GetPool <TimerIcon>();

        pool.Restore(this);
    }
Exemplo n.º 7
0
    public void Restore()
    {
        ISubPool pool = ObjectPoolSingleton.Instance.GetPool <HudProduceBar>();

        pool.Restore(this);
    }