public void LoadGolem(Golem golem) { Debug.Log("golem ready"); Debug.Assert(golem != null); this.golem = golem; Head.card = golem.Head; Chest.card = golem.Chest; Legs.card = golem.Legs; Head.UpdateCard(); Chest.UpdateCard(); Legs.UpdateCard(); }
public void generateGolem() { //if one of the cards is empty if (Head.card.IsNull || Chest.card.IsNull || Legs.card.IsNull || Shelf.Instance.IsGolemReady()) { audio.PlayOneShot(errorClip); return; } Golem golem = new Golem(Head.card, Chest.card, Legs.card); Shelf.Instance.LoadGolem(golem); if (Head.card.graphictype == Constants.H_SNOWHEAD && Chest.card.graphictype == Constants.C_SNOWBODY && Legs.card.graphictype == Constants.LS_SNOWLEG) { audio.PlayOneShot(slotMachinecClip); } else { audio.PlayOneShot(buildClip); } Head.card.part = BodyPart.None; Chest.card.part = BodyPart.None; Legs.card.part = BodyPart.None; Head.UpdateCard(); Chest.UpdateCard(); Legs.UpdateCard(); }
public void AddCard() { freeSlot = -1; int heads = 0, chests = 0, legs = 0, empty = 0; for (int i = 0; i < slots.Length; i++) { HandSlot slot = slots[i]; if (slot.SlotEnabled) { Card c = slot.Card; if (c.IsNull) { empty++; if (freeSlot < 0) { freeSlot = i; } } else { switch (c.part) { case BodyPart.Head: heads++; break; case BodyPart.Chest: chests++; break; case BodyPart.Legs: legs++; break; } } } } if (empty == 0) { return; } if (!Deck.Instance.DrawCard()) { return; } switch (empty) { case 1: if (heads == 0) { newPart = BodyPart.Head; } else if (chests == 0) { newPart = BodyPart.Chest; } else if (legs == 0) { newPart = BodyPart.Legs; } else { newPart = randomPart(); } break; case 2: if (heads == 0) { if (chests == 0) { newPart = randomPart(BodyPart.Head, BodyPart.Chest); } else if (legs == 0) { newPart = randomPart(BodyPart.Head, BodyPart.Legs); } else { newPart = randomPart(); } } else if (chests == 0 && legs == 0) { newPart = randomPart(BodyPart.Chest, BodyPart.Legs); } else { newPart = randomPart(); } break; default: newPart = randomPart(); break; } Card card = slidingCardVis.card; card.part = newPart; CardDatabase.Instance.RandomGraphic(card); card.GenerateAttributes(); slidingCardVis.UpdateCard(); }
public void UpdateCard() { cardVis.UpdateCard(); }
public void SetLegs(CardVisualizer legs) { Legs.card.Swap(legs.card); legs.UpdateCard(); this.Legs.UpdateCard(); }
public void SetChest(CardVisualizer chest) { Chest.card.Swap(chest.card); chest.UpdateCard(); this.Chest.UpdateCard(); }
public void SetHead(CardVisualizer head) { Head.card.Swap(head.card); head.UpdateCard(); this.Head.UpdateCard(); }