public bool CheckIfHaveBuildPoints(BuildCard card) { if (gameEnd || waitForContinue) { return(false); } if (currentBBP > 0) { cardObject.GetComponent <CardObject>().SetUp(card.CardType, card.BuildID); cardInHand = card; if (card.CardType == BuildingType.Road) { HighlightBuildableTiles(true, true); } else { HighlightBuildableTiles(true); } checkTileMapCoroutine = StartCoroutine(CheckTileMapHeighlight(card.CardType)); return(true); } else { return(false); } }
internal void PushCard(BuildCard card) { int originalGroup = allCards.FindIndex((list) => list.Find(card.Equals) != null); if (originalGroup == -1) { return; } int tarGroup = GetHoverdGroup(); if (tarGroup == -1) { RemoveCard(card, originalGroup); } else { if (!(card.Data.IsExtra() && tarGroup == 0 || !card.Data.IsExtra() && tarGroup == 1 || tarGroup == originalGroup)) { allCards[originalGroup].Remove(card); allCards[tarGroup].Add(card); allCards[tarGroup].Sort(BuildCard.CompareByPosition); SpreadCard(tarGroup); } deckModified = true; allCards[originalGroup].Sort(BuildCard.CompareByPosition); SpreadCard(originalGroup); } }
public bool CheckIfHaveBuildPoints(BuildCard card) { infoText.text = card.Description; infoName.text = card.BuildingName; tokenImage.SetActive(false); infoCard.SetActive(true); card.transform.parent.transform.SetAsLastSibling(); bool build = gameMaster.CheckIfHaveBuildPoints(card); switch (card.CardType) { case GameHandler.BuildingType.Road: infoImage.sprite = allInfoSprites[0]; break; case GameHandler.BuildingType.Land: infoImage.sprite = allInfoSprites[1]; break; case GameHandler.BuildingType.Park: if (card.BuildID == 0) { infoImage.sprite = allInfoSprites[3]; } else { infoImage.sprite = allInfoSprites[2]; } break; case GameHandler.BuildingType.Stop: infoImage.sprite = allInfoSprites[4]; break; case GameHandler.BuildingType.Clean: infoImage.sprite = allInfoSprites[5]; break; case GameHandler.BuildingType.Build: infoImage.sprite = allInfoSprites[6]; break; case GameHandler.BuildingType.Control: infoImage.sprite = allInfoSprites[7]; break; case GameHandler.BuildingType.Card: infoImage.sprite = allInfoSprites[8]; break; case GameHandler.BuildingType.Start: infoImage.sprite = allInfoSprites[9]; break; } return(build); }
internal void RemoveCard(BuildCard card, int group = -1) { if (group < 0) { group = GetHoverdGroup(); } deckModified = true; allCards[group].Remove(card); cardPool.Store(card); SpreadCard(group); }
internal void CopyCard(BuildCard card) { int group = GetHoverdGroup(); if (group < 0 || IsSideChanging || !CanCopyCard(card.Data)) { return; } BuildCard copy = AddNewCard(card.Data, group); copy.Transform.position = card.Transform.position; deckModified = true; allCards[group].Sort(BuildCard.CompareByPosition); SpreadCard(group); }
internal BuildCard CopyCard(CardData data, Vector2 position, bool dragging = false) { if (!CanCopyCard(data) || IsSideChanging) { return(null); } int targroup = data.IsExtra() ? 1 : 0; BuildCard copy = AddNewCard(data, targroup); copy.Transform.position = MainGame.Instance.MainCamera.ScreenToWorldPoint(new Vector3(position.x, position.y, 95)); if (!dragging) { deckModified = true; allCards[targroup].Sort(BuildCard.CompareByPosition); SpreadCard(targroup); } return(copy); }