void OnGameOver(object arg0)
    {
        PlayerSave         player      = SaveLoadController.GetInstance().GetPlayer();
        EndlessSessionSave gameSession = SaveLoadController.GetInstance().GetEndlessSession();
        GooglePlayHelper   gph         = GooglePlayHelper.GetInstance();

        player.AddTotalGamesPlayed(1);

        // report events
        gph.ReportEvent(GPGSConstant.event_amount_of_endless_games_started, 1);
        gph.ReportEvent(GPGSConstant.event_score_endless_mode, gameSession.GetTotalScore());
        gph.ReportEvent(GPGSConstant.event_health_potions_picked_up, gameSession.GetResourcesGathered());

        // save current stats
        gph.SaveGame(); // TODO: keep track of timeplayed

        // check for achievements
        AchievementChecker.CheckForEndlessScoreAchievement(gameSession.GetTotalScore());
        AchievementChecker.CheckForWelcomeAchievement();

        // highscore post
        if (gameSession.GetTotalScore() > player.GetHighscore())
        {
            EventManager.TriggerEvent(EventTypes.NEW_HIGHSCORE);
            player.SetHighscore(gameSession.GetTotalScore());
            gph.PostHighscore(player.GetHighscore(), GPGSConstant.leaderboard_endless_mode);
        }

        // start game over screen
        LoadingController.LoadScene(LoadingController.Scenes.GAME_OVER);
    }
 void OnPlayerLeavesTheGame(object arg0)
 {
     DebugMP.Log("OnPlayerLeavesTheGame");
     playerLeftOnPurpose = true;
     PlayGamesPlatform.Instance.RealTime.LeaveRoom();
     LoadingController.LoadScene(LoadingController.Scenes.GPMP_LOBBY);
 }
    private void OnStartInvitingForMatch(object model)
    {
        GPMPMatchModel matchModel = (GPMPMatchModel)model;

        PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(matchModel.minimumAmountOpponents, matchModel.maximumAmountOpponents, 0, this);
        LoadingController.LoadScene(LoadingController.Scenes.GPMP_WAITING_ROOM);
    }
    private void OnStartSearchForQuickMatch(object model)
    {
        GPMPMatchModel matchModel = (GPMPMatchModel)model;

        PlayGamesPlatform.Instance.RealTime.CreateQuickGame(matchModel.minimumAmountOpponents, matchModel.maximumAmountOpponents, 0, this);
        LoadingController.LoadScene(LoadingController.Scenes.GPMP_WAITING_ROOM);
    }
 public void OnMatchMakingCanceled(object obj)
 {
     DebugMP.Log("OnMatchMakingCanceled");
     playerLeftOnPurpose = true;
     PlayGamesPlatform.Instance.RealTime.LeaveRoom();
     LoadingController.LoadScene(LoadingController.Scenes.GPMP_LOBBY);
 }
Ejemplo n.º 6
0
    IEnumerator TriggerGameOverScreen()
    {
        yield return(new WaitForSeconds(2));

        DebugMP.Log("Game over");
        LoadingController.LoadScene(LoadingController.Scenes.GPMP_GAME_OVER);
    }
Ejemplo n.º 7
0
    IEnumerator IEPlay()
    {
        LoadingController.LoadScene(1);
        yield return(new WaitUntil(() => !LoadingController.isLoading));

        PlayfieldController.Setup(startLevel);
        PlayfieldController.StartSpawn();
    }
    /*
     * Functions handling on notification clicked for invitation
     */

    public void OnInvitationReceived(Invitation invitation, bool shouldAutoAccept)
    {
        if (shouldAutoAccept)
        {
            LoadingController.LoadScene(LoadingController.Scenes.GPMP_WAITING_ROOM);
            PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, this);
        }
    }
 public void OnPeersDisconnected(string[] participantIds)
 {
     DebugMP.Log("OnPeersDisconnected");
     playerLeftOnPurpose = false;
     errorMessage        = "Your opponent left the game";
     PlayGamesPlatform.Instance.RealTime.LeaveRoom();
     LoadingController.LoadScene(LoadingController.Scenes.GPMP_LOBBY);
 }
 void Update()
 {
     timer += Time.deltaTime;
     if (timer >= duration && !readyForContinue)
     {
         readyForContinue = true;
         LoadingController.LoadScene(LoadingController.Scenes.MAIN_MENU);
     }
 }
Ejemplo n.º 11
0
    IEnumerator IEQuit()
    {
        LoadingController.LoadScene(0);
        SaveData();
        yield return(new WaitUntil(() => !LoadingController.isLoading));

        saveData = LoadData();
        MainMenuUIController.UpdateHUD();
    }
Ejemplo n.º 12
0
    /// <summary>
    /// Call this connect the loading controller to the manager.
    /// </summary>
    /// <param name="loadingController">The current loading controller.</param>
    public void ConnectLoadingController(LoadingController loadingController)
    {
        if (waitingForLoadingConnection && loading)
        {
            currentLoadingController    = loadingController;
            waitingForLoadingConnection = false;

            if (currentlyUnloading)
            {
                currentLoadingController.LoadScene(currentSceneToLoad, currentSceneToUnload);
            }
            else
            {
                currentLoadingController.LoadScene(currentSceneToLoad);
            }
        }
        else
        {
            loadingController.LoadScene(defaultSceneName);
        }
    }
    public void Multiplayer()
    {
        MenuTheme.Instance.StopAudio();

        if (internetAvailable)
        {
            LoadingController.LoadScene(LoadingController.Scenes.GPMP_LOBBY);
        }
        else
        {
            EventManager.TriggerEvent(InternetConnectionStatus.SHOW_CONNECTION_STATE);
        }
    }
    public void OnRoomConnected(bool success)
    {
        DebugMP.Log("OnRoomConnected " + success);
        if (success)
        {
            EventManager.TriggerEvent(GPMPEvents.Types.GPMP_MATCH_MAKING_DONE.ToString());

            // Reset save model
            SaveLoadController.GetInstance().GetMultiplayerSession().Reset();

            // Start versusn screen
            LoadingController.LoadScene(LoadingController.Scenes.GPMP_VERSUS_SCREEN);
        }
        else
        {
            PlayGamesPlatform.Instance.RealTime.LeaveRoom();
            LoadingController.LoadScene(LoadingController.Scenes.GPMP_LOBBY);
        }
    }
    // Update is called once per frame
    void Update()
    {
        // Android Backbutton is down
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!isExiting)
            {
                isExiting = true;
                // get values
                float value = movementSensitivitySlider.value * 10;
                SaveLoadController.GetInstance().GetOptions().SetControlSensitivity(value);

                // save game
                GooglePlayHelper.GetInstance().SaveGame();

                LoadingController.LoadScene(LoadingController.Scenes.MAIN_MENU);
            }
        }
    }
 public void StartEndless()
 {
     MenuTheme.Instance.StopAudio();
     LoadingController.LoadScene(LoadingController.Scenes.GAME);
 }
 public void ToMainMenu()
 {
     LoadingController.LoadScene(LoadingController.Scenes.MAIN_MENU);
 }
    IEnumerator TriggerGameOverScreen()
    {
        yield return(new WaitForSeconds(screenDuration));

        LoadingController.LoadScene(LoadingController.Scenes.GPMP_GAME);
    }
 public void StartInfoMenu()
 {
     LoadingController.LoadScene(LoadingController.Scenes.INFO_MENU);
 }
 public void Restart()
 {
     LoadingController.LoadScene(LoadingController.Scenes.GAME);
 }
 public void OpenShop()
 {
     LoadingController.LoadScene(LoadingController.Scenes.STORE);
 }