Exemple #1
0
        /// <summary>
        /// Runs the game.
        /// </summary>
        public void Run()
        {
            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                //Grabs the components from the Assembly
                if (typeof(IComponent).IsAssignableFrom(type) && type != typeof(IComponent))
                {
                    ECSManager.AddComponent(type);
                }
                //Grabs the Systems from the Assembly
                else if (type.IsSubclassOf(typeof(System)))
                {
                    ECSManager.AddSystem(type);
                }
            }

            window = new RenderWindow(new VideoMode(1024, 768), "New Window");

            SceneManager.LoadStaticScene();

            if (gameOptions.ForceLimit)
            {
                window.SetFramerateLimit(60);
            }

            window.Closed += WindowClosed;

            RunLoop();
        }
Exemple #2
0
        /// <summary>
        /// Place all entity and system initialization here.
        /// </summary>
        protected virtual void Initialize()
        {
            foreach (GameExtension extension in extensions)
            {
                extension.Intitialize();

                foreach (Type systemType in extension.systems)
                {
                    ECSManager.AddSystem(systemType);
                }

                foreach (Type componentType in extension.components)
                {
                    ECSManager.AddComponent(componentType);
                }
            }

            InputManager.Initialize(window);
            ECSManager.Initialize();
        }