Exemplo n.º 1
0
 protected override void TankPickup( Tank tank, TimeSpan gameTime )
 {
     if ( tank.PickupProjectile( this ) )
     {
         Game.RemoveEntity( this );
     }
 }
 protected override void TankPickup( Tank tank, TimeSpan gameTime )
 {
     if ( tank.PickupController( this, gameTime ) )
     {
         Game.RemoveEntity( this );
     }
 }
Exemplo n.º 3
0
 public Bullet( float Speed, Tank Owner, TimeSpan gameTime, int lifeTime )
     : base(Owner, gameTime)
 {
     this.Speed = Speed;
     Scale = 0.25F;
     Origin = new Vector2( 16, 16 );
     this.lifeTime = lifeTime;
 }
Exemplo n.º 4
0
 public HomingBullet( Tank Owner, float Speed, float TurnSpeed, TimeSpan gameTime, int NoticeTime, int lifeTime )
     : base(gameTime)
 {
     this.Speed = Speed;
     turnSpeed = TurnSpeed;
     noticeTime = NoticeTime;
     this.lifeTime = lifeTime;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new Fence entity.
 /// </summary>
 /// <param name="point1">The first endpoint of the fence.</param>
 /// <param name="point2">The second endpoint of the fence.</param>
 /// <param name="owner">The owning tank (currently for color only).</param>
 /// <param name="thickness">The thickness of the fence.</param>
 /// <param name="gameTime">The current game time.</param>
 /// <param name="lifetime">The amount of time the fence stays on the board in milliseconds. -1 is infinity.</param>
 public Fence( Vector2 point1, Vector2 point2, Tank owner, float thickness, TimeSpan gameTime, int lifetime )
 {
     this.owner = owner;
     Angle = MathHelper.ToDegrees( ( float )Math.Atan2( point2.Y - point1.Y, point2.X - point1.X ) );
     height = ( int )thickness;
     width = ( int )Vector2.Distance( point1, point2 );
     Origin = new Vector2( ( int )( width / 2 ), ( int )( height / 2 ) );
     Position = ( point1 + point2 ) / 2;
     Scale = 1;
     spawnTime = gameTime;
     lifeTime = lifetime;
 }
Exemplo n.º 6
0
 public TankController( int LifeTime )
 {
     this.Owner = Tank.blank;
     lifeTime = LifeTime;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            NumOfPlayers = LoadSetting( "Players", 2 );
            CurrentID = -NumOfPlayers;
            WaitMillisecs = LoadSetting( "EndingDelay", 3000 );
            FreezeMillisecs = LoadSetting( "FreezeTime", 1000 );
            SpawnMillisecs = LoadSetting( "PickupTime", 5000 );
            PickupLifetime = LoadSetting( "PickupLifeTime", 10000 );

            LoadSetting( "BlastRadius", 10.0F );

            KeySet p1keys = LoadSetting( "Player1Keys", new KeySet( Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.Z, Keys.X ) );
            KeySet p2keys = LoadSetting( "Player2Keys", new KeySet( Keys.W, Keys.S, Keys.A, Keys.D, Keys.Q, Keys.E ) );
            KeySet p3keys = LoadSetting( "Player3Keys", new KeySet( Keys.T, Keys.G, Keys.F, Keys.H, Keys.V, Keys.B ) );
            KeySet p4keys = LoadSetting( "Player4Keys", new KeySet( Keys.NumPad5, Keys.NumPad2, Keys.NumPad1, Keys.NumPad3, Keys.NumPad7, Keys.NumPad8 ) );

            Colors p1Color = LoadSetting( "Player1Color", Colors.Green );
            Colors p2Color = LoadSetting( "Player2Color", Colors.Purple );
            Colors p3Color = LoadSetting( "Player3Color", Colors.Blue );
            Colors p4Color = LoadSetting( "Player4Color", Colors.Orange );

            bool p1AI = LoadSetting( "Player1AI", false );
            bool p2AI = LoadSetting( "Player2AI", false );
            bool p3AI = LoadSetting( "Player3AI", false );
            bool p4AI = LoadSetting( "Player4AI", false );

            int ProjectileTime = LoadSetting( "ProjectileTime", 10000 );
            int ProjectileSpeed = LoadSetting( "ProjectileSpeed", 10 );
            int ControllerTime = LoadSetting( "ControllerTime", 10000 );
            int FenceTime = LoadSetting( "FenceTime", 10000 );
            int TankSpeed = LoadSetting( "TankSpeed", 5 );
            int BulletLifeTime = LoadPositiveSetting( "BulletLifeTime", ProjectileTime );

            float TankScale = LoadSetting( "TankScale", 2F );

            defaultBullet = new Bullet( LoadPositiveSetting( "BulletSpeed", ProjectileSpeed ), Tank.blank, TimeSpan.Zero, BulletLifeTime );

            int FenceLimit = LoadSetting( "FenceLimit", 10 );
            int ProjectileLimit = LoadSetting( "ProjectileLimit", 3 );

            LoadSetting( "ShockwaveRadius", 200.0F );

            LoadSetting( "SuddenDeathTime", 10000 );

            // Shows mouse
            IsMouseVisible = true;

            MasterControllers = new HashSet<GameController>();
            ScheduledTasks = new HashSet<Tuple<TimeSpan, int, Action>>();
            Entities = new HashSet<GameEntity>();

            // Player 1
            p1 = new Tank( "Player 1", new Vector2( 50, 50 ), 45, p1keys, p1Color, TankSpeed, defaultBullet, ProjectileLimit, FenceLimit, FenceTime, TankScale, p1AI, PlayerIndex.One );
            Entities.Add( p1 );

            // Player 2
            p2 = new Tank( "Player 2", new Vector2( ScreenWidth - 50, ScreenHeight - 50 ), 225, p2keys, p2Color, TankSpeed, defaultBullet, ProjectileLimit, FenceLimit, FenceTime, TankScale, p2AI, PlayerIndex.Two );
            Entities.Add( p2 );

            if ( NumOfPlayers >= 3 )
            {
                Entities.Add( new Tank( "Player 3", new Vector2( ScreenWidth - 50, 50 ), 135, p3keys, p3Color, TankSpeed, defaultBullet, ProjectileLimit, FenceLimit, FenceTime, TankScale, p3AI, PlayerIndex.Three ) );
            }

            if ( NumOfPlayers >= 4 )
            {
                Entities.Add( new Tank( "Player 4", new Vector2( 50, ScreenHeight - 50 ), 315, p4keys, p4Color, TankSpeed, defaultBullet, ProjectileLimit, FenceLimit, FenceTime, TankScale, p4AI, PlayerIndex.Four ) );
            }

            foreach ( GameEntity entity in Entities )
            {
                entity.Initialize( this );
            }

            AvailableProjectiles = new Projectile[]
            {
                new HomingBullet( LoadPositiveSetting( "HomingBulletSpeed", ProjectileSpeed ), LoadPositiveSetting( "HomingBulletTurnSpeed", 5 ), TimeSpan.Zero, LoadPositiveSetting( "HomingBulletNoticeTime", 1000 ), LoadPositiveSetting( "HomingBulletTime", ProjectileTime ) ),
                new Missile( LoadPositiveSetting( "MissileSpeed", ProjectileSpeed ) ),
                new Lazer( LoadPositiveSetting( "LazerTime", ProjectileTime ), LoadPositiveSetting( "LazerSpeed", 100 ), LoadPositiveSetting( "LazerTrail", 200 ) ),
                new Rider( LoadPositiveSetting( "RiderSpeed", ProjectileSpeed ), LoadPositiveSetting( "RiderTime", ProjectileTime ),LoadSetting("RiderDeath").ToLower() == "true", LoadPositiveSetting( "RiderTwist", 1 ) ),
            };

            AvailableControllers = new TankController[]
            {
                new Ghost( LoadPositiveSetting( "GhostTime", ControllerTime ) ),
                new Deflector(),
                new SpeedBoost(LoadPositiveSetting( "SpeedBoostTime", ControllerTime ), LoadSetting( "SpeedBoostFactor", 2F ) ),
                new Minimize( LoadPositiveSetting( "MinimizeTime", ControllerTime ) ),
                new Switcher(),
                new ForceField( LoadPositiveSetting( "ForceFieldTime", ControllerTime ) ),
                new Tripler( LoadPositiveSetting( "TriplerTime", ControllerTime ) ),
                new ExtraLife(),
                new Shockwave(),
                new Roulette(),
                new MindController( LoadPositiveSetting( "MindControlTime", ControllerTime ) ),
                new IronDome( LoadPositiveSetting( "IronDomeTime", ControllerTime ), LoadPositiveSetting( "IronLifeTime", 2000 ), LoadPositiveSetting( "IronSpeed", 10 ), LoadPositiveSetting( "IronRadius", 200 ), LoadPositiveSetting( "IronProbability", 90 ) ),
                new Disabler( LoadPositiveSetting( "MaxDisablerSpeed", 50 ) ),
                new Minigun( LoadPositiveSetting( "MinigunTime", ControllerTime ), LoadPositiveSetting( "MinigunSpeed", 500 ) ),
                new Ring( LoadPositiveSetting( "RingRadius", 50 ) ),
                new Shuffler(),
                new Hypnotizer( LoadPositiveSetting( "HypnotizerTime", ControllerTime ), LoadPositiveSetting( "HypnoRadius", 200 ) ),
                new Aimbot(),
                new Dodger( LoadPositiveSetting( "DodgerTime", ControllerTime ) ),
            };

            AvailableConEnts = new ControllerEntity[]
            {
                new Portal( LoadPositiveSetting( "PortalTime", ControllerTime ) ),
                new BlackHole(),
                //new Concealer( LoadPositiveSetting( "ConcealerTime", ControllerTime ) ),
            };

            SuddenDeaths = new GameController[]
            {
                //new ShrinkyDeath(),
                new Orbit( LoadSetting( "OrbitBaseSpeed", 20F ), LoadSetting( "OrbitMaxSpeed", 60F ), LoadSetting( "OrbitMinSpeed", 1F ), LoadSetting( "OrbitAccleration", -0.5F ), LoadSetting( "OrbitSpiralFactor", 19F ) ),
            };

            QueueSuddenDeath();

            base.Initialize();
        }
Exemplo n.º 8
0
 public Rider( Tank Owner )
     : this()
 {
     this.owner = Owner;
     ControllerIsTripler = owner.Controller is Tripler;
 }
Exemplo n.º 9
0
 public override void Initialize( TanksDrop game, TimeSpan gameTime, Tank owner )
 {
     owner.AppendController( Controller );
     Position = owner.Position;
     ControllerIsTripler = owner.Controller is Tripler;
     isDead = false;
     base.Initialize( game, gameTime, owner );
 }
Exemplo n.º 10
0
 public virtual void Initialize( TanksDrop game, Tank Owner )
 {
     this.Owner = Owner;
     Initialize( game );
 }
Exemplo n.º 11
0
 public MissileController( Tank owner, Missile missile, Keys keyShoot )
 {
     this.owner = owner;
     this.missile = missile;
     this.shoot = keyShoot;
     this.prevKeyState = new KeyboardState( keyShoot );
     this.conCount = 0;
 }
Exemplo n.º 12
0
 public Projectile( Tank Owner )
 {
     owner = Owner;
     doesCountAsTankProjectile = true;
 }
Exemplo n.º 13
0
 public Lazer( Tank Owner, TimeSpan gameTime )
     : base(Owner, gameTime)
 {
 }
Exemplo n.º 14
0
 public Lazer( Tank Owner )
     : base(Owner)
 {
     this.Speed = 100;
     this.Trail = 200;
 }
Exemplo n.º 15
0
 public LazerHelper( Vector2 Position, float Angle, TanksDrop Game, Tank Owner )
     : base(Owner)
 {
     this.Position = Position;
     this.Angle = Angle;
     Initialize( Game );
     LoadContent( Game.Content, Game.ScreenWidth, Game.ScreenHeight );
     this.Destroyed = false;
     this.lifeTime = lifeTime;
 }
Exemplo n.º 16
0
 public override void Initialize( TanksDrop game, TimeSpan gameTime, Tank owner )
 {
     keyShoot = owner.Keys.KeyShoot;
     con = new MissileController( owner, this, keyShoot );
     owner.Keys.KeyShoot = Keys.None;
     owner.AppendController( con );
     base.Initialize( game, gameTime, owner );
 }
Exemplo n.º 17
0
 public Missile( Tank Owner, float speed )
     : base(Owner)
 {
     this.Speed = speed;
     this.lifeTime = -1;
 }
Exemplo n.º 18
0
 public Projectile( Tank Owner, TimeSpan gameTime )
     : this(Owner)
 {
     spawnTime = gameTime;
 }
Exemplo n.º 19
0
 public virtual void Initialize( TanksDrop game, Tank Owner, TimeSpan spawnTime )
 {
     this.spawnTime = spawnTime;
     Initialize( game, Owner );
 }
Exemplo n.º 20
0
 public virtual void Initialize( TanksDrop game, TimeSpan gameTime, Tank owner )
 {
     this.owner = owner;
     Initialize( game, gameTime );
 }
Exemplo n.º 21
0
 /// <summary>
 /// Happens when a tank collides with the pickup.
 /// </summary>
 /// <param name="tank">The tank that collided.</param>
 /// <remarks>Used to have the tank get the pickup.</remarks>
 protected abstract void TankPickup( Tank tank, TimeSpan gameTime );