Example #1
0
 private void SubtractCost(Spell spell)
 {
     if (!_resourceCollector)
     {
         _resourceCollector = GameObject.FindWithTag("ResourceCollector").GetComponent <ResourceCollector>();
     }
     _resourceCollector.AddEssence("red", -spell.cost["red"]);
     _resourceCollector.AddEssence("blue", -spell.cost["blue"]);
     _resourceCollector.AddEssence("green", -spell.cost["green"]);
     _resourceCollector.AddEssence("yellow", -spell.cost["yellow"]);
 }
Example #2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.name == "Player")
     {
         _resourceCollector.AddEssence(color, transform.childCount - 1);
         _resourceGenerator.NotifyCollectedEssence(_spawnNumber);
         Destroy(gameObject);
     }
 }