// Use this for initialization void Start() { GM = GameObject.Find("GameManager").GetComponent <scr_GameManager>(); BM = GameObject.FindGameObjectWithTag("bag").GetComponent <scr_bagMovement>(); ISM = GM.GetComponent <scr_IngameSoundManager>(); pooler = GameObject.FindGameObjectWithTag("pooler").GetComponent <scr_obp>(); FH = GM.GetComponent <scr_FileHandler>(); PE = GM.GetComponent <scr_PotionEffects>(); collectedParticles = 0; m_particle_1_score = GM.GetParticleScore(0); m_particle_2_score = GM.GetParticleScore(1); m_particle_3_score = GM.GetParticleScore(2); //The actual amount of particles; maxParticles = GM.GetMaxWinParticles() * GM.GetMaxBagAmount(); maxScore = maxParticles * (int)m_particle_2_score; //Håkans particle systems for when particles enters the glassjar emitPosition1 = transform.GetChild(0); PS1 = emitPosition1.GetComponent <ParticleSystem>(); PS1.Stop(); emitPosition2 = transform.GetChild(1); PS2 = emitPosition2.GetComponent <ParticleSystem>(); PS2.Stop(); emitPosition3 = transform.GetChild(2); PS3 = emitPosition3.GetComponent <ParticleSystem>(); PS3.Stop(); //End Håkans potions }
void Awake () { BM = this.GetComponent<scr_bagMovement>(); m_frameCounter = 1; GM = GameObject.Find("GameManager").GetComponent<scr_GameManager>(); ISM = GM.GetComponent<scr_IngameSoundManager>(); particleAmount = GM.GetMaxWinParticles(); objectPooler = GameObject.FindGameObjectWithTag("pooler").GetComponent<scr_obp>(); m_exploding = false; }
public void ExplodeBag() { ISM.PlayBagBreak(); // int maxWinAmount = GM.GetMaxWinParticles() * BM.GetRemainingBounces() / BM.GetMaxBounces(); int index = BM.GetMaxBounces() - BM.GetRemainingBounces(); int maxWinAmount = GM.GetMaxWinParticles(); for(int i = 0; i < index; i++) { maxWinAmount -= l_ParticlesPerBounce[i]; } int loopAmount = maxWinAmount / bagExplosionFrameAmount; SpawnParticlesAroundBag(loopAmount); if (m_frameCounter == bagExplosionFrameAmount) { BM.DestroyBag(); } m_frameCounter += 1; }