Exemplo n.º 1
0
 /// <summary>
 /// Constructs a new camera.
 /// </summary>
 /// <param name="game">Game that this camera belongs to.</param>
 /// <param name="position">Initial position of the camera.</param>
 /// <param name="target">Position of the target</param>
 /// <param name="speed">Initial movement speed of the camera.</param>
 public Camera(PlayScreen ps, Vector3 position,Vector3 target, float speed)
 {
     Ps = ps;
     Position = position;
     Speed = speed;
     //frustum
     ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 4f / 3f, .1f, 10000.0f);
     WorldMatrix = Matrix.CreateWorld(Vector3.Zero, target - Position, Vector3.Up);
     ViewMatrix = Matrix.CreateLookAt(Position, target, Vector3.Up);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new StaticModel.
        /// </summary>
        /// <param name="model">Graphical representation to use for the entity.</param>
        /// <param name="transform">Base transformation to apply to the model before moving to the entity.</param>
        /// <param name="game">Game to which this component will belong.</param>
        public StaticModel(Model model, Matrix transform, Game game,PlayScreen ps)
            : base(game)
        {
            this.Enabled = false;
            this.Visible = false;
            this.model = model;
            this.Transform = transform;
            this.ps = ps;

            //Collect any bone transformations in the model itself.
            //The default cube model doesn't have any, but this allows the StaticModel to work with more complicated shapes.
            boneTransforms = new Matrix[model.Bones.Count];
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                }
            }
        }
Exemplo n.º 3
0
        public Engine()
        {
            graphics = new GraphicsDeviceManager(this);
            balanceBoard = new Wiimote();
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferredBackBufferWidth = 1000;
            graphics.ToggleFullScreen();

            Content.RootDirectory = "Content";
            usingBalanceBoard = false;
            balanceBoards = new WiimoteCollection();
            //old
            //level = new PlayScreen(this,balanceBoard);
            level = new PlayScreen(this, balanceBoards);
            //old
            //menu = new Menu(this, balanceBoard);
            menu = new Menu(this, balanceBoards);
            saveScore = new SaveScore(this);
            this.Components.Add(menu);
            this.Components.Add(saveScore);
            this.Components.Add(level);
            status = 0;
        }