Пример #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            weaponManager = new WeaponManager(Content, new String[] { "Weapons/pistol", "Weapons/mp5" }, new String[] { "Weapons/bullet", "Weapons/bullet" }, new String[] {"Sounds/9mm", "Sounds/mp5"}, new int[] {30, 16});
            GunModel gun = weaponManager.GetModel(0);
            gun.SetUpInfo(0.03f, 0.03f, -0.03f, 0.4f, 0.4f, 0.3f);
            gun.crosshair = new Crosshair(this.GraphicsDevice, 1, 1);

            gun = weaponManager.GetModel(1);
            gun.SetUpInfo(0.02f, 0.02f, 0.02f, 0.5f, 0.5f, 0.2f);
            gun.crosshair = new Crosshair(this.GraphicsDevice, 1, 1);
            skybox = new Skybox(this);

            soldier = new Character(Content);
            soldier.Load("Models/swat", "Models/swatdiffuse");
            soldier.Rotation_X = 180.0f;
            soldier.Rotation_Z = -90.0f;

            officer = new ModelObject(Content);
            officer.Load("Models/officer");
            officer.Scale = new Vector3(0.01f, 0.01f, 0.01f);
            officer.Rotation_X = 180.0f;

            cam.onMouseClick += new EventHandler(this.onMouseClick);
            cam.onKeyPress += new EventHandler(this.onKeyPress);

            base.LoadContent();
        }
Пример #2
0
        public bool IsColliding(ModelObject modeltwo)
        {
            for (int I = 0; I < this.model.Meshes.Count; ++I)
            {
                BoundingSphere sphere1 = this.model.Meshes[I].BoundingSphere;
                sphere1 = sphere1.Transform(this.World);

                for (int J = 0; J < modeltwo.model.Meshes.Count; ++J)
                {
                    BoundingSphere sphere2 = modeltwo.model.Meshes[J].BoundingSphere;
                    sphere2 = sphere2.Transform(modeltwo.World);

                    if (sphere1.Intersects(sphere2))
                        return true;
                }
            }
            return false;
        }