protected void buildDeck() { for (int i = 0; i < 10; i++) { Handful.Add(Resources.Load("Chains")); Handful.Add(Resources.Load("Fire")); Handful.Add(Resources.Load("Water")); Handful.Add(Resources.Load("Earth")); Handful.Add(Resources.Load("Fire")); Handful.Add(Resources.Load("Boomerang")); Handful.Add(Resources.Load("Lightning")); } Shuffle(Handful); //Placeholder Fils Deck with Lighnin and Eart Spells for (int i = 0; i < 10; i++) { Handful_2.Add(Resources.Load("Chains")); Handful_2.Add(Resources.Load("Wind")); Handful_2.Add(Resources.Load("Water")); Handful_2.Add(Resources.Load("Earth")); Handful_2.Add(Resources.Load("Fire")); Handful.Add(Resources.Load("Boomerang")); Handful.Add(Resources.Load("Lightning")); } Shuffle(Handful_2); }
public void showReloadScreen(int num) { pause = true; if (num == 1) { p1reload = true; foreach (GameObject g in bulletIndicators) { g.SetActive(true); } for (int i = 0; i < spellSlots.Count; i++) { spellSlots [i].GetComponent <Image> ().sprite = defaultSlot; spellSlots [i].GetComponent <Image> ().color = Color.white; } for (int i = Temp.Count - 1; i > -1; i--) { if (Temp [i] != null) { Temp.RemoveAt(i); } if (TempNum [i] != null) { Handful.RemoveAt(TempNum [i]); TempNum.RemoveAt(i); } } for (int i = 0; i < pauseObjects.Length; i++) { if (i < Handful.Count) { pauseObjects [i].SetActive(true); } else { pauseObjects [pauseObjects.Length - 1].SetActive(true); } } for (int i = 0; i < battleObjects.Length; i++) { if (battleObjects[i] != null) { battleObjects [i].SetActive(false); } } for (int i = 0; i < pauseUI.Length; i++) { pauseUI [i].SetActive(true); } selectButton(); for (int i = 0; i < spellHold.children.Count; i++) { Button b = spellHold.children [i].gameObject.GetComponent <Button> (); int currentHolder = i; b.onClick.RemoveAllListeners(); b.onClick.AddListener(delegate { addBullet(currentHolder); }); if (Handful.Count > i) { GameObject curSpell = ((GameObject)Resources.Load(Handful [i].name)); curSpell.GetComponent <Spell> ().setDescription(player.weapon); b.GetComponent <Image> ().sprite = curSpell.GetComponent <Spell> ().bulletImage; if (b.GetComponent <Image> ().sprite.name == "Knob") { b.GetComponent <Image> ().color = curSpell.GetComponent <SpriteRenderer> ().color; } else { b.GetComponent <Image> ().color = Color.white; } RuneInfo r = spellHold.children [i].gameObject.GetComponent <RuneInfo> (); r.runeName = curSpell.GetComponent <Spell>().name; r.runeImage = curSpell.GetComponent <Spell> ().runeImage; r.runeDamage = curSpell.GetComponent <Spell>().damage.ToString(); r.runeDesc = curSpell.GetComponent <Spell> ().description; } } } else { p2reload = true; foreach (GameObject g in bulletIndicators_2) { g.SetActive(true); } for (int i = 0; i < spellSlots_2.Count; i++) { spellSlots_2[i].GetComponent <Image>().sprite = defaultSlot; spellSlots_2[i].GetComponent <Image>().color = Color.white; } for (int i = Temp_2.Count - 1; i > -1; i--) { if (Temp_2 [i] != null) { Temp_2.RemoveAt(i); } if (TempNum_2 [i] != null) { Handful_2.RemoveAt(TempNum_2 [i]); TempNum_2.RemoveAt(i); } } for (int i = 0; i < pauseObjects_p2.Length; i++) { if (i < Handful_2.Count) { pauseObjects_p2 [i].SetActive(true); } else { pauseObjects_p2 [pauseObjects.Length - 1].SetActive(true); } } for (int i = 0; i < battleObjects_2.Length; i++) { if (battleObjects_2[i] != null) { battleObjects_2 [i].SetActive(false); } } for (int i = 0; i < pauseUI_2.Length; i++) { pauseUI_2 [i].SetActive(true); } selectButton_2(); for (int i = 0; i < spellHold_2.children.Count; i++) { Button b = spellHold_2.children [i].gameObject.GetComponent <Button> (); int currentHolder = i; b.onClick.RemoveAllListeners(); b.onClick.AddListener(delegate { addBullet_2(currentHolder); }); if (Handful_2.Count > i) { GameObject curSpell = ((GameObject)Resources.Load(Handful_2 [i].name)); curSpell.GetComponent <Spell> ().setDescription(player2.weapon); b.GetComponent <Image> ().sprite = curSpell.GetComponent <Spell> ().bulletImage; if (b.GetComponent <Image> ().sprite.name == "Knob") { b.GetComponent <Image> ().color = curSpell.GetComponent <SpriteRenderer> ().color; } else { b.GetComponent <Image> ().color = Color.white; } RuneInfo r = spellHold_2.children [i].gameObject.GetComponent <RuneInfo> (); r.runeName = curSpell.GetComponent <Spell>().name; r.runeImage = curSpell.GetComponent <Spell> ().runeImage; r.runeDamage = curSpell.GetComponent <Spell>().damage.ToString(); r.runeDesc = curSpell.GetComponent <Spell> ().description; } } } }