void AddNuggets() { p1n += Random.Range(plusCountMin, plusCountMax); p2n += Random.Range(plusCountMin, plusCountMax); if (p1n > GlobalData.P1nuggets) { p1n = GlobalData.P1nuggets; } else { P1nuggs.GetComponent <popText> ().Pop(); } if (p2n > GlobalData.P2nuggets) { p2n = GlobalData.P2nuggets; } else { P2nuggs.GetComponent <popText> ().Pop(); } if (p1n == GlobalData.P1nuggets && p2n == GlobalData.P2nuggets) { mode = 2; progress = 1; plusCountMin = Mathf.Max(GlobalData.P1kills, GlobalData.P2kills) / plusCountScaler; plusCountMax = 3 + plusCountMin; myAS.PlayOneShot(transitionFX); myAS.volume = initialVolume; if (GlobalData.P1nuggets > GlobalData.P2nuggets) { P1nuggs.GetComponent <popText> ().popAmount = 3f; P1nuggs.GetComponent <popText> ().Pop(); } else { P2nuggs.GetComponent <popText> ().popAmount = 3f; P2nuggs.GetComponent <popText> ().Pop(); } } else { myAS.PlayOneShot(nuggetFX); } P1nuggs.GetComponent <Text> ().text = ((int)p1n).ToString(); P2nuggs.GetComponent <Text> ().text = ((int)p2n).ToString(); added = true; }
void Update() { if (mode == 1) { if (added == true) { added = false; curStep = Mathf.Lerp(startStep, minStep, getT()); Invoke("AddNuggets", curStep); P1nuggs.GetComponent <popText> ().popSpeed = Mathf.Lerp(startSpeed, maxSpeed, getT()); P2nuggs.GetComponent <popText> ().popSpeed = Mathf.Lerp(startSpeed, maxSpeed, getT()); myAS.pitch = Mathf.Lerp(startPitch, maxPitch, getT()); myAS.volume = Mathf.Lerp(initialVolume, finalVolume, getT()); progress++; } } if (mode == 2) { if (added == true) { added = false; curStep = Mathf.Lerp(startStep, minStep, getT()); Invoke("AddKills", curStep); P1kills.GetComponent <popText> ().popSpeed = Mathf.Lerp(startSpeed, maxSpeed, getT()); P2kills.GetComponent <popText> ().popSpeed = Mathf.Lerp(startSpeed, maxSpeed, getT()); myAS.pitch = Mathf.Lerp(startPitch, maxPitch, getT()); progress++; } } if (mode == 3) { mode = 4; Invoke("drop_final", 0.3f); } }