Beispiel #1
0
    public World(WorldSettings settings)
    {
        this.settings = settings;

        size       = settings.Size;
        squareSize = size * size;

        random = new Random(settings.seed);

        tileMap   = new Tile[size, size];
        heightMap = new float[size, size];

        log = new WorldLog(this);
    }
Beispiel #2
0
        private static void CheckLevelEnterPlayModeForLoadingMainScene()
        {
            if (!ProjectEditorConfig.Instance.AutoTestLevelScenes)
            {
                return;
            }

            // No game exists
            var game = FindAllObjects.InScene <GameBase>().FirstOrDefault();

            if (game)
            {
                return;
            }

            // Found level helper
            var sceneRef = FindAllObjects.InScene <LevelSceneRefBase>();

            if (sceneRef.Length <= 0)
            {
                return;
            }

            ManagedLog.Log($"Loading main scene to test {SceneManager.GetActiveScene().name}");

            var testingScene = AssetDatabase.LoadAssetAtPath <SceneAsset>(SceneManager.GetActiveScene().path);

            GameWindow.TestLevel = AssetDatabase.LoadAssetAtPath <SceneAsset>(SceneManager.GetActiveScene().path);

            _asyncOperation = EditorSceneManager.LoadSceneAsyncInPlayMode(GameWindow.MainSceneAssetPath,
                                                                          new LoadSceneParameters(LoadSceneMode.Single));

            _asyncOperation.completed += OnloadComplete;

            void OnloadComplete(AsyncOperation obj)
            {
                game = FindAllObjects.InScene <GameBase>().FirstOrDefault();
                _asyncOperation.completed -= OnloadComplete;
                Assert.IsNotNull(game);

#if USING_SHAPES
                WorldLog.OnScreen($"Testing {testingScene.name}");
#endif
                new Operation(delay: 1f, action: () =>
                {
                    game.StartGame();
                }).Start();
            }
        }
Beispiel #3
0
        public void LogInWorld(object msg)
        {
#if USING_SHAPES
            WorldLog.Log(msg, localTransform: transform);
#endif
        }
Beispiel #4
0
 private void LogOnScreen(string msg = "On Screen Log")
 {
     WorldLog.OnScreen(msg);
 }
Beispiel #5
0
 private void LogInWorld(string msg = "Hello", Color?color = null)
 {
     WorldLog.Log($"{msg} At Pos", pos: Vector3.zero, color: color);
     WorldLog.Log($"{msg} At Transform", localTransform: transform, color: color);
 }