LoadContent() public method

public LoadContent ( ) : void
return void
Esempio n. 1
0
        protected override void LoadContent()
        {
            LineEffect = new BasicEffect(Game.GraphicsDevice);
            LineEffect.EnableDefaultLighting();
            LineEffect.DiffuseColor       = new Vector3(1, 1, 1);
            LineEffect.VertexColorEnabled = true;
            LineEffect.LightingEnabled    = false;
            LineEffect.TextureEnabled     = false;

            sphereVertices = new VertexPositionColor[18];

            for (int i = 0; i <= 16; i++)
            {
                float angle = (float)Math.PI * 2.0f * (float)i / 16;
                sphereVertices[i].Color    = Color.GreenYellow;
                sphereVertices[i].Position = new Vector3(Sin(angle), Cos(angle), 0);
            }

            sphereVertices[17].Color    = Color.GreenYellow;
            sphereVertices[17].Position = Vector3.Zero;

            Matrix terrainWorld = Matrix.CreateScale(0.03f);

            spriteBatch  = new SpriteBatch(Game.GraphicsDevice);
            whiteTexture = new Texture2D(Game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            whiteTexture.SetData(new Color[1]
            {
                Color.White
            });

            WaterRenderer.LoadContent();

            base.LoadContent();
        }
Esempio n. 2
0
        protected override void LoadContent()
        {
            //load a texture for each team
            foreach (string s in Game.Teamnames)
            {
                TeamTextures.Add(s, Game.Content.Load <Texture2D>("Textures/Teams/" + s));
            }

            CrosshairTexture = Game.Content.Load <Texture2D>("Textures/Crosshair");

            BallEffect = new BasicEffect(Game.GraphicsDevice);
            BallEffect.EnableDefaultLighting();

            BallEffect.Texture        = TeamTextures.Values.ElementAt(0); //default texture
            BallEffect.TextureEnabled = true;
            BallEffect.DirectionalLight0.Direction = new Vector3(1, -1, -1);
            BallEffect.AmbientLightColor           = new Vector3(0.3f, 0.3f, 0.3f);
            BallEffect.PreferPerPixelLighting      = true;
            BallEffect.SpecularColor = new Vector3(0.5f, 0.5f, 0.5f);
            BallEffect.SpecularPower = 4;

            BallModel = Game.Content.Load <Model>("Models/Ball");
            BallModel.Meshes[0].MeshParts[0].Effect = BallEffect;

            EarthTexture = Game.Content.Load <Texture2D>("Textures/Dirt");
            SandTexture  = Game.Content.Load <Texture2D>("Textures/Sand");
            StoneTexture = Game.Content.Load <Texture2D>("Textures/Stone");

            TerrainEffect = Game.Content.Load <Effect>("Effects/Terrain");

            RopeEffect = new BasicEffect(Game.GraphicsDevice);
            RopeEffect.LightingEnabled = false;
            RopeEffect.Texture         = Game.Content.Load <Texture2D>("Textures/Rope");
            RopeEffect.TextureEnabled  = true;

            GraveEffect = new BasicEffect(Game.GraphicsDevice);
            GraveEffect.EnableDefaultLighting();
            GraveEffect.Texture        = Game.Content.Load <Texture2D>("Textures/RIP");
            GraveEffect.TextureEnabled = true;
            GraveEffect.DirectionalLight0.Direction = new Vector3(1, -1, -1);
            GraveEffect.AmbientLightColor           = new Vector3(0.3f);
            GraveEffect.PreferPerPixelLighting      = true;

            GraveModel = Game.Content.Load <Model>("Models/RIP");
            GraveModel.Meshes[0].MeshParts[0].Effect = GraveEffect;

            //CelShading = Game.Content.Load<Effect>("Effects/CelShading");

            WaterRenderer.LoadContent();

            WorldRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            base.LoadContent();
        }