public void CastSummon() { Vector3 mousePosition = Vector3.zero; if (WiimoteStatus.WiiEnabled) { mousePosition = new Vector3(wiiPointer.transform.position.x, wiiPointer.transform.position.y, 5.9f); fireSpell = WiimoteStatus.buttonA; } else { mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 5.9f); fireSpell = Input.GetMouseButton(0); } Vector3 objPosition = Camera.main.ScreenToWorldPoint(mousePosition); if (fireSpell) { summonCount++; if (summonCount == summonSpellLimit) { summonCount = 0; } if (summonList[summonCount] != null) { Destroy(summonList[summonCount].gameObject); } spell.transform.localPosition = new Vector3(objPosition.x, objPosition.y, 5.9f); if ((cs.elementType == ElementType.Dark || cs.elementType == ElementType.Earth) && Vector3.Dot(Vector3.right, objPosition - transform.position) < 0) { if (cs.elementType == ElementType.Earth) { cs.GetComponent <Cannon>().rot -= 180; } else { cs.GetComponent <VoidPortal>().rot = 180; cs.GetComponent <VoidPortal>().pRot = 135; } } spell.SetActiveRecursively(true); summonList[summonCount] = spell; casting = false; } }