Esempio n. 1
0
    public virtual void init()
    {
        (attackDataPool = new ObjectPool <AttackData>(() => { return(new AttackData()); })).setEnable(CommonSetting.sceneLogicUsePool);

        (_fightDataLogicPool = new ObjectPool <UnitFightDataLogic>(() =>
        {
            UnitFightDataLogic logic = GameC.factory.createUnitFightDataLogic();
            logic.construct();
            return(logic);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        _unitPoolDic = new ObjectPool <Unit> [UnitType.size];

        for (int i = 0; i < UnitType.size; ++i)
        {
            (_unitPoolDic[i] = createUnitPool(i)).setEnable(CommonSetting.sceneLogicUsePool);
        }

        (bulletPool = new ObjectPool <Bullet>(() =>
        {
            Bullet bullet = GameC.factory.createBullet();
            bullet.construct();
            return(bullet);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        (unitEffectPool = new ObjectPool <UnitEffect>(() =>
        {
            UnitEffect effect = GameC.factory.createUnitEffect();
            effect.construct();
            return(effect);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        (rolePool = new ObjectPool <Role>(() =>
        {
            Role role = GameC.factory.createRole();
            role.construct();
            return(role);
        })).setEnable(CommonSetting.sceneLogicUsePool);

        buffDataPool.setEnable(CommonSetting.sceneLogicUsePool);
        buffIntervalActionDataPool.setEnable(CommonSetting.sceneLogicUsePool);

        //logic
        _itemDataPool = new ObjectPool <ItemData> [ItemType.size];

        for (int i = 0; i < _itemDataPool.Length; ++i)
        {
            (_itemDataPool[i] = createItemDataPool(i)).setEnable(CommonSetting.logicUsePool);
        }

        TaskTypeConfig typeConfig;

        _taskDataPool = new ObjectPool <TaskData> [QuestType.size];
        (_taskDataPool[0] = createTaskDataPool(0)).setEnable(CommonSetting.logicUsePool);

        for (int i = 0; i < _taskDataPool.Length; ++i)
        {
            if ((typeConfig = TaskTypeConfig.get(i)) != null && typeConfig.needCustomTask)
            {
                (_taskDataPool[i] = createTaskDataPool(i)).setEnable(CommonSetting.logicUsePool);
            }
        }

        petUseLogicPool.setEnable(CommonSetting.logicUsePool);
    }