コード例 #1
0
        public void Add(ISystem system)
        {
            if (ContainsSystem(system))
            {
                throw new InvalidOperationException($"System {system.GetType().Name} already added to game manager.");
            }

            _systems.Add(system);
            _systems.Sort();

            var drawableSystem = system as IDrawableSystem;

            if (drawableSystem != null)
            {
                _drawableSystems.Add(drawableSystem);
                _drawableSystems.Sort();
            }

            system.AddToGameManager(_gameManager);

            SystemAdded?.Invoke(this, new SystemChangedEventArgs(system));
        }