private void SwitchPrev() { BaseTile oldPrev = this.Prev; this.Prev = DisconnectedTile; DisconnectedTile = oldPrev; }
private void GameTimer(object sender, EventArgs e) { int tPoint = r.Next(1, 4); List <BaseTile> tileList = _board.GetTiles(); for (int i = tileList.Count; i-- > 0;) { BaseTile currentTile = tileList[i]; // Do action for specific tile currentTile.DoAction(this); // Check for collission if (currentTile.CheckIfCollission()) { GameOver(); break; } } if (CartStart()) { Cart c = new Cart(); _view.PlaceCart(_startY[tPoint - 1]); InsertCart(c, _startY[tPoint - 1]); } }
private void SwitchNext() { BaseTile oldNext = this.Next; this.Next = DisconnectedTile; DisconnectedTile = oldNext; }
private bool CanMoveThroughSwitch(BaseTile tile) { if (tile.Next == null) { return(true); } return(tile.Equals(tile.Next.Prev)); }
private bool CheckCartCollision(BaseTile tile) { if (tile.Next == null) { return(true); } return(tile.Next.Cart == null); }
public virtual BaseTile ChainTiles(BaseTile tileTo) { if (tileTo != null) { this.Next = tileTo; if (tileTo.Prev == null) { tileTo.Prev = this; } else { tileTo.DisconnectedTile = this; } } return(tileTo); }
public void addVisualObject(BaseTile tile) { Image img = new Image(); img.Visibility = Visibility.Visible; string type = tile.GetType().ToString().Split('.').Last(); img.Source = new BitmapImage(new Uri(@"Assets/Images/" + type + tile.Direction + ".png", UriKind.Relative)); if (type == "SwitchTile") { img.MouseEnter += Img_MouseEnter; img.MouseDown += Img_MouseDown; } img.Width = 50; img.Height = 50; tPart.Children.Add(img); Grid.SetColumn(img, (int)tile.Pos.X); Grid.SetRow(img, 7 - (int)tile.Pos.Y); }
public override BaseTile ChainTiles(BaseTile tileTo) { if (tileTo != null) { tileTo.Prev = this; if (this.Next == null) { this.Next = tileTo; this.Type = TileType.Backward; } else { this.DisconnectedTile = tileTo; this.Type = TileType.Forward; } } return(tileTo); }
private bool CheckIfRestTile(BaseTile tile) { return(tile.GetType() == typeof(RestTile)); }