Exemplo n.º 1
0
 private void PointerDown()
 {
     if (Mage.CanAfford(Shield))
     {
         ActualShield = new GameObject();
         ActualShield.AddComponent <ShieldComponent>().Prepare(Shield, Mage, this);
         ActualShield.transform.parent = transform.parent;
     }
 }
 public void Cast(Vector3 direction)
 {
     if (Caster.CanAfford(Spell))
     {
         Vector2 pos         = WhereToCastFrom.GetComponent <Transform>().position;
         float   meRadius    = WhereToCastFrom.GetComponent <RectTransform>().GetHeight() / 2;
         float   spellRadius = GetComponent <RectTransform>().GetHeight() / 2;
         float   x           = pos.x + direction.x * (meRadius + spellRadius);
         float   y           = pos.y + direction.y * (meRadius + spellRadius);
         CastListener.CastIt(Caster, Spell, new Vector2(x, y), direction);
         Casted = true;
     }
 }