示例#1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            this.MainCamera.Update();
            GameObjectManager.GetSingleton().Update();

            base.Update(gameTime);
        }
示例#2
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            RenderSystem.GetSingleton().Initialize();
            GameObjectManager.GetSingleton().Initialize();
            LightSystem.GetSingleton().Initialize();
            //LightSystem.GetSingleton().AmbientColor = Vector3.Zero;

            this.MainCamera          = new Camera();
            this.MainCamera.Position = new Vector3(0, 50, 80);
            this.MainCamera.Ratio    = this.mGraphics.GraphicsDevice.Viewport.AspectRatio;
            this.MainCamera.Far      = 1000.0f;

            //this.SkyBox = new Skybox();
            //this.SkyBox.Init(
            //    this.Content.Load<Model>("Skybox/Cube"),
            //    this.Content.Load<TextureCube>("Skybox/Skybox"),
            //    this.Content.Load<Effect>("Skybox/SkyboxShader")
            //    );

            //GameObject go1 = new GameObject();
            //go1.AddComponent<Light>().Type = LightType.DIRECTION;
            //go1.AddComponent<Light>().LightColor = new Vector3(0.1f, 0.1f, 0.1f);
            //go1.LocalRotation = new Vector3(-45, -45, 0);

            GameObject go2 = new GameObject();

            go2.Position = new Vector3(0, 20, 30);
            Light PointLight1 = go2.AddComponent <Light>();

            PointLight1.Type           = LightType.POINT;
            PointLight1.Attenuation    = 5000;
            PointLight1.CutOffDistance = 50;
            PointLight1.LightColor     = new Vector3(0, 0.5f, 0);
            go2.AddComponent <TestLogic>();

            GameObject go3 = new GameObject();

            go3.Position      = new Vector3(0, 50, 0);
            go3.LocalRotation = new Vector3(-90, 0, 0);
            Light SpotLight1 = go3.AddComponent <Light>();

            SpotLight1.Type           = LightType.SPOT;
            SpotLight1.Attenuation    = 5000;
            SpotLight1.CutOffDistance = 100;
            SpotLight1.ConeAngle      = 15;
            SpotLight1.LightColor     = new Vector3(1, 0, 0);
            go3.AddComponent <TestLogic>();


            base.Initialize();
        }
示例#3
0
 public GameObject()
 {
     this.mGGUID = GameObjectManager.GetSingleton().GenGGUID();
     GameObjectManager.GetSingleton().AddGameObject(this);
 }