public RemoveSurfaceMessage(SurfaceModel surface)
 {
     Surface = surface;
 }
示例#2
0
        public void SetupGame()
        {
            _distancePassed = 0;
            Score = 0;
            Bird = new BirdModel(UnitType.Bird, BirdJumpSpeed, MinBirdJumpFactor)
            {
                Width = _screenWidth * BirdWidthFactor,
                Height = _screenHeight * BirdHeightFactor,
                Acceleration = new Vector { X = 0, Y = Gravity },
                ScaleFactor = _scale,
            };
            Bird.Position = new Vector
            {
                X = (_screenWidth + Bird.Width) / 2,
                Y = (_screenHeight + Bird.Height) / 8
            };
            Bird.Collision += BirdCollisionEvent;

            SurfaceModel floor = new SurfaceModel(UnitType.Floor)
            {
                Velocity = Vector.Zero,
                Width = _screenWidth,
                Height = _screenHeight * FloorHeightFactor,
                Position = new Vector { X = 0, Y = _screenHeight * (1 - FloorHeightFactor) },
                ScaleFactor = _scale,
            };
            floor.Collision += NonBirdCollisionEvent;

            SurfaceModel ceiling = new SurfaceModel(UnitType.Ceiling)
            {
                Velocity = Vector.Zero,
                Width = _screenWidth,
                Height = 10,
                Position = new Vector { X = 0, Y = -9.6 },
                ScaleFactor = _scale,
            };
            ceiling.Collision += NonBirdCollisionEvent;

            UnitCollection.Clear();

            UnitCollection.Add(Bird);
            UnitCollection.Add(floor);
            UnitCollection.Add(ceiling);
            CreatePipe();
        }