Пример #1
0
        public override void Update(UpdateState state)
        {
            base.Update(state);
            if (TempVM == null && GUID != 0)
            {
                var world = new ExternalWorld(GameFacade.GraphicsDevice);
                world.Initialize(GameFacade.Scenes);
                var context = new VMContext(world);

                TempVM = new VM(context, new VMServerDriver(new VMTSOGlobalLinkStub()), new VMNullHeadlineProvider());
                TempVM.Init();

                var blueprint = new Blueprint(32, 32);
                blueprint.Light = new RoomLighting[]
                {
                    new RoomLighting()
                    {
                        OutsideLight = 100
                    },
                    new RoomLighting()
                    {
                        OutsideLight = 100
                    },
                    new RoomLighting()
                    {
                        OutsideLight = 100
                    },
                };
                blueprint.OutsideColor = Color.White;
                blueprint.GenerateRoomLights();
                blueprint.RoomColors[2].A /= 2;
                world.State.AmbientLight.SetData(blueprint.RoomColors);

                world.InitBlueprint(blueprint);
                context.Blueprint    = blueprint;
                context.Architecture = new VMArchitecture(1, 1, blueprint, TempVM.Context);
            }

            if (GUID != oldGUID)
            {
                SetGUIDLocal(GUID, TempVM);
                state.SharedData["ExternalDraw"] = true;
            }

            if (ForceRedraw)
            {
                state.SharedData["ExternalDraw"] = true;
                ForceRedraw = false;
            }

            if (TempVM != null)
            {
                TempVM.Update();
            }
        }
Пример #2
0
        public override void Update(UpdateState state)
        {
            base.Update(state);
            if (TempVM == null && GUID != 0)
            {
                var world = new ExternalWorld(GameFacade.GraphicsDevice);
                world.Initialize(GameFacade.Scenes);
                var context = new VMContext(world);

                TempVM = new VM(context, new VMServerDriver(37565), new VMNullHeadlineProvider());
                TempVM.Init();

                var blueprint = new Blueprint(1, 1);
                world.InitBlueprint(blueprint);
                context.Blueprint    = blueprint;
                context.Architecture = new VMArchitecture(1, 1, blueprint, TempVM.Context);
            }

            if (GUID != oldGUID)
            {
                SetGUIDLocal(GUID);
                state.SharedData["ExternalDraw"] = true;
            }
        }
Пример #3
0
        public override void Update(UpdateState state)
        {
            base.Update(state);
            if (TempVM == null && GUID != 0)
            {
                var world = new ExternalWorld(GameFacade.GraphicsDevice);
                world.Initialize(GameFacade.Scenes);
                var context = new VMContext(world);

                TempVM = new VM(context, new VMServerDriver(new VMTSOGlobalLinkStub()), new VMNullHeadlineProvider());
                TempVM.Init();

                var blueprint = new Blueprint(1, 1);
                blueprint.Light = new RoomLighting[]
                {
                    new RoomLighting()
                    {
                        OutsideLight = 100
                    },
                    new RoomLighting()
                    {
                        OutsideLight = 100
                    },
                    new RoomLighting()
                    {
                        OutsideLight = 100
                    },
                };
                blueprint.OutsideColor = Color.White;
                blueprint.GenerateRoomLights();
                blueprint.RoomColors[2].A /= 2;
                world.State.AmbientLight.SetData(blueprint.RoomColors);
                world.State.OutsidePx.SetData(new Color[] { Color.White });

                world.InitBlueprint(blueprint);
                context.Blueprint    = blueprint;
                context.Architecture = new VMArchitecture(1, 1, blueprint, TempVM.Context);
            }

            if (GUID != oldGUID)
            {
                SetGUIDLocal(GUID, TempVM);
                state.SharedData["ExternalDraw"] = true;
            }

            if (ForceRedraw)
            {
                state.SharedData["ExternalDraw"] = true;
                ForceRedraw = false;
            }

            if (TempVM != null)
            {
                var lcount = TempVM.Scheduler.CurrentTickID;
                TempVM.Update();
                var count = TempVM.Scheduler.CurrentTickID;
                foreach (var ent in TempVM.Entities)
                {
                    if (ent is VMAvatar)
                    {
                        for (uint i = lcount; i < count; i++)
                        {
                            ent.Tick();
                        }
                    }
                }
                TempVM.PreDraw();
            }
        }