Ejemplo n.º 1
0
    public static void TrackEndGame(GameController.EndGameType endGameType, int turns, float playTime, int points)
    {
        var request = new WriteClientPlayerEventRequest
        {
            EventName = EndGameKey,
            Body      = new Dictionary <string, object>
            {
                { EndGameTypeKey, endGameType.ToString() },
                { EndGameTurnsKey, turns.ToString() },
                { EndGameTimeKey, playTime.ToString("0.00") },
                { EndGamePointsKey, points.ToString() }
            }
        };

        PlayFabClientAPI.WritePlayerEvent(request, null, null);
    }
Ejemplo n.º 2
0
    public void ShowEndMenu(GameController.EndGameType endType)
    {
        if (GameController.I.GameMode == GameController.GameModeType.Endless)
        {
            starsPanel.gameObject.SetActive(false);
            endlessStatsPanel.gameObject.SetActive(true);


            statusText.text = "Level up animals to get better score!";
            AudioController.I.PlayPositiveSFX();

            scoreText.text        = GameController.I.Score + "pts";
            endlessTurnsText.text = "Turns\n" + GameController.I.GameTurn;
            endlessTimeText.text  = "Time\n" + GameController.I.GameTime.FormatToTime();
        }
        else
        {
            switch (endType)
            {
            case GameController.EndGameType.Manual:
                statusText.text = "Better luck next time!";
                AudioController.I.PlayNeutralSFX();
                break;

            case GameController.EndGameType.NoEmptySpace:
                statusText.text = "No more spaces left :(";
                AudioController.I.PlayNegativeSFX();
                break;

            case GameController.EndGameType.TimeLimit:
                statusText.text = "No more time :(";
                AudioController.I.PlayNegativeSFX();
                break;

            case GameController.EndGameType.TurnLimit:
                statusText.text = "No more turns :(";
                AudioController.I.PlayNegativeSFX();
                break;

            case GameController.EndGameType.Win:
                statusText.text = "GREAT JOB :)";
                AudioController.I.PlayPositiveSFX();
                break;
            }

            starsPanel.gameObject.SetActive(true);
            endlessStatsPanel.gameObject.SetActive(false);
            var starCount = 0;
            if (GameController.I.GameMode == GameController.GameModeType.TargetScore)
            {
                scoreText.text = GameController.I.Score + " / " + GameController.I.TargetScore;
                starCount      = GameController.I.Score / GameController.I.TargetScore * 3;
            }
            else if (GameController.I.GameMode == GameController.GameModeType.Collections)
            {
                scoreText.text = GameController.I.Score + "pts";
                // TODO: implement this depending on points
                starCount = 2;
            }
            StartCoroutine(DoStarsAnimation(starCount));
        }

        // fade in
        mainCanvasGroup.interactable = mainCanvasGroup.blocksRaycasts = true;

        Go.to(mainCanvasGroup, fadeDuration, new GoTweenConfig().floatProp("alpha", 1f));
    }