Beispiel #1
0
 public LoadLevel(String filename, Scene scene)
 {
     this.scene = (Game1) scene;
     ParseCSV(ReadFile(filename));
     SortBricks(); //sort bricks before generating brick positions;
     GenerateBrickPos();
 }
Beispiel #2
0
 public Court(Game1 scene) : base(scene)
 {
     this.scene = scene;
     Position = new Vector3(0, 0, 0); //save modified position
     Transform = Matrix.CreateScale(Game1.scaleRatio, Game1.scaleRatio, Game1.scaleRatio)*
                 Matrix.CreateRotationX((float) Math.PI)*Matrix.CreateTranslation(Position);
     Model = scene.game.Content.Load<Model>("Models/Court");
     LocalTransforms = new Matrix[Model.Bones.Count];
 }
Beispiel #3
0
        public Ball(Game1 scene) : base(scene)
        {
            this.scene = scene;
            Model = scene.game.assetManager.getBallModel(balls.Normal);

            //Position = new Vector3(0, 0, 2900f); //save modified position
            Position = scene.paddlePos;
            LocalTransforms = new Matrix[Model.Bones.Count];
            RotateV = new Vector3(0, MathHelper.ToRadians(3), 0);
        }
        public KinectManager(Scene s)
        {
            scene = (Game1) s;
            try
            {
                KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged;
                DiscoverKinectSensor();

                Debug.WriteLineIf(scene.debugging, kinect.Status);
                joint = scene.game.Content.Load<Texture2D>("Sprites/joint");
                hand = scene.game.Content.Load<Texture2D>("Sprites/hand");
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
            }
        }
Beispiel #5
0
        protected override void Initialize()
        {
            //GraphicsDevice does not exist in the constructor, so the game must be resized here.
            //graphics.IsFullScreen = true; // make it fullscreen
            graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width; //set game width to screen width
            graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height; //set game height to screen height

            //SamplerState sstate = new SamplerState();
            //sstate.AddressU = TextureAddressMode.Wrap;
            //sstate.AddressV = TextureAddressMode.Wrap;
            //sstate = SamplerState.PointWrap;
            //GraphicsDevice.SamplerStates[0] = sstate;

            //GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
            //GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Wrap;
            GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
                //turn off texture blurring for nice sharp retro look

            graphics.ApplyChanges();

            intro = new Intro(this);
            intro.Enabled = true;
            intro.Visible = true;

            menu = new Menu(this);
            menu.Enabled = false;
            menu.Visible = false;

            game = new Game1(this);
            game.Enabled = false;
            game.Visible = false;


            Components.Add(intro);
            Components.Add(menu);
            Components.Add(game);

            base.Initialize();
        }
Beispiel #6
0
        // public Game1 scene;


        public Brick(Game1 scene, Vector3 gridPos, float brickSize) : base(scene)
        {
            this.scene = scene;
            GridPos = gridPos;
            Type = BrickType.Normal; //set brick type
            Model = scene.game.assetManager.getBrickModel(Type); //load normal brick model

            Position = new Vector3(GridPos.X*brickSize*Game1.scaleRatio, GridPos.Y*brickSize*Game1.scaleRatio,
                GridPos.Z*brickSize*Game1.scaleRatio);

            Transform = Matrix.CreateScale(Game1.scaleRatio, Game1.scaleRatio, Game1.scaleRatio)*
                        Matrix.CreateTranslation(Position);

            LocalTransforms = new Matrix[Model.Bones.Count];
            /*
            Vector3[] brickPoints = new Vector3[2];
            brickPoints[0] = new Vector3(Position.X - (brickSize/2), Position.Y - (brickSize/2), Position.Z - (brickSize/2));
            brickPoints[1] = new Vector3(Position.X + (brickSize/2), Position.Y + (brickSize/2), Position.Z + (brickSize/2));
            bounding = BoundingBox.CreateFromPoints(brickPoints);
            */
            World = Matrix.CreateTranslation(Position);
        }
Beispiel #7
0
 public Player(Scene scene)
 {
     this.scene = (Game1)scene;
     width = scene.game.GraphicsDevice.Viewport.Width;
     height = scene.game.GraphicsDevice.Viewport.Height;
 }
Beispiel #8
0
 public GameObject(Game1 scene)
 {
     this.scene = scene;
 }