Exemple #1
0
        public GameplayScreen(int dimensions)
        {
            this.dimensions = dimensions;

            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            board = new Board2D(10, 10, this);
            camera = new Camera(board.Width, board.Height, 1280f / 720f);
        }
Exemple #2
0
        public void Draw(Camera cam, GameTime gameTime)
        {
            if (isActive)
            {
                Matrix[] transforms = new Matrix[model.Bones.Count];
                model.CopyAbsoluteBoneTransformsTo(transforms);

                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        effect.EnableDefaultLighting();
                        effect.PreferPerPixelLighting = true;
                        effect.World = CurrentWorld * transforms[mesh.ParentBone.Index] *
                                        Matrix.CreateRotationX(MathHelper.ToRadians(90)) *
                                        Matrix.CreateScale(new Vector3(1.0f, 1.0f, 0.1f));
                        if (isSelected)
                        {
                            if (glowAmount > 1.0f) glowAmount = 0.0f;
                            glowAmount += 0.02f;
                            effect.AmbientLightColor = color.ToVector3() + new Vector3(glowAmount, glowAmount, glowAmount);
                        }
                        else
                        {
                            effect.AmbientLightColor = color.ToVector3();
                        }
                        effect.View = cam.ViewMatrix;
                        effect.Projection = cam.ProjectionMatrix;
                    }
                    mesh.Draw();
                }
            }
        }
Exemple #3
0
 public void Draw(Matrix[] instancedTransforms, Camera cam)
 {
     // Draw instanced model
 }