private void Start() { startedPattern1 = false; startedPattern2 = false; startedPattern3 = false; mageBill = GameObject.Find("MageBill"); doc = GameObject.Find("_Manager").GetComponent <PausedTime>(); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Boundary" || other.tag == "Enemy") { return; } if (explosion == null) { Instantiate(explosion, transform.position, transform.rotation); } if (other.tag == "Tiro") { Instantiate(fireWxplosion, other.transform.position, transform.rotation); other.gameObject.SetActive(false); enemyLife -= Atirador.Damage; ManagerS.pontuacao += Random.Range(100, 1000); if (enemyLife <= 0) { for (float i = 0; i < manaAmount; i++) { //angulos = Random.Range (0, 360); //float aux = (i / manaAmount) * angulos; //rot.eulerAngles = new Vector3 (0.0f, 0.0f, 270 + aux1); //Instantiate (manaObj, transform.position, rot); float posicaox = Random.Range(-0.5f, 0.5f); float posicaoy = Random.Range(-0.5f, 0.5f); GameObject tempPrefab = Instantiate(manaObj) as GameObject; tempPrefab.transform.position = new Vector3(transform.position.x + posicaox, transform.position.y + posicaoy, transform.position.z); } ManagerS.pontuacao += Random.Range(1000, 10000); Instantiate(explosion, transform.position, transform.rotation); atScript.mp.fillAmount += 0.03f; Destroy(gameObject); } } if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); SpawnControllerX.DestroyAllEnemies(); LifeHandler.numVidas -= 1; //Atirador.Damage -= 3; if (LifeHandler.numVidas < 1) { other.gameObject.SetActive(false); SpawnControllerX.DestroyAllEnemies(); PausedTime.PlayerDeath(); } other.transform.position = new Vector3(-1.3f, -3.5f, 0.0f); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Boundary" || other.tag == "Enemy") { return; } if (other.tag == "Player") { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); SpawnControllerX.DestroyAllEnemies(); LifeHandler.numVidas -= 1; if (LifeHandler.numVidas < 1) { Destroy(other.gameObject); PausedTime.PlayerDeath(); } other.transform.position = new Vector3(-1.3f, -3.5f, 0.0f); } }
private void Timer_Elapsed(object sender, ElapsedEventArgs e) { if (IsPaused) { PausedTime = PausedTime.Add(TimeSpan.FromMilliseconds(_timer.Interval)); if (_taskbarIcon == null) { _taskbarIcon = IoC.Get <TaskbarIcon>(); _sourceIcon = _taskbarIcon.Icon; } } else { PausedTime = new TimeSpan(); //游戏中,延迟 if (IsDelaying) { warned = false; IsDelaying = false; ResetCountDown(); } //正常运行中 else if (!IsResting) { //倒计时减1秒 Countdown = Countdown.Subtract(new TimeSpan(0, 0, 1)); CountdownPercent = Countdown.TotalSeconds / Setting.App.AlarmInterval.TotalSeconds * 100; //提前30秒警告一次 if (!warned && Countdown.TotalSeconds <= 30 && Countdown.TotalSeconds >= 20) { warned = true; ////游戏中不播放警告声音 //bool isMaximized = new OtherProgramChecker(_currentPID, true).CheckMaximized(); //if (!isMaximized) //还是加上提示,害怕突然说话过于惊悚 _eventAggregator.PublishOnUIThread(new PlayAudioEvent() { Source = @"Resources\Sounds\breakpre.mp3" }); } //判断休息 if (Countdown.TotalSeconds <= 0) { _timer.Stop(); bool isMaximized = new OtherProgramChecker(Process.GetCurrentProcess(), true).CheckMaximized(); //bool isMaximized = true; if (isMaximized && Setting.Speech.Enable) { //正在全屏,语音提示 IsDelaying = true; PlaySpeech(); } else {//没有全屏玩游戏,立即休息 IsResting = true; _lastLockScreenViewModel = IoC.Get <LockScreenViewModel>(); Execute.OnUIThread(() => { _windowManager.ShowWindow(_lastLockScreenViewModel); _lastLockScreenViewModel.Deactivated += _lastLockScreenViewModel_Deactivated; }); PlayRestingAudio(IsResting); } RestTimeCountdown = Setting.App.RestTime; _timer.Start(); } } //休息中 else { warned = false; RestTimeCountdown = RestTimeCountdown.Subtract(new TimeSpan(0, 0, 1)); RestTimeCountdownPercent = RestTimeCountdown.TotalSeconds / Setting.App.RestTime.TotalSeconds * 100; if (RestTimeCountdown.TotalSeconds <= 0) { //休息完毕 ResetCountDown(); PlayRestingAudio(IsResting); _totalPlayTime = new TimeSpan(); } } } }