public PlayerRotateEvent(GamePlayState _game, int id, double angle, VTankObject.Direction direction) : base(_game) { this.id = id; this.angle = angle; this.direction = direction; }
public LazerBeamManager(GamePlayState _game) : base() { game = _game; currentTime = 0; Technique = RendererAssetPool.UniversalEffect.Techniques.LazerBeam; }
public SetBaseHealthEvent(GameSession.Alliance color, int eventId, int health, GamePlayState _game) : base(_game) { this.baseColor = color; this.baseEventId = eventId; this.newBaseHealth = health; }
/// <summary> /// Unloads content. /// </summary> public override void UnloadContent() { if (thread.IsAlive) { try { thread.Interrupt(); } catch (Exception e) { ServiceManager.Game.Console.DebugPrint( "[ERROR] At LoadingScreenState#UnloadContent(): {0}", e.Message); } } if (futureGame != null) { ServiceManager.Game.BackgroundMovie.Pause(); ServiceManager.MP3Player.Stop(); ServiceManager.MP3Player.PlayPlaylist(); futureGame.OnGameFinished += new GamePlayState.GameFinishHandler(OnGameFinished); } currentMap = null; currentMapInstance = null; thread = null; server = null; form = null; futureGame = null; clientCallback = null; buffer = null; }
public FlagDroppedEvent(GamePlayState _game, int droppedId, VTankObject.Point where, GameSession.Alliance flagColor) : base(_game) { this.droppedId = droppedId; this.where = where; this.flagColor = flagColor; }
public AddUtilityEvent(GamePlayState _game, int _utilityID, VTankObject.Utility _utility, Vector3 _position) : base(_game) { utilityID = _utilityID; utility = _utility; position = _position; }
public SpawnEnvironmentEffectEvent(GamePlayState _game, int id, int typeId, VTankObject.Point location, int ownerId) : base(_game) { this.id = id; this.typeId = typeId; this.location = location; this.ownerId = ownerId; }
public PlayerMoveEvent(GamePlayState _game, int id, VTankObject.Point point, VTankObject.Direction direction) : base(_game) { this.id = id; this.direction = direction; this.point = point; }
public ApplyUtilityEvent(GamePlayState _game, int _utilityID, VTankObject.Utility _utility, int _playerID) : base(_game) { utilityID = _utilityID; utility = _utility; playerID = _playerID; }
public PlayerDamagedByEnvironmentEvent(GamePlayState _game, int playerId, int environId, int damageTaken, bool killingBlow) : base(_game) { this.playerId = playerId; this.environId = environId; this.damageTaken = damageTaken; this.killingBlow = killingBlow; }
public DamageBaseEvent(int eventId, int damageAmount, int playerId, int projectileId, bool isDestroyed, GamePlayState _game) : base(_game) { this.baseEventId = eventId; this.damageAmount = damageAmount; this.playerId = playerId; this.projectileId = projectileId; this.isDestroyed = isDestroyed; }
public BaseCapturedEvent(int eventId, GameSession.Alliance newBaseColor, int capturerId, GameSession.Alliance oldBaseColor, GamePlayState _game) : base(_game) { this.baseEventId = eventId; this.newBaseColor = newBaseColor; this.capturerId = capturerId; this.oldBaseColor = oldBaseColor; }
public CreateProjectileEvent(GamePlayState _game, int projectileTypeId, VTankObject.Point point, int ownerId, int projectileId) : base(_game) { this.projectileTypeId = projectileTypeId; this.point = point; this.ownerId = ownerId; this.projectileId = projectileId; }
public DamageBaseByEnvironmentEvent(GamePlayState _game, GameSession.Alliance baseColor, int baseId, int envId, int damage, bool isDestroyed) : base(_game) { this.baseColor = baseColor; this.baseId = baseId; this.environmentEffectId = envId; this.damage = damage; this.isDestroyed = isDestroyed; }
public PlayerDamagedEvent(GamePlayState _game, int victimId, int projectileId, int ownerId, int damageTaken, bool killingBlow) : base(_game) { this.victimId = victimId; this.projectileId = projectileId; this.ownerId = ownerId; this.damageTaken = damageTaken; this.killingBlow = killingBlow; }
/// <summary> /// The thread delegate which handles loading the game resources. /// </summary> private void Start() { State = LoadingState.LOADING; try { Value = 0; Message = "Cleaning up unused resources..."; CleanOldResources(); Value = 10; Message = "Establishing connection..."; ConnectToGameServer(); Value = 20; Message = "Loading map " + currentMap; GetCurrentMap(); Value = 30; Message = "Loading game resources..."; if (!LoadGameResources()) { // Causes the thread to exit without further issue. State = LoadingState.ERROR; throw new ThreadInterruptedException(); } Value = 100; Message = "Starting game..."; futureGame = new GamePlayState(clientCallback, currentMapInstance, buffer); clientCallback.Game = futureGame; State = LoadingState.READY; } catch (ThreadInterruptedException) { } catch (Exception ex) { ServiceManager.Game.Console.DebugPrint("{0}", ex); if (ex is Exceptions.VTankException) { Exceptions.VTankException realEx = (Exceptions.VTankException)ex; ErrorMessage = "Cannot connect:\n" + realEx.reason; } else { ErrorMessage = "Cannot connect:\n" + ex.Message; } State = LoadingState.ERROR; } }
public void SetMap(Map map, GamePlayState _state) { currentGameMode = _state.CurrentGameMode; flags = _state.Flags; utilities = _state.Utilities; bases = _state.Bases; try { GraphicsDevice device = Renderer.GraphicOptions.graphics.GraphicsDevice; PresentationParameters pp = device.PresentationParameters; renderTarget = new RenderTarget2D(device, (int)map.Width * miniMapScaleFactor + 2 * miniMapBorderBuffer, (int)map.Height * miniMapScaleFactor + 2 * miniMapBorderBuffer, 1, SurfaceFormat.Color, pp.MultiSampleType, pp.MultiSampleQuality, RenderTargetUsage.PreserveContents); DepthStencilBuffer previousDepth = device.DepthStencilBuffer; device.DepthStencilBuffer = null; device.SetRenderTarget(0, renderTarget); device.Clear(Color.Black); ServiceManager.Game.Batch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None); Texture2D miniMapDrawer = ServiceManager.Resources.GetTexture2D("textures\\misc\\MiniMap\\wallandbackground"); for (uint x = 0; x < map.Width; x++) { for (uint y = 0; y < map.Height; y++) { Tile tmpTile = map.GetTile(x, y); if (!tmpTile.IsPassable) ServiceManager.Game.Batch.Draw(miniMapDrawer, new Vector2(x * miniMapScaleFactor + miniMapBorderBuffer, y * miniMapScaleFactor + miniMapBorderBuffer), new Rectangle(0, 0, miniMapScaleFactor, miniMapScaleFactor), Color.White); } } ServiceManager.Game.Batch.End(); device.DepthStencilBuffer = previousDepth; device.SetRenderTarget(0, null); texture = renderTarget.GetTexture(); renderTarget = new RenderTarget2D(device, 235, 235, 1, SurfaceFormat.Color, pp.MultiSampleType, pp.MultiSampleQuality, RenderTargetUsage.PreserveContents); } catch (Exception ex) { Console.Error.WriteLine(ex); } }
public ResetAngleEvent(GamePlayState _game, double angle) : base(_game) { this.angle = angle; }
public RotateMapEvent(GamePlayState _game) : base(_game) { }
public ResetBasesEvent(GamePlayState _game, GameSession.Alliance winner) : base(_game) { this.winner = winner; }
public PlayerRespawnedEvent(GamePlayState _game, int id, VTankObject.Point where) : base(_game) { this.id = id; this.where = where; }
public FlagDespawnedEvent(GamePlayState _game, GameSession.Alliance flagColor) : base(_game) { this.flagColor = flagColor; }
/// <summary> /// Constructs an IEvent class. /// </summary> /// <param name="_game"></param> public IEvent(GamePlayState _game) { game = _game; }
public ResetPositionEvent(GamePlayState _game, VTankObject.Point position) : base(_game) { this.position = position; }
public PlayerLeftEvent(GamePlayState _game, int id, string name) : base(_game) { this.id = id; this.name = name; }
/// <summary> /// The thread delegate which handles loading the game resources. /// </summary> private void Start() { State = LoadingState.LOADING; try { Value = 0; Message = "Cleaning up unused resources..."; CleanOldResources(); Value = 10; Message = "Establishing connection..."; ConnectToGameServer(); Value = 20; Message = "Loading map " + currentMap; GetCurrentMap(); Value = 30; Message = "Loading game resources..."; if (!LoadGameResources()) { // Causes the thread to exit without further issue. State = LoadingState.ERROR; throw new ThreadInterruptedException(); } Value = 100; Message = "Starting game..."; futureGame = new GamePlayState(clientCallback, currentMapInstance, buffer); clientCallback.Game = futureGame; State = LoadingState.READY; } catch (ThreadInterruptedException) { } catch (Exception ex) { ServiceManager.Game.Console.DebugPrint("{0}", ex); if (ex is Exceptions.VTankException) { Exceptions.VTankException realEx = (Exceptions.VTankException)ex; ErrorMessage = "Cannot connect:\n" + realEx.reason; } else { ErrorMessage = "Cannot connect:\n" + ex.Message; } State = LoadingState.ERROR; } }
/// <summary> /// Unloads content. /// </summary> public override void UnloadContent() { if (thread.IsAlive) { try { thread.Interrupt(); } catch (Exception e) { ServiceManager.Game.Console.DebugPrint( "[ERROR] At LoadingScreenState#UnloadContent(): {0}", e.Message); } } if (futureGame != null) { ServiceManager.Game.BackgroundMovie.Pause(); ServiceManager.MP3Player.Stop(); ServiceManager.MP3Player.PlayPlaylist(); futureGame.OnGameFinished += new GamePlayState.GameFinishHandler(OnGameFinished); } currentMap = null; currentMapInstance = null; thread = null; server = null; form = null; futureGame = null; clientCallback = null; buffer = null; }
public FlagReturnedEvent(GamePlayState _game, int returnedById, GameSession.Alliance flagColor) : base(_game) { this.returnedById = returnedById; this.flagColor = flagColor; }
/// <summary> /// Start the game callback. This initially refuses messages until the Ready attribute /// is set to 'true'. /// </summary> /// <param name="_game"></param> public GameCallback(GamePlayState _game, EventBuffer _buffer) { game = _game; buffer = _buffer; ready = false; }
public PlayerJoinedEvent(GamePlayState _game, GameSession.Tank tank) : base(_game) { this.tank = tank; }
public DestroyProjectileEvent(GamePlayState _game, int projectileId) : base(_game) { this.projectileId = projectileId; }
public FlagSpawnedEvent(GamePlayState _game, VTankObject.Point where, GameSession.Alliance flagColor) : base(_game) { this.where = where; this.flagColor = flagColor; }