Ejemplo n.º 1
0
 public Border(Field field)
 {
     this.startX = field.TopLeftPlayGround.X;//4
     this.endX = field.BottomRightPlayGround.X;//Game.Width - 20
     this.startY = field.TopLeftPlayGround.Y;//10
     this.endY = field.BottomRightPlayGround.Y;//Game.Height - 5
 }
Ejemplo n.º 2
0
 public IEnumerable<CollisionInfo> Collide(Field field)
 {
     List<CollisionInfo> result = new List<CollisionInfo>();
     foreach (Pixel pixel in this.Body)
     {
         if (pixel.Coordinate.X <= field.TopLeftPlayGround.X)
         {
             result.Add(CollisionInfo.LeftBorder);
         }
         if (pixel.Coordinate.X >= field.BottomRightPlayGround.X)
         {
             result.Add(CollisionInfo.RightBorder);
         }
         if (pixel.Coordinate.Y <= field.TopLeftPlayGround.Y)
         {
             result.Add(CollisionInfo.TopBorder);
         }
         if (pixel.Coordinate.Y >= field.BottomRightPlayGround.Y)
         {
             result.Add(CollisionInfo.BottomBorder);
         }
         if (field.Earth.Contains(pixel))
         {
             result.Add(CollisionInfo.Earth);
         }
     }
     return result;
 }
Ejemplo n.º 3
0
        public Engine(Field field)
        {
            this.Field = field;

            this.ClockTimer = new Timer(1000);
            this.KeyPressTimer = new Timer(10);
            this.PlayGameTimer = new Timer(Game.Speed);

            this.Field.FallingObject = GetRandomObject();
            this.Field.NextFallingObject = new NextFallingObject(this.Field, GetRandomObject());

            this.KeyPressTimer.TimerChanged += new EventHandler(OnKeyPress);
            this.KeyPressTimer.Play();
            this.PlayGameTimer.TimerChanged += new EventHandler(OnGameMoveOn);
            this.PlayGameTimer.Play();

            this.ClockTimer.TimerChanged += new EventHandler(OnClockTimer);
        }
 public OutOfPlayGroundExeption(Field field, string message, Exception innerException)
     : base(message, innerException)
 {
     TopLeft = field.TopLeftPlayGround;
     BottomRight = field.BottomRightPlayGround;
 }
 public OutOfPlayGroundExeption(Field field)
     : this(field, String.Format("An object was drawn outside field boundary!"), null)
 {
 }
 public OutOfPlayGroundExeption(Field field, string message)
     : this(field, message, null)
 {
 }
Ejemplo n.º 7
0
 public Clock(Field field)
 {
     this.time = new TimeSpan();
     this.x = field.BottomRightPlayGround.X;
     this.y = field.TopLeftPlayGround.Y - 3;
 }
Ejemplo n.º 8
0
 public Score(Field field, int score)
 {
     this.x = field.BottomRightPlayGround.X;
     this.y = field.TopLeftPlayGround.Y;
     this.YourScore = score;
 }
Ejemplo n.º 9
0
 public Score(Field field)
     : this(field, 0)
 {
 }
Ejemplo n.º 10
0
 public NextFallingObject(Field field, FallingObject fallingObject)
 {
     this.FallingObject = fallingObject;
     this.x = field.BottomRightPlayGround.X;
     this.y = field.TopLeftPlayGround.Y;
 }
Ejemplo n.º 11
0
 public ControlsInfo(Field field)
 {
     this.x = field.BottomRightPlayGround.X;
     this.y = field.TopLeftPlayGround.Y;
 }