Ejemplo n.º 1
0
    private void OnGetInventorySuccess(GetUserInventoryResult result)
    {
        //Debug
        //Debug.Log("PlayFab - GetInventorySuccess");
        DebugText.text += "\nPlayFab - GetInventorySuccess";

        //Set Virtual currecy & Items owned
        CharacterReferences.instance.playerInfo.SetCurrency(result.VirtualCurrency["CO"], result.VirtualCurrency["GE"]);
        CharacterReferences.instance.charactersInfo.CheckCharacters(result.Inventory);


        EnvironmentController ec = EnvironmentController.instance;

        ec.setsList = new List <EnvironmentSet>();

        EnvironmentPrefabController temp = ec.prefabsInstantiated[0];

        ec.prefabsInstantiated = new List <EnvironmentPrefabController>();
        Destroy(temp.gameObject);

        ec.GetEnvironments();
        ec.SetEnvironment();

        ParallaxMainController.instance.SetParallaxNewElements();
        //Debug.Log("PlayFabLogin GET INVENTORY");

        MMA.UpdateTexts(true);

        MMA.ToogleShopWindow();
        ShopController.instance.InstantiateNewCharacter();
        MMA.ToogleShopWindow();

        isPlayFabLogged = true;
    }
Ejemplo n.º 2
0
    void InstantiatePrefab()
    {
        if (caveBool)        //if the next prefab must be a cave
        {
            //Debug.Log("NewCave");
            caveBool   = false;
            prefabTemp = Instantiate(cavePrefab); //instantiate the prefab
            SetNewEnvironment();                  //Change environment
        }
        else                                      //if the next prefab wont be a cave
        {
            isCaveBool = false;
            if (Random.value <= floorPercentage)
            {
                //Debug.Log("InstantiatedFloor");
                prefabTemp = Instantiate(set.floorPrefabs[Random.Range(0, set.floorPrefabs.Length)]);
            }
            else
            {
                //Debug.Log("InstantiatedFloating");
                prefabTemp = Instantiate(set.floatingPrefabs[Random.Range(0, set.floatingPrefabs.Length)]);
            }
        }
        EnvironmentPrefabController epcTemp = prefabTemp.GetComponent <EnvironmentPrefabController>();

        epcTemp.transform.position = prefabsInstantiated[prefabsInstantiated.Count - 1].transform.position;
        float   xSize    = prefabsInstantiated[prefabsInstantiated.Count - 1].floorRenderer.bounds.size.x;
        float   newXSize = epcTemp.floorRenderer.bounds.size.x;
        Vector3 newPos   = new Vector3(prefabTemp.transform.position.x + (xSize / 2) + (newXSize / 2), prefabTemp.transform.position.y, 0);

        prefabTemp.transform.position = newPos;
        prefabsInstantiated.Add(epcTemp);
    }
Ejemplo n.º 3
0
 public void ChangeEnviron()
 {
     if (prefabsInstantiated.Count > 5)
     {
         //Debug.Log(prefabsInstantiated.Count);
         EnvironmentPrefabController temp = prefabsInstantiated[0];
         prefabsInstantiated.Remove(prefabsInstantiated[0]);
         Destroy(temp.gameObject);
     }
     InstantiatePrefab();
 }
Ejemplo n.º 4
0
    public void ResetLocalData()
    {
        playerName       = "";
        playerLevel      = 1;
        currentMedals    = 0;
        medalsToNextRank = 3;
        medalHolder      = 0;

        metersRecord = 0;
        pointsRecord = 0;

        coins = 0;
        gems  = 0;

        selectedCharacter = 0;

        language = 0;

        challengesIndex    = new int[3];
        challengesProgress = new int[3];

        firstConection = true;
        isLocal        = true;

        totalAttacks             = 0;
        totalChallengesCompleted = 0;
        totalCoinsEarned         = 0;
        totalDeaths        = 0;
        totalEnemiesKilled = 0;
        totalJumps         = 0;
        totalMetersRunned  = 0;
        totalSpecialUsed   = 0;

        CharactersInfo chi = CharacterReferences.instance.charactersInfo;

        int length = chi.characters.Length;

        for (int i = 1; i < length; i++)
        {
            chi.characters[i].unlocked = false;
        }

        EnvironmentController ec = EnvironmentController.instance;

        ec.setsList = new List <EnvironmentSet>();

        EnvironmentPrefabController temp = ec.prefabsInstantiated[0];

        ec.prefabsInstantiated = new List <EnvironmentPrefabController>();
        Destroy(temp.gameObject);

        ec.GetEnvironments();
        ec.SetEnvironment();

        ParallaxMainController.instance.SetParallaxNewElements();
        Debug.Log("CharacterInfo");


        MainMenuAnimator.instance.ToogleShopWindow();
        ShopController.instance.InstantiateNewCharacter();
        MainMenuAnimator.instance.ToogleShopWindow();
    }