示例#1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            this.camera = (Camera)this.Game.Services.GetService(typeof(Camera));

            base.Initialize();

            this.effect = new BasicEffect(GraphicsDevice);

            this.effect.TextureEnabled = true;
            this.effect.Texture = this.texture;
        }
示例#2
0
文件: Sphere.cs 项目: Tzbob/TakGu
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            this.camera = (Camera)this.Game.Services.GetService(typeof(Camera));

            this.CreateBounds();

            this.position = new Vector3(
                this.widthRoom / 2
                , this.heightRoom / 2
                , -this.bounds.Radius - this.depthRoom / 2
            );

            this.initialPosition = position;

            this.rotationX = 0;
            this.rotationY = 0;
        }
示例#3
0
        public override void Initialize()
        {
            //settings
            this.width = 10f;
            this.height = width / this.Game.GraphicsDevice.Viewport.AspectRatio;
            this.depth = 15f;
            float sideManagerTextureSize = 1f;

            this.sphereScale = 0.5f;
            this.paddleWidth = 1f;

            float skyBoxWidth = 200f;
            float halfSkyBoxWidth = skyBoxWidth / 2;

            Vector3 skyBoxPosition = new Vector3(
                -halfSkyBoxWidth + this.width / 2
                , -halfSkyBoxWidth + this.height / 2
                , halfSkyBoxWidth - depth / 2
            );

            string textureDetail = this.configSource.Configs["Graphics"].GetString("texture_detail");

            Texture2D wallTexture = this.Game.Content.Load<Texture2D>("texture/wall");
            Texture2D floorTexture = this.Game.Content.Load<Texture2D>("texture/floor");

            this.paddleTexture = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/paddle", textureDetail));
            this.paddleActiveTexture = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/paddleclicked", textureDetail));

            Texture2D spaceBoxLeft = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/interstellar_lf", textureDetail));
            Texture2D spaceBoxFront = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/interstellar_ft", textureDetail));
            Texture2D spaceBoxRight = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/interstellar_rt", textureDetail));
            Texture2D spaceBoxDown = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/interstellar_dn", textureDetail));
            Texture2D spaceBoxUp = this.Game.Content.Load<Texture2D>(
                String.Format("texture/{0}/interstellar_up", textureDetail));

            this.hitSound = this.Game.Content.Load<SoundEffect>("audio/shot");
            this.paddleSound = hitSound;

            this.sphereModel = this.Game.Content.Load<Model>(
                String.Format(
                    "model/{0}/sphere"
                    , this.configSource.Configs["Graphics"].GetString("model_detail")
                )
            );

            this.Add(new SkyBox(this.Game
                ,skyBoxPosition
                ,skyBoxWidth
                ,spaceBoxLeft
                ,spaceBoxFront
                ,spaceBoxRight
                ,spaceBoxDown
                ,spaceBoxUp
                )
            );

            Camera camera = new Camera(
                this.Game
                , width
                , height
                , depth
            );

            this.SetUp();

            this.sideManager = new SideManager(
                this.Game
                , width
                , height
                , depth
                , sideManagerTextureSize
                , wallTexture
                , floorTexture
            );
            this.Add(sideManager);
            this.sphere.CalculateCollisionNormal += this.sideManager.CollisionNormal;

            this.Add(camera);
            this.Game.Services.AddService(typeof(Camera), camera);

            base.Initialize();
        }
示例#4
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            this.camera = (Camera)this.Game.Services.GetService(typeof(Camera));
            this.visualData = new VisualizationData();

            this.model = this.Game.Content.Load<Model>("model/low/sphere");
            base.Initialize();
        }