Exemplo n.º 1
0
 public PlayerRotateEvent(GamePlayState _game, int id, double angle, VTankObject.Direction direction)
     : base(_game)
 {
     this.id = id;
     this.angle = angle;
     this.direction = direction;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 4
0
        /// <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;
        }
Exemplo n.º 5
0
 public FlagDroppedEvent(GamePlayState _game, int droppedId, VTankObject.Point where, GameSession.Alliance flagColor)
     : base(_game)
 {
     this.droppedId = droppedId;
     this.where = where;
     this.flagColor = flagColor;
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 8
0
 public PlayerMoveEvent(GamePlayState _game, int id, VTankObject.Point point,
     VTankObject.Direction direction)
     : base(_game)
 {
     this.id = id;
     this.direction = direction;
     this.point = point;
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 15
0
 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;
 }
Exemplo n.º 16
0
        /// <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;
            }
        }
Exemplo n.º 17
0
        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);
            }
        }
Exemplo n.º 18
0
 public ResetAngleEvent(GamePlayState _game, double angle)
     : base(_game)
 {
     this.angle = angle;
 }
Exemplo n.º 19
0
 public RotateMapEvent(GamePlayState _game)
     : base(_game)
 {
 }
Exemplo n.º 20
0
 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;
 }
Exemplo n.º 22
0
 public FlagDespawnedEvent(GamePlayState _game, GameSession.Alliance flagColor)
     : base(_game)
 {
     this.flagColor = flagColor;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Constructs an IEvent class.
 /// </summary>
 /// <param name="_game"></param>
 public IEvent(GamePlayState _game)
 {
     game = _game;
 }
Exemplo n.º 24
0
 public ResetPositionEvent(GamePlayState _game, VTankObject.Point position)
     : base(_game)
 {
     this.position = position;
 }
Exemplo n.º 25
0
 public PlayerLeftEvent(GamePlayState _game, int id, string name)
     : base(_game)
 {
     this.id = id;
     this.name = name;
 }
Exemplo n.º 26
0
        /// <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;
            }
        }
Exemplo n.º 27
0
        /// <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;
        }
Exemplo n.º 28
0
 public FlagReturnedEvent(GamePlayState _game, int returnedById, GameSession.Alliance flagColor)
     : base(_game)
 {
     this.returnedById = returnedById;
     this.flagColor = flagColor;
 }
Exemplo n.º 29
0
 /// <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;
 }
Exemplo n.º 30
0
 public PlayerJoinedEvent(GamePlayState _game, GameSession.Tank tank)
     : base(_game)
 {
     this.tank = tank;
 }
 public DestroyProjectileEvent(GamePlayState _game, int projectileId)
     : base(_game)
 {
     this.projectileId = projectileId;
 }
Exemplo n.º 32
0
 public FlagSpawnedEvent(GamePlayState _game, VTankObject.Point where, GameSession.Alliance flagColor)
     : base(_game)
 {
     this.where = where;
     this.flagColor = flagColor;
 }