// Use this for initialization void Start() { _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("Unit1", enemies[0], this.transform, 10); _objectpool.AddObjectPool("Unit2", enemies[1], this.transform, 10); _objectpool.AddObjectPool("Unit3", enemies[2], this.transform, 10); }
/// <summary> /// Setup the object pool with <see cref="ObjectPool"/> added in the inspector. This call MUST be made for the pool to work, and should only be called once per pool's life cycle. /// </summary> /// <param name="mainParent">The target transform which should be parent to spawned items.</param> /// <param name="sortInSubParents">Indicate if there should be created a subgroup for each object that is spawned</param> public void Init(Transform mainParent, bool sortInSubParents = true) { if (_objectPool == null) { _objectPool = new DictionaryObjectPool(); Transform realParent = null; foreach (ObjectPoolLookupName opln in _serilizableObject) { if (opln.SerilizableObject.Prefab == null) { Debug.LogError("Prefeb in Object target object for scriptableobject object pool " + name + " was null. Check your setup of the scriptable object."); Debug.LogError("Object pool " + name + " was not initialized correctly!"); return; } if (sortInSubParents) { realParent = new GameObject().transform; realParent.name = (string.IsNullOrEmpty(opln.Name) ? opln.SerilizableObject.name : opln.Name); realParent.parent = mainParent; } else { realParent = mainParent; } _objectPool.AddObjectPool((string.IsNullOrEmpty(opln.Name) ? opln.SerilizableObject.name : opln.Name), opln.SerilizableObject.Prefab, realParent, opln.SerilizableObject.PreallocateAmount); } } }
// Use this for initialization void Start() { Target = GameObject.FindWithTag("EnemyShootPoint"); BossShip = GameObject.FindGameObjectsWithTag("BossShip"); BossScripts = BossShip[0].GetComponent <DN_BossShip>(); _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("EnemyBullet", Bullets, ShootPoint.transform, 100); }
// Use this for initialization void Start() { _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("TurretBullet", Bullets[0], ShootPoint[0].transform, 100); _objectpool.AddObjectPool("TurretBullet", Bullets[0], ShootPoint[1].transform, 100); _objectpool.AddObjectPool("TurretBullet", Bullets[0], ShootPoint[2].transform, 100); CDSlider.GetComponent <Image>().color = new Color32(154, 242, 25, 255); }
private void ObjectPoolSetup() { objectpool = new DictionaryObjectPool(); foreach (var block in blocks) { var blockGameObject = block.gameObject; objectpool.AddObjectPool(blockGameObject.name, blockGameObject, blocksHolder, 20); } }
// public AudioSource ShootSound; // Use this for initialization void Start() { Target = GameObject.FindWithTag("EnemyShootPoint"); RandomNumber = Random.Range(0, 3); Camera = GameObject.FindGameObjectsWithTag("Camera"); transform.parent = Camera[0].transform; _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("EnemyBullet", Bullets, ShootPoint.transform, 100); }
// Use this for initialization void Start () { _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("squares", gos[0], this.transform, 100); _objectpool.AddObjectPool("spheres", gos[1], this.transform, 100); _objectpool.AddObjectPool("tires", gos[2], this.transform, 100); }
void Start() { // CREATE THE RAT POOL _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("rats", gos[0], this.transform, (int)objectPoolSize); // START BY GIVING THE PLAYER X AMOUNT OF TIME BEFORE THE FIRST WAVE // WHEN THE TIMER REACHES 0 WAVE STARTED WILL BE FALSE waveTimer -= Time.deltaTime; if (waveTimer <= 0) { waveTimer = 6f; } }
// Use this for initialization void Start() { BoolCD = 1; BlockMesh[0] = BlockAppear[0].GetComponent <MeshRenderer>(); BlockMesh[1] = BlockAppear[1].GetComponent <MeshRenderer>(); BlockMesh[2] = BlockAppear[2].GetComponent <MeshRenderer>(); BlockMesh[3] = BlockAppear[3].GetComponent <MeshRenderer>(); BlockMesh[4] = BlockAppear[4].GetComponent <MeshRenderer>(); BlockMesh[5] = BlockAppear[5].GetComponent <MeshRenderer>(); BlockMesh[6] = BlockAppear[6].GetComponent <MeshRenderer>(); BlockMesh[7] = BlockAppear[7].GetComponent <MeshRenderer>(); BlockCollider[0] = BlockAppear[0].GetComponent <BoxCollider>(); BlockCollider[1] = BlockAppear[1].GetComponent <BoxCollider>(); BlockCollider[2] = BlockAppear[2].GetComponent <BoxCollider>(); BlockCollider[3] = BlockAppear[3].GetComponent <BoxCollider>(); BlockCollider[4] = BlockAppear[4].GetComponent <BoxCollider>(); BlockCollider[5] = BlockAppear[5].GetComponent <BoxCollider>(); BlockCollider[6] = BlockAppear[6].GetComponent <BoxCollider>(); BlockCollider[7] = BlockAppear[7].GetComponent <BoxCollider>(); TriggerScript1 = Trigger1.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript2 = Trigger2.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript3 = Trigger3.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript4 = Trigger4.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript5 = Trigger5.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript6 = Trigger6.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript7 = Trigger7.GetComponent <DN_PlayerCubeBlockTrigger>(); TriggerScript8 = Trigger8.GetComponent <DN_PlayerCubeBlockTrigger>(); FinalTile1Script = FinalTile1.GetComponent <DN_YellowTiles>(); FinalTile2Script = FinalTile2.GetComponent <DN_YellowTiles>(); FinalTile3Script = FinalTile3.GetComponent <DN_YellowTiles>(); FinalTile4Script = FinalTile4.GetComponent <DN_YellowTiles>(); //GameManagerScript = GameMangerOBJ.GetComponent<DN_GameManager>(); _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[0].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[1].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[2].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[3].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[4].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[5].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[6].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[7].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[8].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[9].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[10].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[11].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[12].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[13].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[14].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[15].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[16].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[17].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[18].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[19].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[20].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[21].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[22].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[23].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[25].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[26].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[27].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[28].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[29].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[30].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[31].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[32].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[33].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[34].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[35].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[36].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[37].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[38].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[39].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[40].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[41].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[42].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[43].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[44].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[45].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[46].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[47].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[48].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[49].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[50].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[51].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[52].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[53].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[54].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[55].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[56].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[57].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[58].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[59].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[60].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[61].transform, 100); _objectpool.AddObjectPool("FireBullet", Bullets[0], ShootPoint[52].transform, 100); }
// Use this for initialization void Start() { InvokeRepeating("UpdateTarget", 0f, 0.5f); _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("EnemyBullet", bulletPrefab, firePoint.transform, 100); }
//public float ResetFireRate; // Use this for initialization void Start() { BossScripts = BossShip.GetComponent <DN_BossShip>(); _objectpool = new DictionaryObjectPool(); _objectpool.AddObjectPool("EnemyBullet", Bullets, ShootPoint.transform, 100); }