Ejemplo n.º 1
0
 public Inventory(TankGame game)
     : base(game)
 {
     heavyShot       = 1;
     scatterShot     = 1;
     missileDropShot = 1;
 }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     using (TankGame game = new TankGame())
     {
         game.Run();
     }
 }
Ejemplo n.º 3
0
 public PowerUp(TankGame game, Vector2 pos, String type)
     : base(game)
 {
     this.game = game;
     this.powerUpPosition = pos;
     powerUpPic = Game.Content.Load<Texture2D>(@type);
 }
Ejemplo n.º 4
0
 public PowerUp(TankGame game, Vector2 pos, String type)
     : base(game)
 {
     this.game            = game;
     this.powerUpPosition = pos;
     powerUpPic           = Game.Content.Load <Texture2D>(@type);
 }
Ejemplo n.º 5
0
 public StartScreen(TankGame game, String type)
     : base(game)
 {
     blink      = true;
     spriteFont = Game.Content.Load <SpriteFont>(@type);
     addToTitleList();
 }
Ejemplo n.º 6
0
        public bool scanTarget()
        {
            detectionCircle = new Circle(position, sensorDistance);

            if (TankGame.CircleRectangleIntersection(detectionCircle, tankCollisionRectangle))
            {
                missile = new Missile(game, new Vector2(tankPosition.X + missileOffset));
                Game.Components.Add(missile);

                target = new TargetLocked(game, new Vector2(tankPosition.X + tankSize.X / 2, tankPosition.Y + tankSize.Y / 2));
                target.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

                target.UpdateOrder = 100;
                target.DrawOrder   = 100;
                target.Visible     = true;

                targetLockedOn = true;
            }
            else
            {
                targetLockedOn = false;
            }

            bulletCollided();

            return(targetLockedOn);
        }
Ejemplo n.º 7
0
 public DetectionWheel(TankGame cGame, Vector2 newPosition, string detectionWheel, float rotationSpeed)
     : base(cGame)
 {
     position            = new Vector3(newPosition.X, newPosition.Y, 0);
     this.detectionWheel = detectionWheel;
     this.rotationSpeed  = rotationSpeed;
 }
Ejemplo n.º 8
0
 public DetectionWheel(TankGame cGame, Vector2 newPosition, string detectionWheel, float rotationSpeed)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
     this.detectionWheel = detectionWheel;
     this.rotationSpeed = rotationSpeed;
 }
Ejemplo n.º 9
0
        public override void InitializeParticleProperties(DefaultSpriteParticle cParticle)
        {
            cParticle.Lifetime = DPSFHelper.RandomNumberBetween(.5f, 1);

            cParticle.Position = Emitter.PositionData.Position;

            float randomVelocity = DPSFHelper.RandomNumberBetween(-200, 200);

            currentRotation += (float)Math.PI / 20;
            Vector2 rotatedRandomVector = TankGame.rotateVector(new Vector2(randomVelocity, randomVelocity), currentRotation);

            cParticle.Velocity = new Vector3(rotatedRandomVector.X, rotatedRandomVector.Y, 0);

            cParticle.Width  = DPSFHelper.RandomNumberBetween(2, 6);
            cParticle.Height = DPSFHelper.RandomNumberBetween(2, 12);

            cParticle.Rotation = currentRotation;

            //Vector3 sVelocityMin = new Vector3(-100, 25, -100);
            //Vector3 sVelocityMax = new Vector3(100, 50, 100);
            //cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(sVelocityMin, sVelocityMax);

            //cParticle.Velocity = Vector3.Transform(cParticle.Velocity, Emitter.OrientationData.Orientation);

            cParticle.StartColor = startColor;
            cParticle.EndColor   = endColor;
        }
Ejemplo n.º 10
0
 public StartScreen(TankGame game, String type)
     : base(game)
 {
     blink = true;
     spriteFont = Game.Content.Load<SpriteFont>(@type);
     addToTitleList();
 }
Ejemplo n.º 11
0
 public Inventory(TankGame game)
     : base(game)
 {
     heavyShot = 1;
     scatterShot = 1;
     missileDropShot = 1;
 }
Ejemplo n.º 12
0
 public SmokeCloud(TankGame cGame, Vector2 newPosition, int maxParticles, int particlesPerSecond, Color cloudColor)
     : base(cGame)
 {
     position                = new Vector3(newPosition.X, newPosition.Y, 0);
     this.maxParticles       = maxParticles;
     this.particlesPerSecond = particlesPerSecond;
     this.cloudColor         = cloudColor;
 }
Ejemplo n.º 13
0
        public void UpdateParticleVelocity(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            currentRotation += (float)Math.PI / 4;

            Vector2 rotatedRandomVector = TankGame.rotateVector(originalVector, currentRotation);

            cParticle.Velocity = new Vector3(rotatedRandomVector.X * 800, rotatedRandomVector.Y * 800, 0);
        }
Ejemplo n.º 14
0
 public SmokeCloud(TankGame cGame, Vector2 newPosition, int maxParticles, int particlesPerSecond, Color cloudColor)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
     this.maxParticles = maxParticles;
     this.particlesPerSecond = particlesPerSecond;
     this.cloudColor = cloudColor;
 }
Ejemplo n.º 15
0
 public Puff(TankGame cGame, Vector2 newPosition, Vector2 newDirection, float power)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
     direction = new Vector3(newDirection.X, newDirection.Y, 0);
     this.power = power;
     maxParticles = (int)power;
 }
Ejemplo n.º 16
0
 public Spark(TankGame cGame, Vector2 position, int maxParticles, float lifeTime)
     : base(cGame)
 {
     offsetX           = DPSFHelper.RandomNumberBetween(-20, 20);
     offsetY           = DPSFHelper.RandomNumberBetween(-20, 20);
     this.position     = new Vector3(position.X + offsetX, position.Y + offsetY, 0);
     this.maxParticles = maxParticles;
     this.lifeTime     = lifeTime;
 }
Ejemplo n.º 17
0
 public Spark(TankGame cGame, Vector2 position, int maxParticles, float lifeTime)
     : base(cGame)
 {
     offsetX = DPSFHelper.RandomNumberBetween(-20, 20);
     offsetY = DPSFHelper.RandomNumberBetween(-20, 20);
     this.position = new Vector3(position.X + offsetX, position.Y + offsetY, 0);
     this.maxParticles = maxParticles;
     this.lifeTime = lifeTime;
 }
Ejemplo n.º 18
0
        public Bullet(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.BasicBullet;

            damage = 50;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 19
0
        public Shots(TankGame game, Vector2 bulletPosition, Vector2 scatterDirection)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.ScatterShot;
            
            damage = 20;
            mass = .75f;

            angle = 0;
            speed = scatterDirection;
        }
Ejemplo n.º 20
0
        public Bullet(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.BasicBullet;

            damage = 50;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 21
0
        public HeavyShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.HeavyShot;

            damage = 75;
            mass = 2.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 22
0
        public Shots(TankGame game, Vector2 bulletPosition, Vector2 scatterDirection)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.ScatterShot;

            damage = 20;
            mass   = .75f;

            angle = 0;
            speed = scatterDirection;
        }
Ejemplo n.º 23
0
        public HeavyShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.HeavyShot;

            damage = 75;
            mass   = 2.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 24
0
        public Missle(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = new Vector2(bulletPosition.X, 0);

            this.type = BulletType.Missile;

            damage = 60;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 25
0
        public Missle(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = new Vector2(bulletPosition.X, 0);

            this.type = BulletType.Missile;

            damage = 60;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 26
0
        public MissleDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game); 

            this.position = bulletPosition;
            this.type = BulletType.MissileDrop;

            damage = 20;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 27
0
        public MissleDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game);

            this.position = bulletPosition;
            this.type     = BulletType.MissileDrop;

            damage = 20;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Ejemplo n.º 28
0
        public MissileDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.game = game;

            this.position = bulletPosition;
            this.type     = BulletType.MissileDrop;

            damage = 10;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            detect = new List <DetectionWheel>();
        }
Ejemplo n.º 29
0
        public MissileDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.game = game;

            this.position = bulletPosition;
            this.type = BulletType.MissileDrop;

            damage = 10;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            detect = new List<DetectionWheel>();
        }
Ejemplo n.º 30
0
        public TeleportShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.TeleportShot;

            damage = 10;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            trail = new TeleportTrail(game, this.position);
            trail.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

            trail.UpdateOrder = 100;
            trail.DrawOrder   = 100;
            trail.Visible     = true;
        }
Ejemplo n.º 31
0
        public TeleportShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.TeleportShot;

            damage = 10;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            trail = new TeleportTrail(game, this.position);
            trail.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

            trail.UpdateOrder = 100;
            trail.DrawOrder = 100;
            trail.Visible = true;
        }
Ejemplo n.º 32
0
        public override void InitializeParticleProperties(DefaultSpriteParticle cParticle)
        {
            cParticle.Lifetime = DPSFHelper.RandomNumberBetween(.1f, lifeTime / 2);

            cParticle.Position = Emitter.PositionData.Position;

            currentRotation += (float)Math.PI / 10;
            Vector2 rotatedRandomVector = TankGame.rotateVector(originalVector, currentRotation);

            cParticle.Velocity = new Vector3(rotatedRandomVector.X * 60, rotatedRandomVector.Y * 60, 0);

            cParticle.Size = DPSFHelper.RandomNumberBetween(1, 4);

            cParticle.Rotation = currentRotation;

            cParticle.StartColor = Color.Yellow;
            cParticle.EndColor   = Color.Red;

            cParticle.Friction = DPSFHelper.RandomNumberBetween(50, 200);
        }
Ejemplo n.º 33
0
        public ScatterShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game);

            this.position = bulletPosition;
            this.type = BulletType.ScatterShot;

            angle = 0;

            scatterAngle = 0;

            damage = 20;
            mass = .75f;

            bulletDirection = new Vector2(1, 0);

            speed = Vector2.Zero;

            scatterShots = new List<Shots>();
        }
Ejemplo n.º 34
0
        public Tank(TankGame game, Vector2 tankPosition, float turretAngle)
            : base(game)
        {
            this.game               = game;
            this.tankPosition       = tankPosition;
            turretPosition          = new Vector2(tankPosition.X + 40, tankPosition.Y + 25);
            this.turretAngle        = turretAngle;
            health                  = 200;
            turnTime                = 0;
            moveLimit               = 0;
            originalTurretDirection = new Vector2(0, 1);
            turretDirection         = new Vector2((float)(Math.Cos(-turretAngle) * originalTurretDirection.X - Math.Sin(-turretAngle) * originalTurretDirection.Y),
                                                  (float)(Math.Sin(-turretAngle) * originalTurretDirection.X + Math.Cos(-turretAngle) * originalTurretDirection.Y));
            bullet       = new Bullet(game);
            type         = BulletType.BasicBullet;
            inventory    = new Inventory(game);
            damageClouds = null;
            timer        = 0.0f;

            currentTankState = TankState.Normal;
        }
Ejemplo n.º 35
0
        public ScatterShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game);

            this.position = bulletPosition;
            this.type     = BulletType.ScatterShot;

            angle = 0;

            scatterAngle = 0;

            damage = 20;
            mass   = .75f;

            bulletDirection = new Vector2(1, 0);

            speed = Vector2.Zero;

            scatterShots = new List <Shots>();
        }
Ejemplo n.º 36
0
        public Fireworks(TankGame cGame, Vector2 position)
            : base(cGame)
        {
            this.position = new Vector3(position.X, position.Y, 0);

            switch ((int)DPSFHelper.RandomNumberBetween(0, 3))
            {
            case 0:
                startColor = Color.Yellow;
                endColor   = Color.DarkRed;
                break;

            case 1:
                startColor = Color.LightCyan;
                endColor   = Color.Green;
                break;

            case 2:
                startColor = Color.LightBlue;
                endColor   = Color.DarkBlue;
                break;
            }
        }
Ejemplo n.º 37
0
        public void scatter()
        {
            if (scatterTime >= 1)
            {
                damage = 10;

                for (int i = 0; i < 8; i++)
                {
                    scatterDirection = TankGame.rotateVector(bulletDirection, scatterAngle);

                    scatterShots.Add(new Shots((TankGame)Game, this.position,
                                               scatterDirection * new Vector2(TankGame.GRAVITY * 10 + .25f, -TankGame.GRAVITY * 10 - .25f)));

                    scatterAngle += (float)Math.PI / 7;

                    Game.Components.Add(scatterShots[i]);
                }

                if (position.Y < 200)
                {
                    speed = new Vector2(0, TankGame.GRAVITY * mass * 40);
                }
                else if (position.Y < 800)
                {
                    speed = new Vector2(0, TankGame.GRAVITY * mass * 20);
                }
                else
                {
                    speed = Vector2.Zero;
                }

                scattered = true;

                bulletCollided();
            }
        }
Ejemplo n.º 38
0
        public Fireworks(TankGame cGame, Vector2 position)
            : base(cGame)
        {
            this.position = new Vector3(position.X, position.Y, 0);

            switch ((int)DPSFHelper.RandomNumberBetween(0, 3))
            {
                case 0:
                    startColor = Color.Yellow;
                    endColor = Color.DarkRed;
                    break;

                case 1:
                    startColor = Color.LightCyan;
                    endColor = Color.Green;
                    break;

                case 2:
                    startColor = Color.LightBlue;
                    endColor = Color.DarkBlue;
                    break;

            }
        }
Ejemplo n.º 39
0
 public MoveHintScreen(TankGame game)
     : base(game)
 { }
Ejemplo n.º 40
0
 public GameOverScreen(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Ejemplo n.º 41
0
 public ScreenManager(TankGame game)
     : base(game)
 {  }
Ejemplo n.º 42
0
 public ShootHintScreen(TankGame game)
     : base(game)
 {
 }
Ejemplo n.º 43
0
 public ConfettiDrop(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Ejemplo n.º 44
0
 public Bullet(TankGame game)
     : base(game)
 {
     type = BulletType.NullBullet;
 }
Ejemplo n.º 45
0
 public ConfettiDrop(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Ejemplo n.º 46
0
 public DirtTrail(TankGame cGame, Vector2 newPosition, Vector2 newDirection)
     : base(cGame)
 {
     position  = new Vector3(newPosition.X, newPosition.Y, 0);
     direction = new Vector3(newDirection.X, newDirection.Y, 0);
 }
Ejemplo n.º 47
0
 public GameOverScreen(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Ejemplo n.º 48
0
 public TeleportBlast(TankGame cGame, Vector2 newPosition)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
 }
Ejemplo n.º 49
0
 public Tanksplosion(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Ejemplo n.º 50
0
 public PowerUpHint(TankGame game)
     : base(game)
 { }
Ejemplo n.º 51
0
 public HealthPack(TankGame game, SpriteBatch batch)
     : base(game)
 {
     batcher         = batch;
     healthPackImage = Game.Content.Load <Texture2D>(@"Images/HealthPackTexture");
 }
Ejemplo n.º 52
0
 public TeleportTrail(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Ejemplo n.º 53
0
 public BasicBlast(TankGame cGame, Vector2 position) : base(cGame) 
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Ejemplo n.º 54
0
 public Background(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Ejemplo n.º 55
0
 public PowerUpManager(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Ejemplo n.º 56
0
 public Flare(TankGame cGame, Vector2 newPosition)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
 }
Ejemplo n.º 57
0
        public Tank(TankGame game, Vector2 tankPosition, float turretAngle)
            : base(game)
        { 
            this.game = game;
            this.tankPosition = tankPosition;
            turretPosition = new Vector2(tankPosition.X + 40, tankPosition.Y + 25);
            this.turretAngle = turretAngle;
            health = 200;
            turnTime = 0;
            moveLimit = 0;
            originalTurretDirection = new Vector2(0, 1);
            turretDirection = new Vector2((float)(Math.Cos(-turretAngle) * originalTurretDirection.X - Math.Sin(-turretAngle) * originalTurretDirection.Y),
                (float)(Math.Sin(-turretAngle) * originalTurretDirection.X + Math.Cos(-turretAngle) * originalTurretDirection.Y));
            bullet = new Bullet(game);
            type = BulletType.BasicBullet;
            inventory = new Inventory(game);
            damageClouds = null;
            timer = 0.0f;

            currentTankState = TankState.Normal;
        }
Ejemplo n.º 58
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cGame">Handle to the Game object being used. Pass in null for this 
        /// parameter if not using a Game object.</param>
        public BasicParticleSystem(TankGame cGame)
            : base(cGame)
        {

        }