public void InvokeUpdate() { if (!MainServer.Connected || !GameServer.Connected) { MainServer.Disconnect(); GameServer.Disconnect(); CreateMasterCommunicator(); throw new Exception(Player.Name + " disconnected from main server."); } IEvent[] events = buffer.PopAll(); for (int i = 0; i < events.Length; ++i) { events[i].DoAction(); events[i].Dispose(); } Game.Update(); Update(); }
/// <summary> /// Logical updates occur here. /// </summary> public override void Update() { fps.Update(); // Chat input check: if (KeyPressHelper.IsPressed(Keys.Enter)) { if (input.AcceptEnter() && !ServiceManager.Game.Console.Visible && ServiceManager.Game.IsActive) { input.Visible = !input.Visible; if (input.Visible) { input.Focused = true; ChangeMovement(VTankObject.Direction.NONE); ChangeRotation(VTankObject.Direction.NONE); } else { DoChatMessage(input.GetText()); } } } //Menu press response block (Esc keypress by default) if (KeyPressHelper.IsPressed(ServiceManager.Game.Options.KeySettings.Menu)) { //rotating = true; // TODO: Show menu here. ServiceManager.DestroyTheaterCommunicator(); ServiceManager.Game.Renderer.ActiveScene.DeleteCamera(OverheadCamera); ServiceManager.Game.Renderer.ActiveScene.DeleteCamera(ChaseCamera); ServiceManager.Game.Renderer.ActiveScene.ClearAll(); ServiceManager.Game.SwitchToDefaultCamera(); input.Hide(); ServiceManager.StateManager.ChangeState(new TankListState()); return; } input.Update(); Chat.Update(); if (rotating) { // Check for chat messages. IEvent[] eventBuf = buffer.PopAll(); for (int i = 0; i < eventBuf.Length; ++i) { IEvent evt = eventBuf[i]; if (evt is Client.src.events.types.ChatMessageEvent) { evt.DoAction(); } } Scores.Enabled = true; cd.Update(); CheckForRotate(); //if (input.Visible) // input.Visible = false; return; } timeLeft -= ServiceManager.Game.DeltaTime; ServiceManager.Scene.PercentOfDayComplete = 0.6;//((4.5 * 60) - (timeLeft +2)) / (4.5 * 60); if (timeLeft <= 0) { RotateMap(); } // Process game events. IEvent[] events = buffer.PopAll(); for (int i = 0; i < events.Length; ++i) { events[i].DoAction(); } if (cameraLocked) { Camera overheadCamera = renderer.ActiveScene.AccessCamera(OverheadCamera); Camera chaseCamera = renderer.ActiveScene.AccessCamera(ChaseCamera); if (renderer.ActiveScene.CurrentCamera == chaseCamera) { ServiceManager.Game.Renderer.ActiveScene.CurrentCamera.LockTo( localPlayer, new Vector3(-500, 0, 200), new Vector3(0, 0, 75)); ServiceManager.Game.Renderer.ActiveScene.TransparentWalls = true; } else { ServiceManager.Game.Renderer.ActiveScene.CurrentCamera.Unlock(); ServiceManager.Game.Renderer.ActiveScene.TransparentWalls = false; } } Scene.Update(); RendererAssetPool.UniversalEffect.LightParameters.FogSeedPosition = localPlayer.Position; if (RendererAssetPool.ParticleEffect != null) { RendererAssetPool.ParticleEffect.Parameters["xFogSeedPosition"].SetValue(localPlayer.Position); } GraphicOptions.BackgroundColor = new Color(new Vector4(0.15f, 0.15f, 0.15f, 0f) * Scene.AmbientColor.ToVector4()); Projectiles.CheckCollisions(map, visibleTiles); if (!ServiceManager.Game.Console.Visible) { CheckInput(); if (rotating) { return; } CheckMouseInput(); } else { ChangeMovement(VTankObject.Direction.NONE); ChangeRotation(VTankObject.Direction.NONE); } // Update other components. tips.Update(); buffbar.Update(); mouseCursor.Update(); cd.Update(); hud.Update(); Bases.Update(); EnvironmentEffects.Update(); UpdateHUDValues(localPlayer); Projectiles.AddDelayedProjectiles(); ServiceManager.AudioManager.Update(localPlayer.Position); syncTimer += ServiceManager.Game.DeltaTime; if (syncTimer >= syncTimerMax) { if (localPlayer.DirectionMovement != VTankObject.Direction.NONE) { NeedsSync = true; } syncTimer = 0.0; } if (NeedsSync) { NeedsSync = false; Resync(); } }
public override void RotateMap(Ice.Current current__) { buffer.PopAll(); buffer.Push(new MapRotationEvent(bot)); }