Example #1
0
    static void RunFromCurrent()
    {
        if (EditorApplication.isPlaying == true)
        {
            EditorApplication.isPlaying = false;
            return;
        }


        GlobalVariableList globalsList = (GlobalVariableList)AssetDatabase.LoadAssetAtPath("Assets/Data/GlobalVariables.asset", typeof(GlobalVariableList));

        globalsList.SetGlobalVariable("playerspawnpoint", 0, 0);

        string currentScene = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name;

        Debug.Log("load");
        if (currentScene != "CoreScene")
        {
            UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/Scenes/CoreScene.unity");
            //UnityEditor.SceneManagement.EditorSceneManager.LoadScene(currentScene, UnityEngine.SceneManagement.LoadSceneMode.Additive);
        }

        AddPlayerSpawnPoint();

        UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
        EditorApplication.isPlaying = true;
    }
Example #2
0
    public static void OnPlayStateChange(PlayModeStateChange playMode)
    {
        if (playMode == PlayModeStateChange.EnteredEditMode)
        {
            // RemoveGameLogicObjects();
            UnityEditor.SceneManagement.EditorSceneManager.CloseScene(UnityEngine.SceneManagement.SceneManager.GetSceneByName("CoreScene"), true);
        }
        else if (playMode == PlayModeStateChange.ExitingEditMode)
        {
            string currentScene = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().path;
            if (!currentScene.Contains("StartScene") && !currentScene.Contains("Title"))
            {
                GlobalVariableList globalsList = (GlobalVariableList)AssetDatabase.LoadAssetAtPath("Assets/Data/GlobalVariables.asset", typeof(GlobalVariableList));
                globalsList.SetGlobalVariable("playerspawnpoint", 0, 0);

                if (currentScene != "CoreScene")
                {
                    UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/Scenes/CoreScene.unity");
                    UnityEditor.SceneManagement.EditorSceneManager.OpenScene(currentScene, UnityEditor.SceneManagement.OpenSceneMode.Additive);
                }
                EditorApplication.isPlaying = true;
                AddPlayerSpawnPoint();
            }
            //  AddGameLogicObjects();
        }
    }
Example #3
0
        public Node GlobalVariableList()
        {
            var n1 = new GlobalVariableList();

            n1.Add(new Identifier()
            {
                AnchorToken = Expect(TokenType.IDENTIFIER)
            });
            while (CurrentToken == TokenType.LIST)
            {
                Expect(TokenType.LIST);
                n1.Add(new Identifier()
                {
                    AnchorToken = Expect(TokenType.IDENTIFIER)
                });
            }
            return(n1);
        }
Example #4
0
        public void Visit(GlobalVariableList node)
        {
            if (DEBUG)
            {
                Console.WriteLine($"Visiting {node.GetType()}");
            }

            foreach (var child in node.children)
            {
                if (globalVariables.ContainsKey(child.AnchorToken.Lexeme))
                {
                    throw new SemanticError("This variable already exists, you can't have two of the same variable.", child.AnchorToken);
                }
                else
                {
                    globalVariables.TryAdd(child.AnchorToken.Lexeme, new Variable());
                    if (DEBUG)
                    {
                        Console.WriteLine($"Name {child.AnchorToken.Lexeme} Added to variable table");
                    }
                }
            }
        }
Example #5
0
 public void Visit(GlobalVariableList node)
 {
 }
Example #6
0
    public static void BuildDynamicList()
    {
        GlobalVariableList globalsList = (GlobalVariableList)AssetDatabase.LoadAssetAtPath("Assets/Data/GlobalVariables.asset", typeof(GlobalVariableList));

        globalsList.BuildDynamicList();
    }
Example #7
0
 public string Visit(GlobalVariableList node)
 {
     return("");
 }