private bool ExitDemoIfNeeded() { if (!PD.isDemo) { return(false); } bool keyPress = PD.IsKeyDownOrButtonPressed() || PD.ReturnLaunchOrPauseOrNothingIsPressed() > 0; if (keyPress || --demoCountdown <= 0) { if (keyPress) { PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm); } PD.MoveOutOfDemo(); return(true); } return(false); }
private void HandleVictory() { if (PD.isDemo) { if (!PD.isTransitioning) { PD.MoveOutOfDemo(); } return; } if (gameOver) { if (isTransitioning) { return; } if (PD.gameType == PersistData.GT.Challenge && board1.IsDead()) { switch ((hud as PuzzleHUD).retryMenu.state) { case 1: isTransitioning = true; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm); PD.LowerPuzzleLevel(); PD.SaveAndPuzzleSelect(hud.GetTimeInSeconds()); break; case 2: isTransitioning = true; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm); PD.SaveAndReset(hud.GetTimeInSeconds()); break; } return; } if (PD.gameType != PersistData.GT.Arcade && !PD.isDemo) { return; } if (--endCounter > 0) { return; } if (end != null) { if (PD.isDemo) { PD.MoveOutOfDemo(); return; } bool lop = clicker.isDown() || (board1.actionDelay <= 0 && cursor1.launchOrPause()); if (lop) { board1.actionDelay = PD.KEY_DELAY; } bool isTheEnd = end.doUpdate(lop); if (isTheEnd) { isTransitioning = true; PD.DoWin(board1.GetScore(), hud.GetTimeInSeconds(), board1.IsDead()); } return; } GetGameObject(Vector3.zero, "Tharsabin", Resources.Load <Sprite>(SpritePaths.TransparentBlackCover), false, "Cover HUD"); end = gameObject.AddComponent <EndArcadeMatchOverlay>(); end.Setup(!board1.IsDead()); } if (!gameOver) { PD.totalP1RoundScore += board1.GetScore(); PD.totalP2RoundScore += board2.GetScore(); } gameOver = true; paused = true; Vector3 p1Pos, p2Pos; int winningPlayer = 0; winningPlayer = board1.IsDead() ? 2 : 1; actor1.DoReaction(CutsceneChar.Reaction.win, winningPlayer == 1); actor2.DoReaction(CutsceneChar.Reaction.win, winningPlayer == 2); if (player2Human) { p1Pos = new Vector3(-1.4f, 0.0f); p2Pos = new Vector3(1.4f, 0.0f); } else { p1Pos = Vector3.zero; p2Pos = Vector3.zero; } hud.ShowVictoryText(winningPlayer, p1Pos, p2Pos, player2Human); PD.FadeMusic(winningPlayer == 1 || player2Human ? SoundPaths.M_WinMusic : SoundPaths.M_LoseMusic); if (PD.gameType == PersistData.GT.Arcade || PD.isDemo) { endCounter = 60; } else if (PD.gameType == PersistData.GT.Challenge && winningPlayer == 2) { (hud as PuzzleHUD).DisplayGameOverRetryScreen(); } }