예제 #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            device = graphics.GraphicsDevice;

            mBackground = Content.Load<Texture2D>("Images/titlepanda");
            mGameover = Content.Load<Texture2D>("Images/gameover");

            mGamecomplete = Content.Load<Texture2D>("Images/gamecomplete");
            mLevels = Content.Load<Texture2D>("Images/gameinstructions");

            mInter = Content.Load<Texture2D>("Images/inter");
            //mLevels = Content.Load<Texture2D>("Images/dayscreen");
            effect1 = Content.Load<Effect>("effects");

            //if (mCurrentScreen == Screen.Main)
            //{

            //    sceneryTexture = Content.Load<Texture2D>("texturemap123");
            //}

            //smokeTexture = Content.Load<Texture2D>("smoke");
            sceneryTexture = Content.Load<Texture2D>("Texture/texturemapraindrop");

            sceneryTexture2 = Content.Load<Texture2D>("Texture/texturewall");

            //gameShip = Content.Load<Model>("turbosonic");

            rigidModel3 = Content.Load<Model>("waterdem4");

            rigidModel = Content.Load<Model>("buildingani4");
               // rigidWorld = Matrix.CreateScale(2f, 2f, 2f);

            rigidModel2 = Content.Load<Model>("buildingani4");

            // Create animation players/clips for the rigid model
            ModelData modelData = rigidModel.Tag as ModelData;
            if (modelData != null)
            {
                if (modelData.RootAnimationClips != null && modelData.RootAnimationClips.ContainsKey("Default Take"))//Take 001
                {
                    rigidRootClip = modelData.RootAnimationClips["Default Take"];

                    rigidRootPlayer = new RootAnimationPlayer();
                    rigidRootPlayer.Completed += new EventHandler(rigidPlayer_Completed);
                    rigidRootPlayer.StartClip(rigidRootClip, 1, TimeSpan.Zero);
                }
                if (modelData.ModelAnimationClips != null && modelData.ModelAnimationClips.ContainsKey("Default Take"))
                {
                    rigidClip = modelData.ModelAnimationClips["Default Take"];

                    rigidPlayer = new RigidAnimationPlayer(rigidModel.Bones.Count);
                    rigidPlayer.Completed += new EventHandler(rigidPlayer_Completed);
                    rigidPlayer.StartClip(rigidClip, 1, TimeSpan.Zero);
                }
            }

            ModelData modelData2 = rigidModel2.Tag as ModelData;
            if (modelData2 != null)
            {
                if (modelData2.RootAnimationClips != null && modelData2.RootAnimationClips.ContainsKey("Default Take"))//Take 001
                {
                    rigidRootClip2 = modelData2.RootAnimationClips["Default Take"];

                    rigidRootPlayer2 = new RootAnimationPlayer();
                    rigidRootPlayer2.Completed += new EventHandler(rigidPlayer_Completed2);
                    rigidRootPlayer2.StartClip(rigidRootClip2, 1, TimeSpan.Zero);
                }
                if (modelData2.ModelAnimationClips != null && modelData2.ModelAnimationClips.ContainsKey("Default Take"))
                {
                    rigidClip2 = modelData2.ModelAnimationClips["Default Take"];

                    rigidPlayer2 = new RigidAnimationPlayer(rigidModel2.Bones.Count);
                    rigidPlayer2.Completed += new EventHandler(rigidPlayer_Completed2);
                    rigidPlayer2.StartClip(rigidClip2, 1, TimeSpan.Zero);
                }
            }
            ModelData modelData3 = rigidModel3.Tag as ModelData;
            if (modelData != null)
            {
                if (modelData3.RootAnimationClips != null && modelData3.RootAnimationClips.ContainsKey("Default Take"))//Take 001
                {
                    rigidRootClip3 = modelData3.RootAnimationClips["Default Take"];

                    rigidRootPlayer3 = new RootAnimationPlayer();
                    rigidRootPlayer3.Completed += new EventHandler(rigidPlayer_Completed3);
                    rigidRootPlayer3.StartClip(rigidRootClip3, 1, TimeSpan.Zero);
                }
                if (modelData3.ModelAnimationClips != null && modelData3.ModelAnimationClips.ContainsKey("Default Take"))
                {
                    rigidClip3 = modelData3.ModelAnimationClips["Default Take"];

                    rigidPlayer3 = new RigidAnimationPlayer(rigidModel.Bones.Count);
                    rigidPlayer3.Completed += new EventHandler(rigidPlayer_Completed3);
                    rigidPlayer3.StartClip(rigidClip3, 1, TimeSpan.Zero);
                }
            }

            // Load the model.
            currentModel = Content.Load<Model>("dude");
            //skinnedWorld = Matrix.CreateScale(.015f, .015f, .015f) * Matrix.CreateRotationY((float)(-Math.PI / 2)) * Matrix.CreateTranslation(new Vector3(9, 0f, -12.5f));

            // Look up our custom skinning information.
            SkinningData skinningData = currentModel.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["Take 001"];

            animationPlayer.StartClip(clip);

            gameShip = Content.Load<Model>("Model/Helicopter");
            //helicopterModel = Content.Load<Model>("Model/Helicopter");

            house1 = Content.Load<Model>("collcam");
            //demolish = Content.Load<Model>("Demolish/dem");
            tree = Content.Load<Model>("treemulti");
            mid = Content.Load<Model>("mid10");
            house2 = Content.Load<Model>("collcam");

            //house1 = Content.Load<Model>("treemulti");
            ////demolish = Content.Load<Model>("Demolish/dem");
            //tree = Content.Load<Model>("treemulti");
            //mid = Content.Load<Model>("treemulti");
            //house2 = Content.Load<Model>("treemulti");

            round1 = Content.Load<Model>("round");

            field = Content.Load<Model>("field");

            tankee1 = Content.Load<Model>("Water_Reservoir");
            //gameShip2 = Content.Load<Model>("xwing");

            //if (mCurrentScreen == Screen.Main)
            //{
            //    gameShip = Content.Load<Model>("turbosonic");
            //}
            //else
            //    if (mCurrentScreen == Screen.Level2)
            //    {
            //        gameShip = LoadModel("xwing");
            //    }
            //xwingModel = LoadModel("xwing");
            //xwingModel = LoadModel("lego");
            //targetModel = LoadModel("xwing");

            //targetModel = LoadModel("target

            civilianModel = Content.Load<Model>("bud");
            targetModel = Content.Load<Model>("bird"); //("SpongeBob_fbx");
            bulletTexture = Content.Load<Texture2D>("bullet");

            //if (mCurrentScreen == Screen.Main)
            //{

            //skyboxModel = LoadModel("skybox", out skyboxTextures);
            //}
            //else
            //    if (mCurrentScreen == Screen.Level2)
            //    {
            //        skyboxModel = LoadModel("skybox", out skyboxTextures);
            //    }

            skybox1 = LoadModel("Skybox/skybox", out skyboxTextures1);

            skybox2 = LoadModel("SkyboxNight/skybox", out skyboxTextures2);

            //skyboxModel = LoadModel("Skybox/skybox", out skyboxTextures);

            //skyboxModel2 = LoadModel("skyboxspace", out skyboxTextures);

            background = Content.Load<SoundEffect>("Sounds/background");

            explosionSound = Content.Load<SoundEffect>("Sounds/explosionmetal");

            song = Content.Load<Song>("Sounds/Saints"); // use the name of your song instead of "song_name"

            BirdSounds[0] = Content.Load<SoundEffect>(@"Sounds/bird1");
            BirdSounds[1] = Content.Load<SoundEffect>(@"Sounds/bird2");

            BirdSounds[2] = Content.Load<SoundEffect>(@"Sounds/bird3");
            BirdSounds[3] = Content.Load<SoundEffect>(@"Sounds/bird4");
            BirdSounds[4] = Content.Load<SoundEffect>(@"Sounds/bird5");
            BirdSounds[5] = Content.Load<SoundEffect>(@"Sounds/bird6");
            BirdSounds[6] = Content.Load<SoundEffect>(@"Sounds/bird7");
            BirdSounds[7] = Content.Load<SoundEffect>(@"Sounds/bird8");

            demround = Content.Load<Model>(@"Demolish/demround3");
               // demolish = Content.Load<Model>(@"Model/finish7");

            //demolish = Content.Load<Model>(@"waterdem1");

            theMesh = Content.Load<Model>("fy_faen_ass");
            theOceanMesh = Content.Load<Model>("ocean");

            // Load the shader
            effect = Content.Load<Effect>("Shader");
            oceanEffect = Content.Load<Effect>("OceanShader");

            // Set up the parameters
            SetupIslandShaderParameters();
            SetupOceanShaderParameters();

            diffuseIslandTexture = Content.Load<Texture2D>("island");
            normalIslandTexture = Content.Load<Texture2D>("islandNormal");

            diffuseOceanTexture = Content.Load<Texture2D>("water1");
            normalOceanTexture = Content.Load<Texture2D>("wavesbump");

            LoadFloorPlan();
            SetUpVertices();
            SetUpBoundingBoxes();
            AddTargets();
            AddCivilians();
            hud = new HUD();
            hud.Font = Content.Load<SpriteFont>("Arial");
            life = new LIFE();
            life.Font = Content.Load<SpriteFont>("Arial");
        }
예제 #2
0
        private void DrawRigidModel3(Model model, RigidAnimationPlayer rigidAnimationPlayer, RootAnimationPlayer rootAnimationPlayer)
        {
            RasterizerState rasterizerState = new RasterizerState();
            rasterizerState.CullMode = CullMode.None;
            GraphicsDevice.RasterizerState = rasterizerState;

            Matrix rigidWorld = Matrix.CreateScale(1.5f, 1.5f, 1.5f) * Matrix.CreateRotationX(0) * Matrix.CreateTranslation(new Vector3(9, 0f, -30));//-0.05f

            //Matrix[] targetTransforms = new Matrix[model.Bones.Count];
            //model.CopyAbsoluteBoneTransformsTo(targetTransforms);

            Matrix[] boneTransforms = null;
            if (rigidAnimationPlayer != null)
                boneTransforms = rigidAnimationPlayer.GetBoneTransforms();

            Matrix rootTransform = Matrix.Identity;
            if (rootAnimationPlayer != null)
                rootTransform = rootAnimationPlayer.GetCurrentTransform();

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();

                    effect.View = viewMatrix;
                    effect.Projection = projectionMatrix;
                    // effect.World = rigidWorld;

                    if (boneTransforms != null)
                        effect.World = boneTransforms[mesh.ParentBone.Index] * rootTransform * rigidWorld;
                    else
                        effect.World = rootTransform * rigidWorld;
                }
                mesh.Draw();
            }
        }