示例#1
0
    private bool HandlePause(bool mouseClick = false)
    {
        if (isTransitioning)
        {
            return(paused);
        }
        if (!paused)
        {
            if (cursor1.pause() || mouseClick)
            {
                hud.pausePresser = 1; paused = true; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Pause);
            }
            else if (cursor2.pause())
            {
                hud.pausePresser = 2; paused = true; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Pause);
            }
        }
        else
        {
            if (hud.pauseMenu == null)
            {
                return(paused);
            }
            switch (hud.pauseMenu.state)
            {
            case 1: PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm); isTransitioning = true; PD.SaveAndQuit(hud.GetTimeInSeconds()); break;

            case 2: PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm);
                isTransitioning = true;
                if (PD.gameType == PersistData.GT.Challenge)
                {
                    PD.LowerPuzzleLevel();
                    PD.SaveAndPuzzleSelect(hud.GetTimeInSeconds());
                }
                else
                {
                    PD.SaveAndMainMenu(hud.GetTimeInSeconds());
                }
                break;

            case 3: if (PD.gameType == PersistData.GT.Challenge)
                {
                    PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm);
                    isTransitioning = true;
                    PD.SaveAndReset(hud.GetTimeInSeconds());
                }
                else
                {
                    PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Unpause);
                    paused = false;
                }
                break;

            case 4: paused = false; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Unpause); break;
            }
        }
        return(paused);
    }
示例#2
0
    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();
        }
    }
示例#3
0
    protected bool HandlePause(bool mouseClick = false)
    {
        if (isTransitioning || (PD.gameType == PersistData.GT.Online && !PD.forceOnlinePause))
        {
            if (PD.gameType == PersistData.GT.Online && (cursor1.pause() || mouseClick))
            {
                pausePresses++;
                lastPausePress = Time.time;
                if (pausePresses > 3)
                {
                    PD.SaveAndMainMenu(hud.GetTimeInSeconds());
                }
            }
            return(paused);
        }
        if (!paused)
        {
            if (cursor1.pause() || mouseClick)
            {
                hud.pausePresser = 1; paused = true; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Pause);
            }
            else if (cursor2.pause())
            {
                hud.pausePresser = 2; paused = true; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Pause);
            }
        }
        else
        {
            Debug.Log("A");
            if (hud.pauseMenu == null)
            {
                Debug.Log("X"); return(paused);
            }
            Debug.Log(hud.pauseMenu.state);
            switch (hud.pauseMenu.state)
            {
            case 1: PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm); isTransitioning = true; PD.SaveAndQuit(hud.GetTimeInSeconds()); break;

            case 2: PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm);
                isTransitioning = true;
                if (PD.gameType == PersistData.GT.Challenge)
                {
                    PD.LowerPuzzleLevel();
                    PD.SaveAndPuzzleSelect(hud.GetTimeInSeconds());
                }
                else
                {
                    PD.SaveAndMainMenu(hud.GetTimeInSeconds());
                }
                break;

            case 3: if (PD.gameType == PersistData.GT.Challenge)
                {
                    PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Confirm);
                    isTransitioning = true;
                    PD.SaveAndReset(hud.GetTimeInSeconds());
                }
                else
                {
                    PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Unpause);
                    paused = false;
                }
                break;

            case 4: paused = false; PD.sounds.SetSoundAndPlay(SoundPaths.S_Menu_Unpause); break;
            }
        }
        return(paused);
    }