示例#1
0
 public Shot(Ray Trac, float Caliber, Being Origin)
 {
     Tracer = Trac;
     TimeToDie = Environment.TickCount+100;
     this.Caliber = Caliber;
     this.Origin = Origin;
 }
示例#2
0
 public void AddShot(Ray Trac, float Caliber, Being Player)
 {
     Shots.Add(new Shot(Trac, Caliber, Player));
 }
示例#3
0
        protected override void LoadContent()
        {
            //
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteFont = Content.Load<SpriteFont>(@"Fonts\DemoFont");
            FontTF2Build = Content.Load<SpriteFont>(@"Fonts\TF2Build");

            effect = Content.Load<Effect>(@"Shaders\parallax_normal_mapping");
            effect.CurrentTechnique = effect.Techniques["ParallaxNormalMappingPointLighting"];

            brickColorMap = Content.Load<Texture2D>(@"Textures\brick_color_map");
            brickNormalMap = Content.Load<Texture2D>(@"Textures\brick_normal_map");
            brickHeightMap = Content.Load<Texture2D>(@"Textures\brick_height_map");
            stoneColorMap = Content.Load<Texture2D>(@"Textures\stone_color_map");
            stoneNormalMap = Content.Load<Texture2D>(@"Textures\stone_normal_map");
            stoneHeightMap = Content.Load<Texture2D>(@"Textures\stone_height_map");
            woodColorMap = Content.Load<Texture2D>(@"Textures\wood_color_map");
            woodNormalMap = Content.Load<Texture2D>(@"Textures\wood_normal_map");
            woodHeightMap = Content.Load<Texture2D>(@"Textures\wood_height_map");
            Crosshair = Content.Load<Texture2D>(@"Textures\sniperKustoms");

            Leet = Content.Load<Model>(@"Models\leet\leet");
            Shroomer = Content.Load<Model>(@"Models\shroomer\shroomer");
            AK47 = Content.Load<Model>(@"Models\ak47\ak47");
            Deagle = Content.Load<Model>(@"Models\deagle\deagle");
            Shotty = Content.Load<Model>(@"Models\benelli\benellimodel");
            UnitBox = Content.Load<Model>(@"Models\UnitBox");
            UnitSphere = Content.Load<Model>(@"Models\UnitSphere");
            CarModel = Content.Load<Model>(@"Models\car\car");
            HouseModel = Content.Load<Model>(@"Models\house\house");
            WellModel = Content.Load<Model>(@"Models\well\well");
            Crate1Model = Content.Load<Model>(@"Models\crates\Crate1");
            Crate2Model = Content.Load<Model>(@"Models\crates\Crate2");
            Crate3Model = Content.Load<Model>(@"Models\crates\Crate3");
            Crate4Model = Content.Load<Model>(@"Models\crates\Crate4");
            Crate5Model = Content.Load<Model>(@"Models\crates\Crate5");
            StarModel = Content.Load<Model>(@"Models\star\star");
            TreeModel = Content.Load<Model>(@"Models\tree\tree");

            Stars = new List<GameObject>();
            //for (int i = 0; i < 50; i++)
            //{

            //}
            Stars.Add(new GameObject(this, StarModel, new Vector3(150, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(-250, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(350, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(-450, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(-550, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(650, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(-750, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(850, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(-950, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(1050, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, 150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, -150), 0.25f));
            Stars.Add(new GameObject(this, StarModel, new Vector3(5000, 85.0f, 150), 0.25f));

            AmmoCrates = new List<GameObject>();
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(1000, 14.0f, 1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, -1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, 1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(200, 14.0f, -1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, -1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, 1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, -1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(850, 14.0f, 1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, -1150), 10.0f));
            AmmoCrates.Add(new GameObject(this, Crate2Model, new Vector3(5000, 14.0f, 1150), 10.0f));

            AK47HUDTexture = Content.Load<Texture2D>("Artwork\\ak47_icon");
            DeagleHUDTexture = Content.Load<Texture2D>("Artwork\\deagle_icon");
            ShotgunHUDTexture = Content.Load<Texture2D>("Artwork\\shotgun_icon");
            AK47HUDSelectedTexture = Content.Load<Texture2D>("Artwork\\ak47_icon_glow");
            DeagleHUDSelectedTexture = Content.Load<Texture2D>("Artwork\\deagle_icon_glow");
            ShotgunHUDSelectedTexture = Content.Load<Texture2D>("Artwork\\shotgun_icon_glow");
            BloodSplatterTexture = Content.Load<Texture2D>("Artwork\\blood_splatter2");
            HealthBarOutlineTexture = Content.Load<Texture2D>("Artwork\\healthbaroutline");
            HealthBarTexture = Content.Load<Texture2D>(@"Textures\bloodBar");
            HappySunTexture = Content.Load<Texture2D>("Artwork\\sun 2");
            HappySunTransparentTexture = Content.Load<Texture2D>("Artwork\\sun transparent");
            SunTexture = Content.Load<Texture2D>("Artwork\\sun 2");
            HopeTexture = Content.Load<Texture2D>("Artwork\\hope 3 blur");
            Player = new Being(this); Player.IsHuman = true;

            Car = new GameObject(this, CarModel, new Vector3(500, 5.0f, 500), 50);
            House = new GameObject[MAX_HOUSES];
            for (int i = 0; i < MAX_HOUSES; i++)
            {
                if (i == 0) House[0] = new GameObject(this, HouseModel, new Vector3(-3000, 10.0f, -1000), 50);
                if (i == 1) House[1] = new GameObject(this, HouseModel, new Vector3(-1500, 10.0f, -1000), 50);
                if (i == 2) House[2] = new GameObject(this, HouseModel, new Vector3(0, 10.0f, -1000), 50);
                if (i == 3) House[3] = new GameObject(this, HouseModel, new Vector3(1500, 10.0f, -1000), 50);
                if (i == 4) House[4] = new GameObject(this, HouseModel, new Vector3(3000, 10.0f, -1000), 50);

                if (i == 5) House[5] = new GameObject(this, HouseModel, new Vector3(-3000, 10.0f, 1000), 50);
                if (i == 6) House[6] = new GameObject(this, HouseModel, new Vector3(-1500, 10.0f, 1000), 50);
                if (i == 7) House[7] = new GameObject(this, HouseModel, new Vector3(0, 10.0f, 1000), 50);
                if (i == 8) House[8] = new GameObject(this, HouseModel, new Vector3(1500, 10.0f, 1000), 50);
                if (i == 9) House[9] = new GameObject(this, HouseModel, new Vector3(3000, 10.0f, 1000), 50);
            }

            Well = new GameObject[MAX_WELLS];
            for (int i = 0; i < MAX_WELLS; i++)
            {
                if (i == 0) Well[0] = new GameObject(this, WellModel, new Vector3(-3000, 5.0f, 0), 50);
                if (i == 1) Well[1] = new GameObject(this, WellModel, new Vector3(-1500, 5.0f, 0), 50);
                if (i == 2) Well[2] = new GameObject(this, WellModel, new Vector3(-0, 5.0f, 0), 50);
                if (i == 3) Well[3] = new GameObject(this, WellModel, new Vector3(1500, 5.0f, 0), 50);
                if (i == 4) Well[4] = new GameObject(this, WellModel, new Vector3(3000, 5.0f, 0), 50);

            }

            Crate = new GameObject[MAX_CRATES];
            for (int i = 0; i < MAX_CRATES; i++)
            {
                if (i == 0) Crate[0] = new GameObject(this, Crate2Model, new Vector3(-800, 62.0f, -400), 10);
                if (i == 1) Crate[1] = new GameObject(this, Crate2Model, new Vector3(-600, 62.0f, -400), 10);
                if (i == 2) Crate[2] = new GameObject(this, Crate2Model, new Vector3(-400, 62.0f, -400), 10);
                if (i == 3) Crate[3] = new GameObject(this, Crate2Model, new Vector3(-200, 62.0f, -400), 10);
                if (i == 4) Crate[4] = new GameObject(this, Crate2Model, new Vector3(0, 62.0f, -400), 10);
                if (i == 5) Crate[5] = new GameObject(this, Crate2Model, new Vector3(-800, 62.0f, -400), 10);
                if (i == 6) Crate[6] = new GameObject(this, Crate2Model, new Vector3(-600, 62.0f, -400), 10);
                if (i == 7) Crate[7] = new GameObject(this, Crate2Model, new Vector3(-400, 62.0f, -400), 10);
                if (i == 8) Crate[8] = new GameObject(this, Crate2Model, new Vector3(-200, 62.0f, -400), 10);
                if (i == 9) Crate[9] = new GameObject(this, Crate2Model, new Vector3(0, 62.0f, -400), 10);
            }

            Tree = new GameObject[MAX_TREES];
            for (int i = 0; i < MAX_TREES; i++)
            {
                if (i == 0) Tree[0] = new GameObject(this, TreeModel, new Vector3(2000, 5.0f, 2000), 50);
                if (i == 1) Tree[1] = new GameObject(this, TreeModel, new Vector3(2000, 5.0f, -2000), 50);
                if (i == 2) Tree[2] = new GameObject(this, TreeModel, new Vector3(-0, 5.0f, 2000), 50);
                if (i == 3) Tree[3] = new GameObject(this, TreeModel, new Vector3(-2000, 5.0f, 2000), 50);
                if (i == 4) Tree[4] = new GameObject(this, TreeModel, new Vector3(-2000, 5.0f, -2000), 50);
                if (i == 5) Tree[5] = new GameObject(this, TreeModel, new Vector3(3000, 5.0f, -200), 50);
                if (i == 6) Tree[6] = new GameObject(this, TreeModel, new Vector3(-3000, 5.0f, -200), 50);
                if (i == 7) Tree[7] = new GameObject(this, TreeModel, new Vector3(1000, 5.0f, 2500), 50);
                if (i == 8) Tree[8] = new GameObject(this, TreeModel, new Vector3(2500, 5.0f, 2500), 50);
                if (i == 9) Tree[9] = new GameObject(this, TreeModel, new Vector3(2600, 5.0f, 1900), 50);
                if (i == 10) Tree[10] = new GameObject(this, TreeModel, new Vector3(0, 5.0f, 2000), 50);
                if (i == 11) Tree[11] = new GameObject(this, TreeModel, new Vector3(-3000, 5.0f, 200), 50);
                if (i == 12) Tree[12] = new GameObject(this, TreeModel, new Vector3(-1000, 5.0f, -2500), 50);
                if (i == 13) Tree[13] = new GameObject(this, TreeModel, new Vector3(-2500, 5.0f, -2500), 50);
                if (i == 14) Tree[14] = new GameObject(this, TreeModel, new Vector3(-2600, 5.0f, -1900), 50);

            }

            Mushroom = new GameObject[MAX_MUSHROOMS];
            for (int i = 0; i < MAX_MUSHROOMS; i++)
            {
                if (i == 0) Mushroom[0] = new GameObject(this, Shroomer, new Vector3(-1500, 50.0f, 2000), 0.1f);
                if (i == 1) Mushroom[1] = new GameObject(this, Shroomer, new Vector3(200, 50.0f, 2000), 0.1f);
                if (i == 2) Mushroom[2] = new GameObject(this, Shroomer, new Vector3(2000, 50.0f, -350), 0.1f);
                if (i == 3) Mushroom[3] = new GameObject(this, Shroomer, new Vector3(100, 50.0f, -1000), 0.1f);
                if (i == 4) Mushroom[4] = new GameObject(this, Shroomer, new Vector3(500, 50.0f, -900), 0.1f);
                if (i == 5) Mushroom[5] = new GameObject(this, Shroomer, new Vector3(-1000, 50.0f, 1600), 0.1f);
                if (i == 6) Mushroom[6] = new GameObject(this, Shroomer, new Vector3(3000, 50.0f, 2000), 0.1f);
                if (i == 7) Mushroom[7] = new GameObject(this, Shroomer, new Vector3(100, 50.0f, 2500), 0.1f);
                if (i == 8) Mushroom[8] = new GameObject(this, Shroomer, new Vector3(250, 50.0f, -2500), 0.1f);
                if (i == 9) Mushroom[9] = new GameObject(this, Shroomer, new Vector3(1900, 50.0f, 2600), 0.1f);
            }

            // Create an empty white texture. This will be bound to the
            // colorMapTexture shader parameter when the user wants to
            // disable the color map texture. This trick will allow the
            // same shader to be used for when textures are enabled and
            // disabled.

            nullTexture = new Texture2D(GraphicsDevice, 1, 1, 0,
                            TextureUsage.None, SurfaceFormat.Color);

            Color[] pixels = { Color.White };

            nullTexture.SetData(pixels);

            //sound load content
            //song1 = Content.Load<Song>("Audio\\Music\\A Walk in the sun");
            //song2 = Content.Load<Song>("Audio\\Music\\dingdong");
            //song3 = Content.Load<Song>("Audio\\Music\\Morning Sunrise");
            soundtrack = Content.Load<Song>("Audio\\Music\\Soundtrack");
            cockGun = Content.Load<SoundEffect>("Audio\\Sounds\\cockgun");
            emptyClip = Content.Load<SoundEffect>("Audio\\Sounds\\emptyClip");
            soundAK47 = Content.Load<SoundEffect>("Audio\\Sounds\\ak47-1");
            ShottyShot = Content.Load<SoundEffect>("Audio\\Sounds\\shottyShotBIG");
            DeagleShot = Content.Load<SoundEffect>("Audio\\Sounds\\deagleShot");
            soundAK47reload = Content.Load<SoundEffect>("Audio\\Sounds\\ak47_boltpull");
            StarGotten = Content.Load<SoundEffect>("Audio\\Sounds\\sparkle");
            Scream = Content.Load<SoundEffect>("Audio\\Sounds\\screams male 03");
            Headshot = Content.Load<SoundEffect>("Audio\\Sounds\\headshot");
            Yippee = Content.Load<SoundEffect>("Audio\\Sounds\\yippee");
            //AmbienceNoise = Content.Load<SoundEffect>("Audio\\Sounds\\neighborhood");
            //MediaPlayer.Play(song1);

            try
            {
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Play(soundtrack);

                //MediaPlayer.Play(song1);
                //AmbienceNoise.Play();
            }
            catch (Exception e)
            {
                e.ToString();
            }
        }
示例#4
0
        protected override void Initialize()
        {
            try
            {
                base.Initialize();
            }
            catch (Exception e)
            {
                Components.RemoveAt(1);
                base.Initialize();
            }
            Rand = new Random();

            TimeLastMenuChange = TimeLastScreenModeChange = Environment.TickCount;
            CurrentMenuOption = 0;// lastButtonPressed = 0;
            CurrentScreenMode = 0;

            #if XBOX360
            windowWidth = 1280;
            windowHeight = 720;
            #else
            windowWidth = (int)(GraphicsDevice.DisplayMode.Width / 1.2);
            windowHeight = (int)(GraphicsDevice.DisplayMode.Height / 1.2);
            #endif

            // Setup frame buffer.
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.PreferredBackBufferWidth = windowWidth;
            graphics.PreferredBackBufferHeight = windowHeight;
            graphics.PreferMultiSampling = true;
            graphics.ApplyChanges();

            // Initially enable the diffuse color map texture.
            enableColorMap = true;

            // Initially enable parallax mapping.
            enableParallax = true;

            // Initial position for text rendering.
            fontPos = new Vector2(1.0f, 1.0f);

            // Parallax mapping height scale and bias values.
            scaleBias = new Vector2(0.04f, -0.03f);

            // Initialize point lighting for the scene.
            globalAmbient = new Color(new Vector4(0.2f, 0.2f, 0.2f, 1.0f));
            light.Type = Light.LightType.PointLight;
            light.Direction = Vector3.Zero;
            light.Position = new Vector3(0.0f, (0.85f * WALL_HEIGHT), 0.0f);
            light.Ambient = Color.White;
            light.Diffuse = Color.White;
            light.Specular = Color.White;
            light.SpotInnerConeRadians = MathHelper.ToRadians(40.0f);
            light.SpotOuterConeRadians = MathHelper.ToRadians(70.0f);
            light.Radius = Math.Max(FLOOR_PLANE_SIZE, WALL_HEIGHT);

            // Initialize material settings. Just a plain lambert material.
            material.Ambient = new Color(new Vector4(0.2f, 0.2f, 0.2f, 1.0f));
            material.Diffuse = new Color(new Vector4(0.8f, 0.8f, 0.8f, 1.0f));
            material.Emissive = Color.Black;
            material.Specular = Color.Black;
            material.Shininess = 0.0f;

            // Create the room.
            room = new NormalMappedRoom(GraphicsDevice,
                    FLOOR_PLANE_SIZE, WALL_HEIGHT, FLOOR_TILE_FACTOR,
                    CEILING_TILE_FACTOR, WALL_TILE_FACTOR_X, WALL_TILE_FACTOR_Y);

            // Setup the camera.
            camera.EyeHeightStanding = CAMERA_PLAYER_EYE_HEIGHT;
            camera.Acceleration = new Vector3(
                CAMERA_ACCELERATION_X,
                CAMERA_ACCELERATION_Y,
                CAMERA_ACCELERATION_Z);
            camera.VelocityWalking = new Vector3(
                CAMERA_VELOCITY_X,
                CAMERA_VELOCITY_Y,
                CAMERA_VELOCITY_Z);
            camera.VelocityRunning = new Vector3(
                camera.VelocityWalking.X * CAMERA_RUNNING_MULTIPLIER,
                camera.VelocityWalking.Y * CAMERA_RUNNING_JUMP_MULTIPLIER,
                camera.VelocityWalking.Z * CAMERA_RUNNING_MULTIPLIER);
            camera.Perspective(
                CAMERA_FOVX,
                (float)windowWidth / (float)windowHeight,
                CAMERA_ZNEAR, CAMERA_ZFAR);

            ParticleList = new ParticleList();
            Shots  = new ShotList();
            RemoteShots = new ShotList();
            Enemies = new ArrayList();
            RemotePlayers = new List<Being>();
            for (int i = 0; i < 4; ++i)
            {
                Being NewGuy = new Being(this);
                NewGuy.IsHuman = false;
                NewGuy.camera.Position = new Vector3(-200+(i%2)*400, 115, i>1?200:-200);
                Enemies.Add(NewGuy);
            }
            for (int i = 0; i < 4; ++i)
            {
                Being NewGuy = new Being(this);
                NewGuy.IsHuman = false;
                NewGuy.camera.Position = new Vector3(Rand.Next() % (CAMERA_BOUNDS_MAX_X - CAMERA_BOUNDS_MIN_X) + CAMERA_BOUNDS_MIN_X,
                    115,
                    Rand.Next() % (CAMERA_BOUNDS_MAX_Z - CAMERA_BOUNDS_MIN_Z) + CAMERA_BOUNDS_MIN_Z
                    );
                NewGuy.camera.Rotate(Rand.Next() % 360, 0.0f);
                Enemies.Add(NewGuy);
            }

            // Get the initial keyboard state.
            currentKeyboardState = Keyboard.GetState();
            currentMouseState = Mouse.GetState();
        }