예제 #1
0
        public Player(Game game, GraphicsDeviceManager graphics, Vector3 startingPosition, SpriteBatch spriteBatch, WEAPONTYPE weapon1, WEAPONTYPE weapon2) : base(game)
        {
            this.spriteBatch = spriteBatch;

            modelPosition = startingPosition + new Vector3(2.0f, 0.0f, -2.0f); //moving the player's starting position

            //loading the models for the player, the player has separate head, torso and limbs
            modelTorso = game.Content.Load <Model>("personCubeTorso");
            modelHead  = game.Content.Load <Model>("personCubeHead");
            modelArmL  = game.Content.Load <Model>("personCubeArm");
            modelArmR  = game.Content.Load <Model>("personCubeArm");
            modelLegL  = game.Content.Load <Model>("personCubeLeg");
            modelLegR  = game.Content.Load <Model>("personCubeLeg");

            //loading sound effects for various weapons
            sfxAk47Shot      = game.Content.Load <SoundEffect>("SFX/sfxAK47gunshot");
            sfxAk47Charge    = game.Content.Load <SoundEffect>("SFX/sfxAK47charge");
            sfxMoss500Shot   = game.Content.Load <SoundEffect>("SFX/sfxMoss500gunshot");
            sfxMoss500pump   = game.Content.Load <SoundEffect>("SFX/sfxMoss500pump");
            sfxWeaponSwitch  = game.Content.Load <Song>("SFX/sfxWeaponSwitch");
            sfxWeaponDryFire = game.Content.Load <Song>("SFX/sfxDryFire");

            //the offsets for each limb, relative to 0, 0, 0
            torsoOffset    = new Vector3(0, 0.4f, 0);
            headOffset     = new Vector3(0, 1.0f, 0);
            armLeftOffset  = new Vector3(-0.25f, 0.9f, 0);
            armRightOffSet = new Vector3(0.25f, 0.9f, 0);
            legLeftOffset  = new Vector3(-0.11f, 0.4f, 0);
            legRightOffset = new Vector3(0.11f, 0.4f, 0);

            //new effect for debug drawing
            boxEffect = new BasicEffect(game.GraphicsDevice);
            //bounding box, first is min, second is max
            bulletCollisionBox = new BoundingBox(bulletColBoxMin, bulletColBoxMax);
            bulletList         = new List <BulletClass>();

            //bounding boxes for each axis
            boundingBoxXNeg = new BoundingBox(bbXNMin, bbXNMax);
            boundingBoxXPos = new BoundingBox(bbXPMax, bbXNMax);
            boundingBoxZNeg = new BoundingBox(bbZNMin, bbZNMax);
            boundingBoxZPos = new BoundingBox(bbZPMin, bbZPMax);

            currWeapon     = weapon1; //the player will spawn with the first weapon
            weaponSwitchTo = weapon1;

            weaponClass1 = new WeaponClass(game, weapon1, modelPosition); //weapon class will load weapon model based on WEAPONTYPE
            weaponClass2 = new WeaponClass(game, weapon2, modelPosition);
            weaponClass3 = new WeaponClass(game, WEAPONTYPE.GRENADE, modelPosition);

            game.Components.Add(weaponClass1);
            game.Components.Add(weaponClass2);
            game.Components.Add(weaponClass3);
        }
예제 #2
0
        public EnemyNpc(Game game, Vector3 modelPosition, WEAPONTYPE weapon) : base(game)
        {
            this.modelPosition = modelPosition;

            //loading the models for the player, the player has separate head, torso and limbs
            modelTorso = game.Content.Load <Model>("personCubeTorso");
            modelHead  = game.Content.Load <Model>("personCubeHead");
            modelArmL  = game.Content.Load <Model>("personCubeArm");
            modelArmR  = game.Content.Load <Model>("personCubeArm");
            modelLegL  = game.Content.Load <Model>("personCubeLeg");
            modelLegR  = game.Content.Load <Model>("personCubeLeg");
            modelDead  = game.Content.Load <Model>("personCubeDead");

            sfxAk47Shot    = game.Content.Load <SoundEffect>("SFX/sfxAK47gunshot");
            sfxAk47Charge  = game.Content.Load <SoundEffect>("SFX/sfxAK47charge");
            sfxMoss500Shot = game.Content.Load <SoundEffect>("SFX/sfxMoss500gunshot");
            sfxMoss500pump = game.Content.Load <SoundEffect>("SFX/sfxMoss500pump");

            //offsetting where the limbs and stuff are
            torsoOffset    = new Vector3(0, 0.4f, 0);
            headOffset     = new Vector3(0, 1.0f, 0);
            armLeftOffset  = new Vector3(-0.25f, 0.9f, 0);
            armRightOffSet = new Vector3(0.25f, 0.9f, 0);
            legLeftOffset  = new Vector3(-0.11f, 0.4f, 0);
            legRightOffset = new Vector3(0.11f, 0.4f, 0);

            //bounding box, first is min, second is max
            bulletCollisionBox = new BoundingBox(bulletColBoxMin, bulletColBoxMax);
            bulletList         = new List <BulletClass>(); //bullet list

            //the bounding boxes for collision detection
            boundingBoxXNeg = new BoundingBox(bbXNMin, bbXNMax);
            boundingBoxXPos = new BoundingBox(bbXPMax, bbXNMax);
            boundingBoxZNeg = new BoundingBox(bbZNMin, bbZNMax);
            boundingBoxZPos = new BoundingBox(bbZPMin, bbZPMax);

            weaponClass1 = new WeaponClass(game, weapon, modelPosition); //weapon class will load weapon model based on WEAPONTYPE
            game.Components.Add(weaponClass1);
        }