void Awake() { instance = this; _poolingData = Newtonsoft.Json.JsonConvert.DeserializeObject <List <PoolItem> >(config.text); _pooledObjects = new Dictionary <string, List <GameObject> >(); Pool(); }
void Awake() { _poolInstance = ObjectPoolingScript.instance; for (int index = 0; index < transform.childCount; index++) { Transform child = transform.GetChild(index); if (child.name == FORWARD_SPAWN_POS) { _spawnPosForward = child.position; } else if (child.name == BACK_SPAWN_POS) { _spawnPosBack = child.position; } else if (child.name == LEFT_SPAWN_POS) { _spawnPosLeft = child.position; } else if (child.name == RIGHT_SPAWN_POS) { _spawnPosRight = child.position; } } }
public virtual void Init() { _lastFireTime = 0.0f; _pool = ObjectPoolingScript.instance; POOL_KEY = "Bullet"; _useTrajectory = false; }
// Use this for initialization void OnEnable() { pooler = FindObjectOfType <ObjectPoolingScript>(); if (!target) { target = FindObjectOfType <PlaneFlight>().gameObject; } }
// Use this for initialization void OnEnable() { mainLayer = gameObject.layer; currentHealth = maxHealth; invincible = false; damageSources = new List <GameObject>(); pooler = FindObjectOfType <ObjectPoolingScript>(); }
void Awake() { instance = this; using (StreamReader file = File.OpenText(@"Assets/Resources/data/PoolConfig.json")) { string jsonString = file.ReadToEnd(); _poolingData = Newtonsoft.Json.JsonConvert.DeserializeObject <List <PoolItem> >(jsonString); } _pooledObjects = new Dictionary <string, List <GameObject> >(); }
void Awake() { poolingScript = this; objectPool = new Dictionary <string, List <GameObject> >(); staticTurretShotList = new List <GameObject>(); for (int i = 0; i < turretShotAmount; i++) { GameObject obj = Instantiate(staticTurretShot); obj.SetActive(false); staticTurretShotList.Add(obj); } weaponMouzzleFlashList = new List <GameObject>(); for (int i = 0; i < muzzleFlashAmount; i++) { GameObject obj = Instantiate(weaponMuzzleFlash); obj.SetActive(false); weaponMouzzleFlashList.Add(obj); } alienBulletList = new List <GameObject>(); for (int i = 0; i < alienBulletAmount; i++) { GameObject obj = Instantiate(alienBullet); obj.SetActive(false); alienBulletList.Add(obj); } impactParticlesList = new List <GameObject>(); for (int i = 0; i < impactParticlesAmount; i++) { GameObject obj = Instantiate(impactParticles); obj.SetActive(false); impactParticlesList.Add(obj); } deathParticlesList = new List <GameObject>(); for (int i = 0; i < deathParticlesAmount; i++) { GameObject obj = Instantiate(deathParticles); obj.SetActive(false); deathParticlesList.Add(obj); } objectPool.Add("staticTurretShotList", staticTurretShotList); objectPool.Add("weaponMouzzleFlashList", weaponMouzzleFlashList); objectPool.Add("alienBulletList", alienBulletList); objectPool.Add("impactParticlesList", impactParticlesList); objectPool.Add("deathParticlesList", deathParticlesList); }
void Awake() { current = this; //to make sure the static class that is instantiated is this. }
public List <GameObject> pooledObjects; //the script will fill this list with the poolObject private void Awake() { current = this; }
void Awake() { current = this; }
// Start is called before the first frame update void Start() { pooler = FindObjectOfType <ObjectPoolingScript>(); }
void Awake() { SharedInstance = this; }