public StatsSender(AssaultWingCore game, int updateOrder) : base(game, updateOrder) { _connectTimer = new AWTimer(() => game.GameTime.TotalGameTime, TimeSpan.FromSeconds(5)) { SkipPastIntervals = true }; _sendTimer = new AWTimer(() => game.GameTime.TotalGameTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true }; _sendQueue = new StringBuilder(2048); }
public AssaultWingCore(GraphicsDeviceService graphicsDeviceService, CommandLineOptions args) : base(graphicsDeviceService) { Log.Write("Assault Wing version " + MiscHelper.Version); CommandLineOptions = args; Log.Write("Loading settings from " + MiscHelper.DataDirectory); Settings = AWSettings.FromFile(this, MiscHelper.DataDirectory); NetworkMode = NetworkMode.Standalone; InitializeComponents(); _standingsTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(1)); }
public AWGame(GraphicsDeviceService graphicsDeviceService) { GraphicsDeviceService = graphicsDeviceService; Services = new GameServiceContainer(); if (graphicsDeviceService != null) Services.AddService(typeof(IGraphicsDeviceService), graphicsDeviceService); Components = new AWGameComponentCollection(); GameTime = new AWGameTime(); _framerateTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true }; _frameDrawTimes = new RunningSequenceTimeSpan(TimeSpan.FromSeconds(1)); _frameDrawStopwatch = new Stopwatch(); }
public AssaultWing(GraphicsDeviceService graphicsDeviceService, CommandLineOptions args) : base(graphicsDeviceService, args) { CustomControls = new List<Tuple<Control, Action>>(); MessageHandlers = new Net.MessageHandling.MessageHandlers(this); if (CommandLineOptions.DedicatedServer) Logic = new DedicatedServerLogic(this); else if (CommandLineOptions.QuickStart != null) Logic = new QuickStartLogic(this, CommandLineOptions.QuickStart); else Logic = new UserControlledLogic(this); ArenaLoadTask = new BackgroundTask(); NetworkingErrors = new Queue<string>(); _gameSettingsSendTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(2)) { SkipPastIntervals = true }; _arenaStateSendTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(2)) { SkipPastIntervals = true }; _frameNumberSynchronizationTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true }; NetworkEngine = new NetworkEngine(this, 30); WebData = new WebData(this, 21); Components.Add(NetworkEngine); Components.Add(WebData); ChatStartControl = Settings.Controls.Chat.GetControl(); _frameStepControl = new KeyboardKey(Keys.F8); _frameRunControl = new KeyboardKey(Keys.F7); _frameStep = false; _debugPrintLagTimer = new AWTimer(() => GameTime.TotalRealTime, TimeSpan.FromSeconds(1)) { SkipPastIntervals = true }; DataEngine.SpectatorAdded += SpectatorAddedHandler; DataEngine.SpectatorRemoved += SpectatorRemovedHandler; NetworkEngine.Enabled = true; AW2.Graphics.PlayerViewport.CustomOverlayCreators.Add(viewport => new SystemStatusOverlay(viewport)); // Replace the dummy StatsBase by a proper StatsSender. Components.Remove(comp => comp is StatsBase); Stats = new StatsSender(this, 7); Components.Add(Stats); Stats.Enabled = true; }
public override void Activate() { base.Activate(); IsHiding = true; Body.LinearDamping = _movementDamping; Body.AngularDamping = _rotationDamping; _magnetArea = CollisionAreas.First(area => area.Name == "Magnet"); _spreadArea = CollisionAreas.First(area => area.Name == "Spread"); _potentialTargets = new HashSet<Gob>(); _potentialTargetsUpdateTimer = new AWTimer(() => Arena.TotalTime, TimeSpan.FromSeconds(0.5)); _potentialTargetsUpdateTimer.SetCurrentInterval(TimeSpan.Zero); // Do the first update immediately. }
public override void Activate() { base.Activate(); _thruster.Activate(this); _coughEngine.Activate(this); _deviceTypeNameUpdateTimer = new AWTimer(() => Game.GameTime.TotalGameTime, TimeSpan.FromSeconds(1.5)); IsNewborn = true; Game.SoundEngine.PlaySound(SHIP_BIRTH_SOUND, this); }
public override void Activate() { _spawnTimer = new AWTimer(() => Arena.TotalTime, TimeSpan.FromSeconds(_spawnInterval)) { SkipPastIntervals = false }; base.Activate(); }
public void Setup() { Time = TimeSpan.Zero; Timer = new AWTimer(GetTime, TimeSpan.FromSeconds(1)); }
public override void Activate() { base.Activate(); _nextHitTimer = new AWTimer(() => Arena.TotalTime, _hitInterval); _nextHitTimer.SetCurrentInterval(_firstHitDelay); _wallPunchPosesForClient = new List<Vector2>(); if (Host != null) GobHelper.CreatePengs(_surroundEffects, Host); InitializeCollisionAreas(); }
public NetworkEngine(AssaultWing game, int updateOrder) : base(game, updateOrder) { _game = game; GameClientConnections = new List<GameClientConnection>(); _removedClientConnections = new List<GameClientConnection>(); _udpMessagesToHandle = new ThreadSafeWrapper<List<Tuple<Message, IPEndPoint>>>(new List<Tuple<Message, IPEndPoint>>()); _managementServerConnectionCheckTimer = new AWTimer(() => _game.GameTime.TotalRealTime, TimeSpan.FromSeconds(10)) { SkipPastIntervals = true }; MessageHandlers = new List<MessageHandlerBase>(); InitializeUDPSocket(); }
private void InitializeWorld() { _world = PhysicsHelper.CreateWorld(_gravity, BoundedAreaExtreme.Min, BoundedAreaExtreme.Max); _world.ContactManager.PostSolve += PostSolveHandler; _world.ContactManager.BeginContact += BeginContactHandler; _areaBoundaryCheckTimer = new AWTimer(() => TotalTime, TimeSpan.FromSeconds(10)); }