Пример #1
0
 // Use this for initialization
 void Start()
 {
     sceneManager      = SMGameEnvironment.Instance.SceneManager;
     levelProgress     = sceneManager.UnmodifiableLevelProgress;
     activeGroup       = sceneManager.Groups [0];
     activeGroupLevels = sceneManager.LevelsInGroup(activeGroup);
 }
Пример #2
0
 public SMGameEnvironment()
 {
     sceneManager = new SMSceneManager(SMSceneConfigurationLoader.LoadActiveConfiguration("Config"));
     sceneManager.LevelProgress = new SMLevelProgress(sceneManager.ConfigurationName);
     // Comment this in to enable the blinds transition type
     // sceneManager.TransitionPrefab = "Transitions/MyTransition";
 }
Пример #3
0
    public void loadLevel()
    {
        SMSceneManager sm = SMGameEnvironment.Instance.SceneManager;

        if (isLevelAvailable(gameObject.name))
        {
            sm.LoadLevel(gameObject.name);
        }
    }
Пример #4
0
    public void loadLevel(string levelid)
    {
        SMSceneManager sm = SMGameEnvironment.Instance.SceneManager;

        if (isLevelAvailable(levelid))
        {
            sm.LoadLevel(levelid);
        }
    }
Пример #5
0
    public bool isLevelAvailable(string levelid)
    {
        SMSceneManager sm     = SMGameEnvironment.Instance.SceneManager;
        SMLevelStatus  status = sm.LevelProgress.GetLevelStatus(levelid);

        if (SMLevelStatus.New == status)
        {
            return(false);
        }
        return(true);
    }
Пример #6
0
    public void resetProgress()
    {
        SMSceneManager sceneManager = SMGameEnvironment.Instance.SceneManager;

        sceneManager.LevelProgress.ResetLastLevel();
        foreach (string levelId in sceneManager.Levels)
        {
            sceneManager.LevelProgress.SetLevelStatus(levelId, SMLevelStatus.New);
        }
        foreach (string groupId in sceneManager.Groups)
        {
            sceneManager.LevelProgress.SetGroupStatus(groupId, SMGroupStatus.New);
        }
        sceneManager.LevelProgress = sceneManager.UnmodifiableLevelProgress;
    }
Пример #7
0
    void OnGUI()
    {
        SMSceneManager sceneManager = SMGameEnvironment.Instance.SceneManager;

        GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
        GUILayout.FlexibleSpace();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();


        GUILayout.Label("Scene Manager Demo - Main Menu");
        GUILayout.FlexibleSpace();
        if (sceneManager.ConfigurationName.Contains("DemoGame"))
        {
            GUILayout.Label("This is the demo version of the game with only 2 levels.");
        }
        else
        {
            GUILayout.Label("This is the full version of the game with 4 levels.");
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("New Game"))
        {
            sceneManager.LoadFirstLevel();
        }

        if (levelProgress.HasPlayed)
        {
            if (GUILayout.Button("Continue Playing " + levelProgress.LastLevelId))
            {
                sceneManager.LoadNextLevel();
            }
        }

        if (GUILayout.Button("Reset Progress"))
        {
            sceneManager.LevelProgress.ResetLastLevel();
            foreach (string levelId in sceneManager.Levels)
            {
                sceneManager.LevelProgress.SetLevelStatus(levelId, SMLevelStatus.New);
            }
            foreach (string groupId in sceneManager.Groups)
            {
                sceneManager.LevelProgress.SetGroupStatus(groupId, SMGroupStatus.New);
            }
            levelProgress = sceneManager.UnmodifiableLevelProgress;
        }

        GUILayout.FlexibleSpace();
        GUILayout.Label("Start an already played level...");

        if (GUILayout.Button("Select Level"))
        {
            sceneManager.LoadScreen("LevelSelectionMenu");
        }

        GUILayout.FlexibleSpace();
        GUILayout.Label("Select transition for switching between levels");
        selectionIndex = GUILayout.SelectionGrid(selectionIndex, transitionName, 5);
        sceneManager.TransitionPrefab = transitionPrefab[selectionIndex];
        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();

        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.EndArea();
    }
Пример #8
0
 public SceneHelper()
 {
     m_manager = new SMSceneManager(SMSceneConfigurationLoader.LoadActiveConfiguration("SceneConfig"));
     m_manager.LevelProgress = new SMLevelProgress(m_manager.ConfigurationName);
     //m_manager.SetTransitionPrefab(TransitionType.SMBlindsTransition);
 }