コード例 #1
0
        public override void Draw(Camera camera, Effect effect)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    _effect.DiffuseColor = new Vector3(0.5f, 0.1f, 0.1f);
                    _effect.AmbientLightColor = new Vector3(1.0f, 0.1f, 0.1f);
                    _effect.SpecularColor = new Vector3(0.5f, 0.1f, 0.1f);
                    _effect.FogEnabled = true;
                    _effect.FogStart = 50.0f;
                    _effect.FogEnd = 800;
                    _effect.World = Matrix.Identity
                        * transformation[mesh.ParentBone.Index]
                        * Matrix.CreateRotationX(MathHelper.ToRadians(rotation.X))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Y))
                        * Matrix.CreateRotationZ(MathHelper.ToRadians(rotation.Z))
                        * Matrix.CreateScale(modelScale)
                        * Matrix.CreateTranslation(position);

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #2
0
        public void Draw(Camera camera)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    //effect.PreferPerPixelLighting = true;
                    _effect.DiffuseColor = new Vector3(0.3f);
                    _effect.AmbientLightColor = new Vector3(0.3f);
                    _effect.FogEnabled = true;
                    _effect.FogStart = 0.0f;
                    _effect.FogEnd = FogEnd;
                    _effect.World = Matrix.Identity
                        * transformation[mesh.ParentBone.Index]
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.X))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Y))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Z))
                        * Matrix.CreateScale(modelScale)
                        * Matrix.CreateTranslation(position);

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #3
0
        public override void Update(GameTime gameTime, Camera camera)
        {
            base.Update(gameTime, camera);

            if (!pedistalsUnlocked)
            {
                if (redPedistal.IsUnlocked)
                    if (bluePedistal.IsUnlocked)
                        if (yellowPedistal.IsUnlocked)
                        {
                            pedistalsUnlocked = true;
                            finalGate.Use(null);
                            environment.Add(new AssemblyLane(contentMan, new Vector3(2500, 0, 10100), new Vector3(0, 90, 0), 20));
                            environment.Add(new AssemblyLane(contentMan, new Vector3(2500, 0, 13100), new Vector3(0, 90, 0), 20));
                            environment.Add(new AssemblyLane(contentMan, new Vector3(2500, 0, 16100), new Vector3(0, 90, 0), 20));
                            GameConstants.CAMERA_ZFAR = 30000;
                            bluePedistal.StopSound();
                        }
            }
            if (Game.player.PlayerAABB.CheckCollision(StartArea4AABB) != Vector3.Zero)
            {
                Game.player.inv.RemoveItemsOfType("compass");
                World.ChangeArea("area4", new Vector3(2500, 150, -40000));
            }
        }
コード例 #4
0
        public override void Draw(Camera camera, Microsoft.Xna.Framework.Graphics.Effect effect)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    _effect.LightingEnabled = true;
                    _effect.AmbientLightColor = new Vector3(1, 1, 1);
                    _effect.DirectionalLight0.Direction = Vector3.Right;
                    _effect.DirectionalLight0.Enabled = true;
                    _effect.DirectionalLight0.SpecularColor = new Vector3(1, 1, 1);
                    _effect.World = Matrix.Identity
                        * transformation[mesh.ParentBone.Index]
                        // * Matrix.CreateRotationX(MathHelper.ToRadians(rotation.X))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Y))
                        //* Matrix.CreateRotationZ(MathHelper.ToRadians(rotation.Z))
                        * Matrix.CreateScale(modelScale)
                        * Matrix.CreateTranslation(position);

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #5
0
        public override void Draw(Camera camera, Microsoft.Xna.Framework.Graphics.Effect effect)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    _effect.EmissiveColor = color;

                    if (attatchedGem == "GemBlue")
                    {
                        _effect.DiffuseColor = new Vector3(0, 0, 1);
                    }
                    //_effect.AmbientLightColor = color;
                    //_effect.SpecularColor = color;
                    _effect.FogEnabled = true;
                    _effect.FogStart = 50.0f;
                    _effect.FogEnd = 3000;
                    _effect.World = Matrix.Identity
                        * transformation[mesh.ParentBone.Index]
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.X))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Y))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Z))
                        * Matrix.CreateScale(modelScale)
                        * Matrix.CreateTranslation(position);
                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #6
0
        public override void Update(GameTime gameTime, Camera camera)
        {
            base.Update(gameTime, camera);

            if (!assemblyLaneDone)
                HandleAssemblyLine((float)gameTime.ElapsedGameTime.TotalSeconds);
        }
コード例 #7
0
        public void Update(float deltaTime, Camera camera, Vector3 screenOffset)
        {
            compassModel.CopyAbsoluteBoneTransformsTo(compTransf);

            compWorldMatrix = camera.WeaponWorldMatrix(screenOffset.X,
                    screenOffset.Y, screenOffset.Z, GetInventoryScale());
        }
コード例 #8
0
        public void Draw(Camera camera)
        {
            foreach (ModelMesh mesh in compassModel.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    _effect.LightingEnabled = true;
                    _effect.DirectionalLight0.DiffuseColor = new Vector3(1, 1, 1);
                    _effect.DirectionalLight0.SpecularColor = new Vector3(1, 1, 1);
                    _effect.DirectionalLight0.Direction = camera.ViewDirection;

                    _effect.World =
                    Matrix.CreateRotationZ(MathHelper.ToRadians(-camera.HeadingDegrees))
                    * Matrix.CreateRotationY(MathHelper.ToRadians(-20f))
                    * Matrix.CreateRotationX(MathHelper.ToRadians(55f))
                    * compTransf[mesh.ParentBone.Index]
                    * compWorldMatrix;

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #9
0
        public void DrawInventory(GraphicsDevice device, Camera cam)
        {
            for (int i = 0; i < InventoryItems.Count; i++)
            {
                InventoryItems.ElementAt(i).Key.item.Draw(cam);

            }
        }
コード例 #10
0
        public override void Update(GameTime gameTime, Camera camera)
        {
            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            base.Update(gameTime, camera);
            randomWhisper.Update(deltaTime);
            UpdatePillarsLock();
        }
コード例 #11
0
 public Area2Content(Camera camera)
     : base(camera)
 {
     walls = new List<SolidWall>();
     ceilings = new List<NormalMappedCeiling>();
     floors = new List<NormalMappedFloor>();
     enemies = new List<Enemy>();
     environment = new List<IEnvironmentObject>();
     environmentCollidables = new List<AABB>();
 }
コード例 #12
0
        public World(Camera camera)
        {
            this.camera = camera;
            enableParallax = true;

            DrawSkybox = true;

            GameAreas.Add("area0", new Area0Content(camera));
            GameAreas.Add("area1", new Area1Content(camera));
            GameAreas.Add("area2", new Area2Content(camera));
            GameAreas.Add("area3", new Area3Content(camera));
            GameAreas.Add("area4", new Area4Content(camera));
        }
コード例 #13
0
 public Player(Game game, Vector3 position)
     : base(Vector3.Zero, GameConstants.CAM_BOUNDS_PADDING)
 {
     this.game = game;
     camera = new Camera(game);
     game.Components.Add(camera);
     SetCameraProperties();
     EnableColorMap = true;
     PerformPlayerCollision = true;
     playerListener = new AudioListener();
     playerListener.Position = camera.Position;
     playerListener.Forward = camera.ViewDirection;
     playerListener.Up = Vector3.Up;
     inventory = new Inventory();
     PlayerAbleToMove = true;
     MakeFootstepSound = true;
 }
コード例 #14
0
        public void Draw(Camera camera, GraphicsDevice device)
        {
            foreach (ModelMesh mesh in skyboxModel.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World =
                      transforms[mesh.ParentBone.Index]
                     * Matrix.CreateScale(1)
                     * Matrix.CreateTranslation(camera.Position)
                     * Matrix.CreateTranslation(Vector3.Zero);//origo
                    effect.View = camera.ViewMatrix;
                    effect.Projection = camera.ProjectionMatrix;

                    effect.EnableDefaultLighting();
                }
                mesh.Draw();
            }
        }
コード例 #15
0
        public void Draw(Camera camera)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    _effect.DiffuseColor = color;
                    _effect.AmbientLightColor = color;
                    _effect.SpecularColor = color;
                    _effect.World = screenTransforms[mesh.ParentBone.Index]
                        * screenWorldMatrix;
                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #16
0
        public override void Draw(Camera camera, Effect effect)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.FogEnabled = true;
                    _effect.FogStart = 10.0f;
                    _effect.FogEnd = 800;
                    _effect.World = Matrix.Identity
                        * transformation[mesh.ParentBone.Index]
                        * Matrix.CreateRotationX(MathHelper.ToRadians(rotation.X))
                        * Matrix.CreateRotationY(MathHelper.ToRadians(rotation.Y))
                        * Matrix.CreateRotationZ(MathHelper.ToRadians(rotation.Z))
                        * Matrix.CreateScale(modelScale)
                        * Matrix.CreateTranslation(position);

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #17
0
        public void Draw(Camera camera)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect _effect in mesh.Effects)
                {
                    _effect.EnableDefaultLighting();
                    _effect.DiffuseColor = diffColor;// new Vector3(0.8f, 0.8f, 0.8f);
                    _effect.AmbientLightColor = ambColor;// new Vector3(0.8f, 0.8f, 0.8f);
                    _effect.SpecularColor = specColor;// new Vector3(0.8f, 0.8f, 0.8f);
                    _effect.World =
                    Matrix.CreateRotationZ(MathHelper.ToRadians(90f))
                    *Matrix.CreateRotationX(MathHelper.ToRadians(90f))

                    * screenTransforms[mesh.ParentBone.Index]
                    * screenWorldMatrix;

                    _effect.View = camera.ViewMatrix;
                    _effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }
コード例 #18
0
        public void Update(float deltaTime, Camera camera)
        {
            for (int i = 0; i < InventoryItems.Count; i++)
            {
                InventoryItems.ElementAt(i).Key.item.Update(
                    deltaTime, camera,
                    InventoryItems.ElementAt(i).Value);

            }
        }
コード例 #19
0
 public void Draw(Camera camera, Effect effect)
 {
     lever1.Draw(camera, effect);
     lever2.Draw(camera, effect);
 }
コード例 #20
0
 public override void Draw(Camera camera, Microsoft.Xna.Framework.Graphics.Effect effect)
 {
     base.Draw(camera, effect);
     leftDoor.Draw(camera, effect);
     rightDoor.Draw(camera, effect);
 }
コード例 #21
0
 public AreaContent(Camera camera)
 {
     this.camera = camera;
 }
コード例 #22
0
 public virtual void Update(GameTime gameTime, Camera camera)
 {
     float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
     foreach (Enemy enemy in enemies)
     {
         enemy.Update(deltaTime);
     }
     foreach (IEnvironmentObject obj in environment)
     {
         obj.Update(deltaTime);
     }
 }
コード例 #23
0
 public void Draw(Camera camera, Effect effect)
 {
     foreach (IEnvironmentObject lane in AssemblyLanes)
     {
         lane.Draw(camera, effect);
        }
     lineEnd.Draw(camera, effect);
 }
コード例 #24
0
 public override void Update(GameTime gameTime, Camera camera)
 {
     base.Update(gameTime, camera);
 }