Exemplo n.º 1
0
 public static objectPool GetInstance()
 {
     if (instance == null)
     {
         instance = new objectPool();
     }
     return(instance);
 }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        bTime  = new WaitForSeconds(1.5f);
        bTime2 = new WaitForSeconds(3f);

        firerate  = new WaitForSeconds(0.05f);
        firerate2 = new WaitForSeconds(0.05f);

        bulletList  = bulletPool.GetComponent <objectPool>();
        bulletList2 = bulletPool2.GetComponent <objectPool>();
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        dmg         = 50;
        dmg2        = 50;
        enemy_Test  = new GameObject[3000];
        enemy2_Test = new GameObject[500];

        ally_Test    = new GameObject[1000];
        bullet_Test  = new GameObject[500];
        bullet2_Test = new GameObject[500];

        bloomPool = bloom.GetComponent <objectPool>();
    }
Exemplo n.º 4
0
        void Awake()
        {
            bubbles = FindObjectsOfType <Bubble>();
            for (int i = 0; i < BubbleTables.Length; i++)
            {
                Debug.Assert(BubbleTables[i].gameobject.TryGetComponent(out BubbleTables[i].button)
                             , $"<color=red>GameObject '{BubbleTables[i].gameobject.name}' is Wrong</color>");
            }

            m_PopulationPool = new objectPool(BubbleTables[(int)Vehicles.GUESTROOM].gameobject, 2, objectPoolParent);
            m_FoodPool       = new objectPool(BubbleTables[(int)Vehicles.CULTIVATION].gameobject, 5, objectPoolParent);
            m_LeaderShipPool = new objectPool(BubbleTables[(int)Vehicles.EDUCATION].gameobject, 2, objectPoolParent);
        }
Exemplo n.º 5
0
    private void Awake()
    {
        if (isInitalized)
        {
            return;
        }
        Debug.Assert(m_oNormalBrickPrefabs != null, "Nullreference");
        Debug.Assert(m_oBossHeartBrickPrefabs != null, "Nullreference");

        Debug.Log("1111111111111");
        brickPool    = new objectPool(m_oNormalBrickPrefabs, m_nSpawnCount, transform);
        isInitalized = true;
    }
Exemplo n.º 6
0
        private void Start()
        {
            m_GuestRoomPool    = new objectPool(GuestRoomPrefabs, 4, this.transform);
            m_CultivationPool  = new objectPool(CultivationPrefabs, 4, this.transform);
            m_EducationPool    = new objectPool(EducationPrefabs, 4, this.transform);
            m_PreservationPool = new objectPool(PreservationPrefabs, 4, this.transform);
            m_StoragePool      = new objectPool(StoragePrefabs, 4, this.transform);

            bubbles = FindObjectsOfType <InGameBubble.Bubble>();


            SpawnTrain(Vehicles.GUESTROOM, true);
            SpawnTrain(Vehicles.CULTIVATION, true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取连接池
        /// </summary>
        /// <param name="type">SQL类型</param>
        /// <param name="connection">连接字符串</param>
        /// <returns></returns>
        public static connectionPool Get(type type, string connection)
        {
            connectionPool pool;
            key            key = new key(type, connection);

            if (poolLock.TryGetValueEnter(ref key, out pool))
            {
                return(pool);
            }
            try
            {
                poolLock.SetOnly(ref key, pool = new connectionPool {
                    pool = objectPool <DbConnection> .Create()
                });
            }
            finally { poolLock.Exit(); }
            return(pool);
        }
Exemplo n.º 8
0
    private void Awake()
    {
        OnPhaseAlarm = BossAlarm;
        OnBossDeath  = BossDead;

        ballPool = new objectPool(BallPrefabs, 5);

        Prefabs   _prefabs       = Prefabs.Instance;
        Transform _bulletStorage = _prefabs.GetObject(PrefabType.BulletStorage).transform;

        Debug.Assert(_bulletStorage != null, "NullReference");

        normalBullet01  = new objectPool(_prefabs.GetObject(PrefabType.NormalBullet01), 20, _bulletStorage);
        normalBullet02  = new objectPool(_prefabs.GetObject(PrefabType.NormalBullet02), 10, _bulletStorage);
        missileBullet01 = new objectPool(_prefabs.GetObject(PrefabType.MissileBullet01), 10, _bulletStorage);

        Debug.Assert(GamePlayLine != null, "NullReference");
        Debug.Assert(CoolTimeImg != null, "NullReference");
        Debug.Assert(BallPrefabs != null, "NullReference");
    }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        if (leader)
        {
            turn = r_Speed * Time.deltaTime;
        }
        else
        {
            turn = 60 * Time.deltaTime;
        }
        //turn = 60; a very weird reaction turn speed to zero

        firerate = new WaitForSeconds(0.1f);
        //targ_timer = new WaitForSeconds(1.5f);
        bTime   = new WaitForSeconds(3f);
        chasing = false;

        StartCoroutine("cannon");
        ebulletList = EbulletPool.GetComponent <objectPool>();
        rando       = new Vector3(Random.Range(0, range), Random.Range(0, range), Random.Range(0, range));
    }
Exemplo n.º 10
0
 public void Start()
 {
     m_RebellionPool     = new objectPool(rebellionBubble.prefab, 2, parent);
     m_DemonstratePool   = new objectPool(demonstrateBubble.prefab, 2, parent);
     m_FalseReligionPool = new objectPool(falseReligionBubble.prefab, 2, parent);
 }
Exemplo n.º 11
0
 private void Awake()
 {
     sharedInstance = this;
 }
 // Use this for initialization
 void Start()
 {
     rb = GetComponent<Rigidbody2D>();
     oP = GetComponent<objectPool>();
 }
 // Use this for initialization
 void Start()
 {
     gCam = Camera.main;
     rb = GetComponent<Rigidbody2D>();
     oP = GetComponent<objectPool>();
 }
Exemplo n.º 14
0
 public void SetPool(objectPool pool) => this.pool = pool;
 // Use this for initialization
 void Start()
 {
     oP = GetComponent<objectPool>();
 }
Exemplo n.º 16
0
 public void SetPool(objectPool brickPool)
 {
     this.brickPool = brickPool;
 }
Exemplo n.º 17
0
 public MissileBulletLancher(Boss boss)
 {
     this.boss            = boss;
     this.missileBullet01 = boss.missileBullet01;
 }
Exemplo n.º 18
0
 public CircleBulletLancher(Boss boss)
 {
     this.boss           = boss;
     this.normalBullet01 = boss.normalBullet01;
 }
Exemplo n.º 19
0
 void Awake()
 {
     pool = this;
 }
Exemplo n.º 20
0
 /// <summary>
 /// 内存池
 /// </summary>
 /// <param name="size">缓冲区尺寸</param>
 public ArrayPoolPlus(int size)
 {
     pool = objectPool<byte[]>.Create();
     Size = size;
     PushHandle = Push;
     PushSubArray = Push;
 }