Ejemplo n.º 1
0
        public void CastSpell(GameObject instigater, Transform target,
                              Transform[] hands, int casterLevel)
        {
            if (spellLevel > casterLevel)
            {
                return;
            }
            Vector3    startLoc    = hands[0].position;
            GameObject spellObject = Instantiate(spellPrefab, startLoc, Quaternion.identity);

            spellObject.transform.parent = GameObject.Find(Constant.temperaryGameObjectName).transform;
            CastSpell spellInstance = spellObject.GetComponent <CastSpell>();

            spellInstance.InitializeTargeting(target.GetComponent <Health>(), numberOfTargets, cantMiss, attackType, areaOfEffect);
            spellInstance.InitializeSpell(CalculateDamage(casterLevel), GetRange(casterLevel), Constant.speed, instigater);
            // TODO decrease mana/magical energy count in inventory
        }