List <Card> GetCards() { //return JsonUtility.FromJson<CardsContainer>(json).entries; var cards = new CardsContainer(); var list = cards.entries; int i = 0; for (i = 0; i < 50; i++) { list.Add(CreateCard(i, CardCategory.Talk, typeof(TalkCategory))); } for (; i < 80; i++) { list.Add(CreateCard(i, CardCategory.Emotion, typeof(EmotionCategory))); } for (; i < 110; i++) { list.Add(CreateCard(i, CardCategory.Action, typeof(ActionCategory))); } // Debug.Log(JsonUtility.ToJson(cards, true)); return(list); }
private void Awake() { animatorHandler = GetComponentInChildren <AnimatorHandler>(); inputHandler = GetComponent <InputHandler>(); cards = this.GetComponent <CardsContainer>(); //Time.timeScale = 0.2f; //anim = GetComponentInChildren<Animator>(); }
public BoardState(List <Player> players) { Players = players; Field = new CardHolder(); DoorDeck = new CardHolder(); DoorTrash = new CardHolder(); TreasureDeck = new CardHolder(); TreasureTrash = new CardHolder(); Random r = new Random(); int k; List <Card> cards = CardsContainer.GetCards(); for (int i = 1; i <= DOORS_COUNT; i++) { foreach (var p in Players) { try { k = r.Next(cards.Where(x => x.Type == CardType.Dungeon).Count() - 1); } catch { k = 0; } Card c = cards.Where(x => x.Type == CardType.Dungeon).ElementAt(k); p.Hand.Cards.Add(c); cards.Remove(c); } } for (int i = 1; i <= TREASURES_COUNT; i++) { foreach (var p in Players) { try { k = r.Next(cards.Where(x => x.Type == CardType.Treasure).Count() - 1); } catch { k = 0; } Card c = cards.Where(x => x.Type == CardType.Treasure).ElementAt(k); p.Hand.Cards.Add(c); cards.Remove(c); } } DoorDeck.Cards.AddRange(cards.Where(x => x.Type == CardType.Dungeon)); TreasureDeck.Cards.AddRange(cards.Where(x => x.Type == CardType.Treasure)); }
void Start() { cam = Camera.main; viewVisual = true; skillWheelPanel.SetActive(false); currentSkill = skills[0]; baseColor = skillsImg[0].color; anim = GetComponentInChildren <AnimatorHandler>(); cards = FindObjectOfType <CardsContainer>(); if (FindObjectOfType <PlayerPassives>() != null) { foreach (var item in skills) { item.cooldownTime = item.cooldownTime - (item.cooldownTime * PlayerPassives.instance.cooldownBonus); } } }
public bool AddCard(int cardId) { if (GetCardById(cardId) != null) { return(false); } Card card = CardsContainer.GetCards().Where(c => c.Id == cardId).FirstOrDefault(); if (card == null) { return(false); } Cards.Add(card); return(true); }
public void Awake() { if (me is Enemy) { maxHealth = this.GetComponent <Enemy>().config.maxHealth; } if (this.GetComponent <PlayerMovement>()) { imPlayer = true; card = this.GetComponent <CardsContainer>(); } me = this.GetComponent <Entity>(); if (me is PlayerManager) { anim = GetComponentInChildren <Animator>(); if (FindObjectOfType <PlayerPassives>() != null) { maxHealth = maxHealth + (maxHealth * PlayerPassives.instance.healthBonus); } } health = maxHealth; }
public void Awake() { boardCreator = this.transform.Find("Board").GetComponent <BoardCreator>(); cardsContainer = this.transform.Find("CardsContainer").GetComponent <CardsContainer>(); }