示例#1
0
        public RealtimeWorld(GameWindow window,
                             IAudioAdapter audioAdapter,
                             IGraphicsHost graphicsHost)
        {
            var graphics = graphicsHost.GetGraphicsAdapter();

            var audioSystem     = new AudioSystem(this, audioAdapter);
            var cameraSystem    = new CameraSystem(this, graphicsHost);
            var actorSystem     = new ActorSystem(this);
            var animationSystem = new AnimationSystem(this);

            // new up systems, order here will be order of update
            Systems.Add(new OpenTKInputSystem(this, window));
            Systems.Add(new BspSystem(this));
            Systems.Add(new PhysxPhysicsSystem(this));
            Systems.Add(new MoverSystem(this));
            Systems.Add(cameraSystem);
            Systems.Add(audioSystem);
            Systems.Add(actorSystem);
            Systems.Add(animationSystem);
            Systems.Add(new ScriptSystem(this, audioSystem, cameraSystem, actorSystem, animationSystem));
            Systems.Add(new RenderCollectorSystem(this, graphics));

            RenderSystems.Add(new RenderPipelineSystem(this, graphics));

            globalResources.Add(new RenderListStore());
            globalResources.Add(new InputStore());
        }
示例#2
0
        // Events
        // public static EventEmitter EE = new EventEmitter();

        // Rendering
        // public static WebGLContext GL;
        // public static IJSRuntime jsRuntime;

        // public World(IJSRuntime _jsRuntime) {
        //   jsRuntime = _jsRuntime;
        // }

        public static async Task Init(/* WebGLContext baseContext */)
        {
            // Initialize Canvas
            // GL = Shared.Engine.World.GL;

            // Initialize RenderSystems.
            RenderSystems.Init();

            // Intialize events.
            Events.Init();


            // Initialize game loop and render loop.
            //Task.Run(Update);
            //Task.Run(UpdateVM);
            // await RenderTest();
            await Task.Run(Rendering);
        }
        public override void Init()
        {
            foreach (var module in _modules)
            {
                module.Init();
            }


            foreach (var module in _modules)
            {
                ModuleInitSystems.AddRange(module.ModuleInitSystems);
                EntityInitSystems.AddRange(module.EntityInitSystems);
                PlaybackSystems.AddRange(module.PlaybackSystems);
                UserCmdExecuteSystems.AddRange(module.UserCmdExecuteSystems);


                ResourceLoadSystems.AddRange(module.ResourceLoadSystems);

                GameStateUpdateSystems.AddRange(module.GameStateUpdateSystems);

                PhysicsInitSystems.AddRange(module.PhysicsInitSystems);
                PhysicsUpdateSystems.AddRange(module.PhysicsUpdateSystems);
                PhysicsPostUpdateSystems.AddRange(module.PhysicsPostUpdateSystems);

                GizmosRenderSystems.AddRange(module.GizmosRenderSystems);
                RenderSystems.AddRange(module.RenderSystems);

                EntityCleanUpSystems.AddRange(module.EntityCleanUpSystems);

                LateUpdateSystems.AddRange(module.LateUpdateSystems);
                OnGUISystems.AddRange(module.OnGUISystems);
                GamePlaySystems.AddRange(module.GamePlaySystems);
                UiSystems.AddRange(module.UiSystems);
                UiHfrSystems.AddRange(module.UiHfrSystems);
                VehicleCmdExecuteSystems.AddRange(module.VehicleCmdExecuteSystems);
            }
        }