private IEnumerator ShowGameMenu() { uis[0].OnHide(); while (uis[0].IsInit) { yield return(null); } lastStartSpeed = startSpeed; EventStartGame?.Invoke(); curScore = 0; addMoney = 0; restoreHitPointsFromSession = 0; usingBoosterScore = false; xCombo = 0; uis[1].OnShow(); currentStatus = EnumGameStatus.Game; var audio = AudioManager.Instance; audio.StopAllMusic(); audio.PlayMusic(@"Audio/Music/", @"Curiosity", _loop: true, _volume: 0.5f); }
public void BeginGame() { currentStatus = EnumGameStatus.IN_GAME; tapBeginObject.SetActive(false); AudioManager.instance.Play("sfx_swooshing"); Bird.instance.BeginFly(); }
public void Initialize() { //Заглавный экран загрузки/прелоадер ShowPreloader(EnumPreloaders.Loading); LoadGame(); NotificationManager.Instance.ClearAllNotifications(); currentStatus = EnumGameStatus.StartApp; CreateBoomerang(); //EventSetScore?.Invoke(curScore); //EventSetSpeed?.Invoke(minSpeed); ShowUI(EnumUI.MainMenu); }
private IEnumerator ShowMainMenu() { var audio = AudioManager.Instance; audio.StopAllMusic(); audio.PlayMusic(@"Audio/Music/", @"MUS", _loop: true, _volume: 0.5f); switch (currentStatus) { case EnumGameStatus.Game: //Счетчик для рекламы var timer = 0.0f; countReturnToMainMenu++; if (countReturnToMainMenu >= ConstantsSettings.returnsToShowVideo) { timer = 1.0f; AdsManager.Instance.ShowVideo(); } ShowPreloader(EnumPreloaders.Common); yield return(null); for (int i = 1; i < uis.Length; i++) { uis[i].OnHide(); } while (uis.Any(x => x.IsInit)) { yield return(null); } //Пауза если реклама (доп время прелоадера для загрузки ролика) yield return(new WaitForSeconds(timer)); break; case EnumGameStatus.StartApp: //Заглавный экран загрузки/прелоадер ShowPreloader(EnumPreloaders.Loading); yield return(null); SocialManager.Instance.Authenticate(null); yield return(new WaitForSeconds(ConstantsSettings.mainPreloaderTimer)); break; default: //Reserved break; } currentStatus = EnumGameStatus.MainMenu; //Максимальный рекорд maxScore = Mathf.Max(curScore, maxScore); SetScore(maxScore); //Рейтинг SocialManager.Instance.SendLeaderboardScore(maxScore); EventShowMainMenu?.Invoke(); yield return(null); uis[0].OnShow(); }
public void BirdDead() { currentStatus = EnumGameStatus.GAME_OVER; gameOverText.SetActive(true); }
/// <summary> /// move current shape. /// </summary> /// <param name="theDirection">the moving direction</param> public bool MoveCurShape(EnumMoving theDirection) { if (this.Status != EnumGameStatus.Running) return false; if (EnumMoving.DirectDown == theDirection) { while (this.MoveCurShape(EnumMoving.Down)) { } return true; } if (this.CanMove(theDirection)) { m_curShape.Move(theDirection); } else if (EnumMoving.Down == theDirection) { // can not be moving down if (null != m_curShape) { DestroyCurShape(); CheckLines(); //if (null != this.NextShapeRequested) // this.NextShapeRequested(this, new EventArgs()); } if (Defeated()) { this.Status = EnumGameStatus.Defeated; RePaint(); } else CreateNextShape(); return false; } return true; }
public void Initialize() { m_Cells = new Block[Rows, Columns]; for (int i = 0; i < Rows; i++) { for (int j = 0; j < Columns; j++) { m_Cells[i, j] = new Block(j, i, EnumBlockType.Blank); if (i == 0 || i == Rows - 1 || j == 0 || j == Columns - 1) { m_Cells[i, j].Type = EnumBlockType.Wall; } } } for (int i = 2; i < Columns - 1; i++) { m_Cells[Rows - 2, i].Type = EnumBlockType.RoadBlock; } this.Size = new Size(BlockWidth * Columns, BlockHeight * Rows); this.TabStop = false; this.m_curShape = null; this.m_nextShape = null; this.Status = EnumGameStatus.Ready; this.RePaint(); CreateNextShape(); }
public void Go(object enumMoving) { EnumMoving move = (EnumMoving)enumMoving; if (move == EnumMoving.Pause) { if (this.Status == EnumGameStatus.Paused) this.Status = EnumGameStatus.Running; else if (this.Status == EnumGameStatus.Running) this.Status = EnumGameStatus.Paused; } MoveCurShape(move); }