public void NewHighscore() { updating = true; DisableScripts(); Time.timeScale = 0; UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.NewHighscore); }
public void HighscorePanelYES() { SoundManager.PlaySoundEffect(SoundManager.SoundEffect.ButtonClick); nameKey = Nameinput.text; if (Nameinput.text == "") { nameKey = "Test"; } updating = false; scoreKey = (int)(ScoreManager.CurrentScore); TextManager.Write(nameKey, scoreKey); UIPanelManager.DisableUIPanel(UIPanelManager.UIPanel.NewHighscore); UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.GameOver); }
private void Dead() { //When Health drops below 50, start our smoke effect here //If Smoke effect is null, shows that this is the first time it has started if (health <= 50 && SmokeEffect == null) { SmokeEffect = VFXController.current.SpawnVFX(transform.position, Quaternion.identity, VFXController.VFX_TYPE.SMOKE_TYPE1); } //Else check if it is still active else if (health <= 50 && !SmokeEffect.activeInHierarchy) { SmokeEffect = VFXController.current.SpawnVFX(transform.position, Quaternion.identity, VFXController.VFX_TYPE.SMOKE_TYPE1); } //If enemy has 0 health, active will be set to false if (health == 0) { //Creating Explosion Effect VFXController.current.SpawnVFX(transform.position, Quaternion.identity, VFXController.VFX_TYPE.DEBRIS); VFXController.current.SpawnVFX(transform.position, Quaternion.identity, VFXController.VFX_TYPE.EXPLOSION_TYPE1); VFXController.current.SpawnVFX(transform.position, Quaternion.identity, VFXController.VFX_TYPE.EXPLOSIONSPARK_TYPE1); //Stop smoke effect if it is active if (SmokeEffect.activeInHierarchy) { SmokeEffect.SetActive(false); } ScoreManager.AddCurrentScore(ScoreManager.ScoreType.BossKill); //Disable the animations anim.enabled = false; aiming.SetActive(false); //Deactivate object gameObject.SetActive(false); if (shown == false) { if (ScoreManager.CurrentScore >= TextManager.Score[TextManager.Score.Count - 1]) { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.NewHighscore); shown = true; } else { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.GameOver); } } } }
// Update is called once per frame private void Update() { if (Countdown == false) { //Timer will countdown using delta time TimerCountUp += Time.deltaTime; //Timer countdown is converted to string with 1 d.p text.text = TimerCountUp.ToString("F1"); } else { //Timer will countdown using delta time CountingDownFrom -= Time.deltaTime; //Timer countdown is converted to string with 1 d.p text.text = CountingDownFrom.ToString("F1"); if (CountingDownFrom <= 0) { CountingDownFrom = 0; if (shown == false) { if (Wave == true) { if (ScoreManager.CurrentScore >= TextManager.Score[TextManager.Score.Count - 1]) { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.NewHighscore); shown = true; } else { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.GameOver); shown = true; } } else { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.GameOver); shown = true; } } text.text = CountingDownFrom.ToString("F1"); } } }
// Update is called once per frame private void Update() { fireTimer += Time.deltaTime; int ret; if (ammosystem.bullet == 0) { Debug.Log("Reloading"); if (reloadtimetracker == 0) { SoundManager.PlaySoundEffect(SoundManager.SoundEffect.Reload); } reloadtimetracker += Time.deltaTime; if (reloadtimetracker >= ReloadTime) { Debug.Log("Reloaded"); ammosystem.Reload(); reloadtimetracker = 0; } } //If wiimote is assigned if (wiimote != null) { //Read Data do { ret = wiimote.ReadWiimoteData(); } while (ret > 0); if (wiimote.Button.a) { if (ammosystem.bullet != 0) { if (fireTimer >= FireRate && overheat.overHeated == false) { if (player.IsAlive) { Fire(); //Update the Ammo Bar ammosystem.AmmoUpdateUI(); } } } } else if (wiimote.Button.home) { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.ReturnToMainMenu); } else { //Decrease the heating guage every 0.5 second overheat.CoolDownHeating(); //Decreasing bullet spread over time currentBulletSpread -= Time.deltaTime * SpreadIncreaseRate; if (currentBulletSpread <= defaultBulletSpread) { currentBulletSpread = defaultBulletSpread; } } } //Fall back on Mouse Input else { //If Left Click if (Input.GetMouseButton(0)) { if (ammosystem.bullet != 0) { if (fireTimer >= FireRate && overheat.overHeated == false) { if (player.IsAlive) { Fire(); //Update the Ammo Bar ammosystem.AmmoUpdateUI(); } } } } else if (Input.GetKeyDown(KeyCode.Escape)) { // Show the going back to main menu panel UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.ReturnToMainMenu); } else { //Decrease the heating guage every 0.5 second overheat.CoolDownHeating(); //Decreasing bullet spread over time currentBulletSpread -= Time.deltaTime * SpreadIncreaseRate; if (currentBulletSpread <= defaultBulletSpread) { currentBulletSpread = defaultBulletSpread; } } } overheat.CoolDownWhileShooting(); //Wiimote detected and connected if (wiimote != null) { //Setting final position to IR's detected position float[] pointer = wiimote.Ir.GetPointingPosition(); //Mapping the position to screen PointerPosition.x = pointer[0] * Screen.width; PointerPosition.y = pointer[1] * Screen.height; } else { PointerPosition = Input.mousePosition; } Crosshair.transform.position = PointerPosition; if (player.Health <= 0) { UIPanelManager.ShowUIPanel(UIPanelManager.UIPanel.GameOver); } }