Example #1
0
 /// <summary>
 /// Vérifie au lancement de la scène de menu si le manager inter-scènes n'existe pas déjà. S'il n'existe pas, l'instantie.
 /// </summary>
 public void CheckForIntersceneManager()
 {
     if (IntersceneManager.intersceneManager == null)
     {
         IntersceneManager newIntersceneManager = Instantiate(intersceneManagerPrefab);
         newIntersceneManager.SetUp();
     }
 }
    public void CheckForIntersceneManager()
    {
        if (IntersceneManager.intersceneManager == null)
        {
            IntersceneManager newIntersceneManager = Instantiate(intersceneManagerPrefab);
            newIntersceneManager.SetUp();
        }

        IntersceneManager.intersceneManager.MapInterscInformations.SetMapIntersceneInfos(mapSceneName, Vector3.zero, null);
    }
    public void Reinitialize()
    {
        IntersceneManager intersceneManager = IntersceneManager.intersceneManager;

        PlayerDataSaver.ErasePlayerDatas();
        intersceneManager.GetPlayerDatas.Reinitialize();
        intersceneManager.ArenaInterscInformations.Reinitialize();
        intersceneManager.ArenaInterscInformations.SetNeedToPassTutorial(true);
        intersceneManager.MapInterscInformations.Reinitialize();
        intersceneManager.MapInterscInformations.SetMapIntersceneInfos(mapSceneName, Vector3.zero, null);
        passedTutorial = false;
        CheckForSaveFiles();
    }
 public void CheckForIntersceneManager()
 {
     if (IntersceneManager.intersceneManager == null)
     {
         if (intersceneManagerPrefab != null)
         {
             intersceneManagerInstance = Instantiate(intersceneManagerPrefab);
             intersceneManagerInstance.SetUp();
         }
     }
     else
     {
         intersceneManagerInstance = IntersceneManager.intersceneManager;
     }
 }
Example #5
0
    public void CheckMapProgression()
    {
        IntersceneManager intersceneManager = IntersceneManager.intersceneManager;

        if (intersceneManager != null)
        {
            bool passedTutorial = false;

            PlayerProgressionDatas progressionDatas = PlayerDataSaver.LoadProgressionDatas();

            ArenaIntersceneInformations arenaIntersceneInformations = intersceneManager.ArenaInterscInformations;

            #region Tutorial
            if (arenaIntersceneInformations.GetNeedToPassTutorial)
            {
                if (arenaIntersceneInformations.GetArenaPassed)
                {
                    progressionDatas.SetPassedTutorial();
                    arenaIntersceneInformations.SetNeedToPassTutorial(false);
                    PlayerDataSaver.SavePlayerProgressionDatas(progressionDatas.GetAllPassedArenaDatas, true);
                }
            }

            if (progressionDatas != null)
            {
                passedTutorial = progressionDatas.GetPassedTuto;
            }
            #endregion

            #region Already Unlocked

            #region V2
            List <PassedArenaData> allPassedArenaDatas = new List <PassedArenaData>();
            if (progressionDatas != null)
            {
                allPassedArenaDatas = progressionDatas.GetAllPassedArenaDatas;
                if (allPassedArenaDatas == null)
                {
                    allPassedArenaDatas = new List <PassedArenaData>();
                }

                foreach (PassedArenaData datas in allPassedArenaDatas)
                {
                    foreach (MapArenaSpot arenaSpot in allMapArenaSpots)
                    {
                        if (arenaSpot.GetArenaParameters.GetSceneToLoadName == datas.GetArenaName && datas.GetArenaPassed)
                        {
                            arenaSpot.UnlockNextProgressionContent(false, datas.GetNumberOfStars);
                            break;
                        }
                    }
                }
            }
            else
            {
                Debug.Log("pas encore d'arènes débloquées");
            }
            #endregion
            #endregion

            #region Just Unlocked
            ArenaParameters lastArenaParameters = arenaIntersceneInformations.GetLaunchedArenaParameters;
            if (lastArenaParameters == null)
            {
                arenaIntersceneInformations.SetArenaPassed(false, 0);

                if (intersceneManager.ArenaInterscInformations.GetJustPassedTutorial)
                {
                    intersceneManager.ArenaInterscInformations.SetJustPassedTutorial(false);
                    if (cinematicToPlayAfterTutorial != null)
                    {
                        cinematicToPlayAfterTutorial.PlayCinematic();
                    }
                }

                return;
            }

            #region V2
            List <string> passedArenaNames = new List <string>();

            if (allPassedArenaDatas == null)
            {
                allPassedArenaDatas = new List <PassedArenaData>();
            }

            foreach (PassedArenaData datas in allPassedArenaDatas)
            {
                if (datas.GetArenaPassed)
                {
                    passedArenaNames.Add(datas.GetArenaName);
                }
            }

            if (arenaIntersceneInformations.GetArenaPassed)
            {
                int stars = arenaIntersceneInformations.GetNumberOfStars;

                if (passedArenaNames.Contains(lastArenaParameters.GetSceneToLoadName))
                {
                    foreach (MapArenaSpot arenaSpot in allMapArenaSpots)
                    {
                        if (arenaSpot.GetArenaParameters.GetSceneToLoadName == lastArenaParameters.GetSceneToLoadName)
                        {
                            if (stars > arenaSpot.GetStarsNumber)
                            {
                                arenaSpot.UnlockNextProgressionContent(false, stars);
                            }

                            foreach (PassedArenaData datas in allPassedArenaDatas)
                            {
                                if (datas.GetArenaName == lastArenaParameters.GetSceneToLoadName)
                                {
                                    datas.ChangeNumberOfStars(stars);
                                    break;
                                }
                            }
                            PlayerDataSaver.SavePlayerProgressionDatas(allPassedArenaDatas, passedTutorial);
                            break;
                        }
                    }
                    return;
                }

                foreach (MapArenaSpot arenaSpot in allMapArenaSpots)
                {
                    if (arenaSpot.GetArenaParameters.GetSceneToLoadName == lastArenaParameters.GetSceneToLoadName)
                    {
                        arenaSpot.UnlockNextProgressionContent(true, stars);
                        break;
                    }
                }

                allPassedArenaDatas.Add(new PassedArenaData(lastArenaParameters, true, stars));
                PlayerDataSaver.SavePlayerProgressionDatas(allPassedArenaDatas, passedTutorial);
            }
            #endregion
            #endregion

            bool arenaPassed   = arenaIntersceneInformations.GetArenaPassed;
            int  numberOfStars = arenaIntersceneInformations.GetNumberOfStars;

            //arenaIntersceneInformations.SetArenaLaunchInformations(null);
            arenaIntersceneInformations.SetArenaPassed(false, 0);
        }
    }
 /// <summary>
 /// Initialisation de cette object dans le menu du jeu
 /// </summary>
 public void SetUp()
 {
     intersceneManager = this;
     DontDestroyOnLoad(gameObject);
 }