Exemple #1
0
    public static void increasePlayedAMiniGame(ChangeScene.EspikinglishMinigames miniGame, bool success)
    {
        Debug.Log("increasePlayedAMiniGame() Start");

        if (GameManager.GetInstance().CurrentPlayerInformation == null)
        {
            Debug.Log("increasePlayedAMiniGame() return CurrentPlayerInformation == null");
            return;
        }

        PlayerInformation _currentPlayerInformation = GameManager.GetInstance().CurrentPlayerInformation;

        switch (miniGame)
        {
        case ChangeScene.EspikinglishMinigames.PAINTING:
            _currentPlayerInformation.timesPlayedModernPaints += 1;
            if (!success)
            {
                _currentPlayerInformation.timesLossedModernPaints += 1;
            }
            break;

        case ChangeScene.EspikinglishMinigames.ORCHESTA:
            _currentPlayerInformation.timesPlayedOrchesta += 1;
            if (!success)
            {
                _currentPlayerInformation.timesLossedOrchesta += 1;
            }
            break;

        case ChangeScene.EspikinglishMinigames.LOVE_SCENE:
            _currentPlayerInformation.timesPlayedLoveGame += 1;
            if (!success)
            {
                _currentPlayerInformation.timesLossedLoveGame += 1;
            }
            break;

        case ChangeScene.EspikinglishMinigames.WORMS:
            _currentPlayerInformation.timesPlayedWorms += 1;
            if (!success)
            {
                _currentPlayerInformation.timesLossedWorms += 1;
            }
            break;

        case ChangeScene.EspikinglishMinigames.RPG:
            _currentPlayerInformation.timesPlayeRPG += 1;
            if (!success)
            {
                _currentPlayerInformation.timesLossedRPG += 1;
            }
            break;
        }

        string json = JsonUtility.ToJson(_currentPlayerInformation);
        string key  = PLAYERDATA_PLAYERPREFCODE + _currentPlayerInformation.slotNumber.ToString();

        PlayerPrefs.SetString(key, json);

        Debug.Log("increasePlayedAMiniGame() End");
    }
Exemple #2
0
    public static void increaseMicrophonePressedTime(bool success, string pronouncedWord, ChangeScene.EspikinglishMinigames miniGame)
    {
        Debug.Log("increaseMicrophonePressedTime(3 parametros) Start");

        if (GameManager.GetInstance().CurrentPlayerInformation == null)
        {
            Debug.Log("increaseMicrophonePressedTime(3 parametros) return CurrentPlayerInformation == null");
            return;
        }

        Debug.Log("Increase accuracy: " + success);

        PlayerInformation _currentPlayerInformation = GameManager.GetInstance().CurrentPlayerInformation;

        switch (miniGame)
        {
        case ChangeScene.EspikinglishMinigames.PAINTING:
            if (!_currentPlayerInformation._pronouncedWordsPaint.Contains(pronouncedWord))
            {
                _currentPlayerInformation._pronouncedWordsPaint.Add(pronouncedWord);
            }
            break;

        case ChangeScene.EspikinglishMinigames.ORCHESTA:
            if (!_currentPlayerInformation._pronouncedWordsOrchesta.Contains(pronouncedWord))
            {
                _currentPlayerInformation._pronouncedWordsOrchesta.Add(pronouncedWord);
            }
            break;

        case ChangeScene.EspikinglishMinigames.LOVE_SCENE:
            if (!_currentPlayerInformation._pronouncedWordsLove.Contains(pronouncedWord))
            {
                _currentPlayerInformation._pronouncedWordsLove.Add(pronouncedWord);
            }
            break;

        case ChangeScene.EspikinglishMinigames.WORMS:
            if (!_currentPlayerInformation._pronouncedWordsWorms.Contains(pronouncedWord))
            {
                _currentPlayerInformation._pronouncedWordsWorms.Add(pronouncedWord);
            }
            break;

        case ChangeScene.EspikinglishMinigames.RPG:
            if (!_currentPlayerInformation._pronouncedWordsBoss.Contains(pronouncedWord))
            {
                _currentPlayerInformation._pronouncedWordsBoss.Add(pronouncedWord);
            }
            break;
        }

        _currentPlayerInformation.microphonePressedTimes += 1;

        if (success)
        {
            _currentPlayerInformation.microphonePressedTimesSuccesses += 1;
        }

        string json = JsonUtility.ToJson(_currentPlayerInformation);
        string key  = PLAYERDATA_PLAYERPREFCODE + _currentPlayerInformation.slotNumber.ToString();

        PlayerPrefs.SetString(key, json);

        Debug.Log("increaseMicrophonePressedTime(3 parametros) End");
    }