예제 #1
0
        public Projectile(Vector3 pos, Vector3 direction, Game1 game, Weapon weapon, int type)
        {
            this.direction = direction;
            this.game = game;
            this.pos = pos;
            this.rot.Y = (float)Math.Atan2(direction.X, direction.Z);
            this.weapon = weapon;
            this.type = type;

            speed = 50;
            life = 300;
            delete = false;
            damage = 5;

            col = new CircleCollider(pos, 0.2f);

            boundingBox = new OOBB(pos, direction, 0.3f, 1); // Need to be changed to be actual projectile dimensions

            if(type == 1)
            //            model = new ProjectileModel(this, TextureManager.elecRound64, TextureManager.elecRound64, TextureManager.elecTrail64, Color.Magenta, Color.Purple, game);
                model = new ProjectileModel(ModelLibrary.projectile, pos, this, Color.Green, Color.CornflowerBlue, game);
            else if(type == 0)
                model = new ProjectileModel(ModelLibrary.projectile, pos, this, Color.Orange, Color.Purple, game);
            else
                model = new ProjectileModel(ModelLibrary.projectile, pos, this, new Color(255,0,255), Color.Green, game);

            game.modelManager.addEffect(model);
        }
예제 #2
0
        public void setAmmoMessage(Weapon wep, float count)
        {
            message = "Got " + count + " " + wep.name;
            if(!wep.name.Contains("bomb"))
            {
                message += " " + wep.ammoName;
                if (count > 1)
                    message += "s";
            }
            message += "!";

            wakeTime = 0;
        }
예제 #3
0
        public void changeWeapons(int wep)
        {
            prevWeapon = activeWeapon;
            activeWeapon = (Weapon)weapons.ElementAt(wep);
            ship.shipModel.setShipModel(wep);

            if (wep == 4)
            {
                activeWeapon.activate();
            }
            else
            {
                weapons.ElementAt(4).disable();
            }
        }
예제 #4
0
        public WeaponSystem(Ship ship, Game game)
            : base(game)
        {
            this.ship = ship;
            this.game = (Game1)game;
            currentWeapon = 1;

            pew1 = Game.Content.Load<Texture2D>(@"Models/Effects/tex1");
            pew2 = Game.Content.Load<Texture2D>(@"Models/Effects/tex2");
            pew3 = Game.Content.Load<Texture2D>(@"Models/Effects/tex3");

            drill = new WeaponDrill(this, ship, this.game);

            weapons.Add(new WeaponMissiles(this, ship, this.game));
            weapons.Add(new WeaponWave(this, ship, this.game));
            weapons.Add(new WeaponLaser(this, ship, this.game));
            weapons.Add(new WeaponBomb(this, ship, this.game));
            weapons.Add(drill);

            activeWeapon = (Weapon)weapons.ElementAt(2);

            hasDrill = false;
        }
예제 #5
0
        void checkKeyboard()
        {
            if (Keyboard.GetState().IsKeyDown(Keys.D1))
            {
                activeWeapon = (Weapon)weapons.ElementAt(2);
                game.hud.hudWeapon.Wake();
                ship.shipModel.setShipModel(0);
                weapons.ElementAt(4).disable();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D2))
            {
                activeWeapon = (Weapon)weapons.ElementAt(3);
                game.hud.hudWeapon.Wake();
                ship.shipModel.setShipModel(1);
                weapons.ElementAt(4).disable();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D3))
            {
                activeWeapon = (Weapon)weapons.ElementAt(0);
                game.hud.hudWeapon.Wake();
                ship.shipModel.setShipModel(2);
                weapons.ElementAt(4).disable();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D4))
            {
                activeWeapon = (Weapon)weapons.ElementAt(1);
                game.hud.hudWeapon.Wake();
                ship.shipModel.setShipModel(3);
                weapons.ElementAt(4).disable();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D5) && hasDrill)
            {
                activeWeapon = (Weapon)weapons.ElementAt(4);
                activeWeapon.activate();
                game.hud.hudWeapon.Wake();
                ship.shipModel.setShipModel(4);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.P) && !hasDrill)
            {
                gotDrill();
                game.hud.hudMessage.setTextMessage("cheating is a shallow victory");
            }
        }
예제 #6
0
 public void swapWeapons()
 {
     Weapon temp = activeWeapon;
     activeWeapon = prevWeapon;
     prevWeapon = temp;
 }
예제 #7
0
 public void setLevelUpMessage(Weapon wep)
 {
     message = "got the " + wep.formattedLevel() + " " + wep.name + "!";
     wakeTime = -3;
 }