Пример #1
0
        public void Initialize(params string[] args)
        {
            if (Initialized)
            {
                Debug.LogError("Game has already been initialized. This should not happen!");
                return;
            }

            Initialized = true;

            // Console
            var consoleView = FindObjectOfType <ConsoleView>();

            if (consoleView == null)
            {
                Debug.LogWarning("Failed to find a ConsoleView! The Console will be unavailable!");
            }
            else
            {
                _console = new ConsoleController();
                consoleView.SetConsole(_console);
            }

            // Relay
            gameObject.GetOrAddComponent <MonoEventRelay>();

            // State
            _stateManager = new StateManager();
            _stateManager.Listener.StateChanged += Listener_StateChanged;

            // Scene Loader
            _sceneLoader = gameObject.GetOrAddComponent <SceneLoader>();

            // Zone
            _zoneManager = new ZoneManager <GameZone>(_sceneLoader);
            _zoneManager.Listener.ZoneChanged += Listener_ZoneChanged;

            // Allows the control of the game, such as level loading, resuming and pausing the game.
            _controller = new GameController(this, _stateManager, _zoneManager);

            // Audio
            Services.Provide(FindObjectOfType <AudioSystem>());

            // Game Entities
            new GameEntityManager(this);

            // Rules
            _rules = new List <GameRule>();

            // Game implementation
            OnInitialize(args);
        }
Пример #2
0
        public void SetConsole(ConsoleController console)
        {
            Console = console;

            LogViewItem.gameObject.SetActive(false);
            InputField.text = "";
            LogView.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0f);

            // Add callback for all Unity Debug Log events.
            Application.logMessageReceivedThreaded += OnLogMessageRecieved;

            View.SetActive(false);
        }
Пример #3
0
 public LogInterceptor(ConsoleController console, ILogHandler fallback, Color logColor)
 {
     Console         = console;
     LogColor        = logColor;
     FallbackHandler = fallback;
 }
Пример #4
0
 public DebugConsole()
 {
     Controller = new ConsoleController();
 }
 public void Init()
 {
     TestConsole = new Framework.ConsoleController();
 }