public void DrawAssets() { foreach (GameObject go in AssetObjects) { Destroy(go); } AssetObjects.Clear(); float space = (StorageEnd.position.x - StorageStart.position.x) / 5.0f; int i = 0; foreach (Card card in GameLogicManager.Instance.PlayerAssets.Skip(CurrentAssetIndex).Take(6)) { if (card == null) { ++i; continue; } GameObject go = GameObject.Instantiate(AssetPrefab, StorageStart.position + Vector3.right * space * i, Quaternion.identity, transform); AssetObjects.Add(go); UICard uiCard = go.GetComponent <UICard>(); uiCard.CardData = card; uiCard.UpdateCardData(); uiCard.IsInAssets = true; ++i; } }
public void DrawRiver() { foreach (GameObject go in RiverObjects) { Destroy(go); } RiverObjects.Clear(); float space = (RiverEnd.position.x - RiverStart.position.x) / 6.0f; int i = 0; List <Card> cardsInBottomRow = IsRiverShown ? GameLogicManager.Instance.PlayerRiver : GameLogicManager.Instance.PlayerObjectives; foreach (Card card in cardsInBottomRow) { if (card == null) { ++i; continue; } GameObject go = GameObject.Instantiate(CardPrefab, RiverStart.position + Vector3.right * space * i, Quaternion.identity, transform); RiverObjects.Add(go); UICard uiCard = go.GetComponent <UICard>(); uiCard.CardData = card; uiCard.UpdateCardData(); ++i; } if (IsRiverShown) { Vector3 linePos = Line.transform.position; linePos.x = 3 * Mathf.Max(GameLogicManager.Instance.PlayerResources.RiverSize - 3, 0); Line.transform.position = linePos; } Line.SetActive(IsRiverShown); }