public void UseCard(Card card, Tile targetTile, System.Action callback) { CardData cardData = card.Data; string[] strings; switch (cardData.EffectType) { case 0: // Casting ActionManager.Singleton.AddFront(new Casting(ResourceUtility.GetCardEffect(cardData.Effect), targetTile)); SoundManager.Instance.Enhancement(); //gameObject.GetComponent<AudioSource>().PlayOneShot(UseEnhancementCard); break; case 1: // Statistic modification strings = cardData.Effect.Split(':'); SoundManager.Instance.Spell(); ActionManager.Singleton.AddFront(new StatusEffectApplication(new StatusEffect(int.Parse(strings[0]), int.Parse(strings[1])), GridManager.Instance.GetUnit(targetTile))); break; case 2: // Card acquirement strings = cardData.Effect.Split(';'); SoundManager.Instance.AttackMiss(); foreach (string s in strings) { string[] values = s.Split(':'); int n = int.Parse(values[1]); for (int i = 0; i < n; i++) { CardManager.Instance.AddCard(new Card(int.Parse(values[0]))); } } break; case 3: // Single-target var target = GridManager.Instance.GetUnit(targetTile); target.ApplyDamage(Statistics.CalculateDamageOutput(int.Parse(cardData.Effect))); //attacking if (target) { StartCoroutine(target.GetComponent <Enemy>().Hurt()); } break; } callback.Invoke(); }