当前位置: 首页>>代码示例>>C#>>正文


C# Material.SetTexturedMaterial方法代码示例

本文整理汇总了C#中Material.SetTexturedMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# Material.SetTexturedMaterial方法的具体用法?C# Material.SetTexturedMaterial怎么用?C# Material.SetTexturedMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Material的用法示例。


在下文中一共展示了Material.SetTexturedMaterial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            //SFX
            Wind = Content.Load<SoundEffect>("windy2");
            Heart = Content.Load<SoundEffect>("heart_beating_at_normal_speed");
            Scream = Content.Load<SoundEffect>("bloodscream");
            NearMonster = Content.Load<SoundEffect>("this_way_comes_2");

            //Models
            testmodel = Content.Load<Model>("box");
            monsterModel = Content.Load<Model>("SphereHighPoly");
            //Music
            BackgroundMusic = Content.Load<Song>("MonsterMusicTest");
            Music2 = Content.Load<Song>("breifing");
            //Mini Map
            MiniMap_Closed = Content.Load<Texture2D>("minimap_closed");
            MiniMap_Monster = Content.Load<Texture2D>("minimap_monster");
            MiniMap_Open = Content.Load<Texture2D>("minimap_open");
            MiniMap_Player = Content.Load<Texture2D>("minimap_player");
            //compass
            CompassTexture = Content.Load<Texture2D>("gamecompass2");
            CompassSkull = Content.Load<Texture2D>("skull");
            CompassArrow = Content.Load<Texture2D>("tele");
            CompassPointer = Content.Load<Texture2D>("compasspointer");
            //Banner
            Banner = Content.Load<Texture2D>("banner");
            //Point Spirtes
            pointSpritesEffect = Content.Load<Effect>("Effect\\pointsprites");
            pointSpritesEffect.Parameters["SpriteTexture"].SetValue(
                Content.Load<Texture2D>("fire"));
            spriteArray = new VertexPositionColor[200];
            vertexPosColDecl = new VertexDeclaration(graphics.GraphicsDevice,
                VertexPositionColor.VertexElements);

            device = graphics.GraphicsDevice;
            basicEffect = new BasicEffect(device, null);

            font = Content.Load<SpriteFont>("SpriteFont1");
            smallfont = Content.Load<SpriteFont>("SpriteFont2");

            if (graphics.GraphicsDevice.GraphicsDeviceCapabilities.
                PixelShaderVersion.Major >= 3)
            {
                baseEffect = Content.Load<Effect>("Effect\\MaterialShader30");
                numLights = 3;
                baseEffect.Parameters["numLights"].SetValue(numLights);
                shaderVersionString = "Using Shader Model 3.0";
            }
            else
            {
                baseEffect = Content.Load<Effect>("Effect\\MaterialShader20");
                numLights = 3;
                baseEffect.Parameters["numLights"].SetValue(numLights);
                shaderVersionString = "Using Shader Model 2.0";
            }

            // cache the effect parameters
            viewParameter = baseEffect.Parameters["view"];
            projectionParameter = baseEffect.Parameters["projection"];
            cameraPositionParameter = baseEffect.Parameters["cameraPosition"];

            // create the materials
            BasicMaterial = new Material(Content, graphics.GraphicsDevice,baseEffect);
            WallMaterial = new Material(Content, graphics.GraphicsDevice, baseEffect);
            FloorMaterial = new Material(Content, graphics.GraphicsDevice, baseEffect);
            CeilingMaterial = new Material(Content, graphics.GraphicsDevice, baseEffect);

            BasicMaterial.SetBasicProperties(Color.Purple, 0.5f, 1.2f);
            WallMaterial.SetTexturedMaterial(Color.White, Stage.ConfigurationSettings.WallSpecularPower, Stage.ConfigurationSettings.WallSpecularIntensity*2,
                "wall_diffuse",
                "wall_specular", 1f, 1f);
            FloorMaterial.SetTexturedMaterial(Color.White, 0, 0,
                "ground06",
                "ground06", 1f, 1f);
            CeilingMaterial.SetTexturedMaterial(Color.White, 0, 0,
                "ground06",
                "ground06", 1f, 1f);

            //Set ambient light
            baseEffect.Parameters["ambientLightColor"].SetValue(
                new Vector4(Stage.ConfigurationSettings.Ambient*1.4f,
                    Stage.ConfigurationSettings.Ambient*1.3f,
                    Stage.ConfigurationSettings.Ambient, 1.0f));

            // Recalculate the projection properties on every LoadGraphicsContent call.
            // That way, if the window gets resized, then the perspective matrix will
            // be updated accordingly
            float aspectRatio = (float)graphics.GraphicsDevice.Viewport.Width /
                (float)graphics.GraphicsDevice.Viewport.Height;
            float fieldOfView = aspectRatio * MathHelper.PiOver4 * 3f / 4f;
            projection = Matrix.CreatePerspectiveFieldOfView(
                fieldOfView, aspectRatio, .1f, 1000f);
            projectionParameter.SetValue(projection);

            // calculate the safe left and top edges of the screen
            safeBounds = new Vector2(
//.........这里部分代码省略.........
开发者ID:JamesPersaud,项目名称:GOOS,代码行数:101,代码来源:Game1.cs

示例2: GenerateNewMap


//.........这里部分代码省略.........
            TeleporterGridLocation = TeleporterStartingLocation;
            TeleporterLocation = new Vector3(TeleporterStartingLocation.X * 16, 10.0f, TeleporterStartingLocation.Y * 16);
            TeleporterRenderLocation = new Vector3(TeleporterStartingLocation.X * 16, -10.0f, TeleporterStartingLocation.Y * 16);

            fpsCam.CollisionGrid = bg;
            fpsCam.GridHeight = Stage.Map.Height;
            fpsCam.GridWidth = Stage.Map.Width;
            fpsCam.SquareWidth = 8;
            fpsCam.SquareHeight = 8;

            //Init Monster
            Stage.ClearEntities(true, true);
            monster = new Actor();

            monster.CollisionGrid = bg;
            monster.GridWidth = Stage.Map.Width;
            monster.GridHeight = Stage.Map.Height;
            monster.SetFacingDegrees(-90);
            monster.SetLocation(MonsterStartingLocation.X*16+4, 10, MonsterStartingLocation.Y*16 +4);
            monster.FacingOffset = MathHelper.ToRadians(270);
            monster.FOV = 355.0f;
            monster.UpdateWorldMatrix();
            monster.Behaviours = FLAG_Behaviours.AGGRESSIVE | FLAG_Behaviours.MONSTER | FLAG_Behaviours.EVIL_GENIUS;
            monster.ScalingFactor = 1.0f;
            monster.FightRange = 2.0f;
            monster.HearingRadius = 640.0f;
            monster.SightRadius = 640.0f;
            monster.InstanceName = "Rex";
            monster.movespeed = 0.28f + MonsterSpeedupFactor*Level;
            //Set model
            monster.DefaultModel = monsterModel;
            //Set material
            Material monsterMaterial = new Material(Content, GraphicsDevice, baseEffect);
            monsterMaterial.SetTexturedMaterial(Color.White, Stage.ConfigurationSettings.WallSpecularPower, Stage.ConfigurationSettings.WallSpecularIntensity, "eyestex", "eyestex", 20f, 20f);
            monsterMaterial.Scaled = true;
            monster.DefaultMaterials.Add("default", monsterMaterial);
            //Load the monster into the Stage manager and bring him onstage.
            Stage.LoadActor(monster);
            Stage.BringActorOnStage("Rex");

            //Init Demo Zombie -- In demo mode the demo zombie patrolls a list of random waypoints and the player follows it.
            //The demo zombie is invisible.
            if (Stage.GameState.DemoMode)
            {
                demoZombie = new Actor();

                demoZombie.CollisionGrid = bg;
                demoZombie.GridWidth = Stage.Map.Width;
                demoZombie.GridHeight = Stage.Map.Height;
                demoZombie.SetFacingDegrees(-90);
                demoZombie.SetLocation(StartingLocation.X * 16 + 4, 10, StartingLocation.Y * 16 + 4);
                demoZombie.FacingOffset = MathHelper.ToRadians(270);
                demoZombie.FOV = 355.0f;
                demoZombie.UpdateWorldMatrix();
                demoZombie.Behaviours = FLAG_Behaviours.PATROLLER | FLAG_Behaviours.MONSTER;
                demoZombie.ScalingFactor = 0.0f;
                demoZombie.FightRange = 0.0f;
                demoZombie.HearingRadius = 0.0f;
                demoZombie.SightRadius = 0.0f;
                demoZombie.InstanceName = "Zombie";
                demoZombie.movespeed = 0.56f;

                //Set up the zombie's waypoints.
                //Set up patrol list.
                Vector2 lastLocation = Stage.Map.GetRandomSquareCoordsByType(MapSquareType.Open, null, null, 0);
                Vector2 nextLocation = lastLocation;
开发者ID:JamesPersaud,项目名称:GOOS,代码行数:67,代码来源:Game1.cs


注:本文中的Material.SetTexturedMaterial方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。