// method for creating the Sorcerer Class
 public Sorcerer()
 {
     Name           = "Sorcerer";
     Strength       = 15;
     Health         = 16;
     FightBehaviour = new SpellBehaviour();
 }
Esempio n. 2
0
    void FinishCast(Player caster, Player target, Spell spell)
    {
        SpellBehaviour Spell = Instantiate(SpellPrefabs[spell.SpellPrefabIndex], caster.GameObject.transform.position, Quaternion.Euler(0, 0, 0)).GetComponent <SpellBehaviour>();

        Spell.Target = target.GameObject;
        Spell.Spell  = spell;
    }
 // method for creating the Sorcerer Class
 public Sorcerer()
 {
     Name = "Sorcerer";
     Strength = 15;
     Health = 16;
     FightBehaviour = new SpellBehaviour();
 }
Esempio n. 4
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.transform.tag == "Spell")
        {
            SpellBehaviour spell = other.gameObject.GetComponent <SpellBehaviour>();

            if (token != spell.GetToken()) // Comparamos token del jugador que lo lanzó con el token de este
            {
                _playerData.DamagePlayer(spell.GetDamage());
                if (_playerData.GetHealth() <= 0)
                {
                    _playerData.PlayerDead(spell.GetToken());
                }
            }
        }
    }
Esempio n. 5
0
 public void Cast()
 {
     if (Spell != null)
     {
         float manaCost = Spell.GetComponent <SpellBehaviour>().ManaCost;
         if (Mana >= manaCost && Time.time > nextSpell)
         {
             nextSpell = Time.time + SpellDelay + SpellDelayModifier;
             Mana     -= manaCost;
             SpellBehaviour spell = Instantiate(Spell, transform.position, transform.rotation)
                                    .GetComponent <SpellBehaviour>();
             spell.SetShooterTag(ShooterTag);
             StatisticsUI.Instance.MPUpdate(Mana, MaxMana);
             Debug.Log("Casting " + spell.name);
         }
     }
 }
Esempio n. 6
0
    private GameObject InstantiateSpellGroup(Spell[] spellTypes, Vector3 position, Vector3 direction)
    {
        GameObject spell = (GameObject)Instantiate(_spellPrefab, position + direction * 1.15f, Quaternion.identity);

        SpellBehaviour sbehaviour = spell.GetComponent <SpellBehaviour>();
        SpellDisplay   sdisplay   = spell.GetComponent <SpellDisplay>();

        sbehaviour.SetDirection(direction);
        sbehaviour.SetSpeed(spellTypes[1].speed);
        sbehaviour.SetDamage(spellTypes[1].damage);
        sbehaviour.SetToken(_playerData.Token);

        /*
         * FALTA:
         * - La animación del primer puesto
         */
        sdisplay._renderer.sprite = groupSpell;
        sdisplay._renderer.color  = spellTypes[1].elementoSegundoPuesto; // funciona

        if (spellTypes.Length == 3)
        {
            switch (spellTypes[2].funcionTercerPuesto)
            {
            case 0:
                fasterSpell(sbehaviour);
                break;

            default:
                fasterSpell(sbehaviour);
                break;
            }
        }

        spell.SetActive(true);

        return(spell);
    }
Esempio n. 7
0
 // Add a behaviour when the spell is casted
 public Spell AddBehaviour(SpellBehaviour _behaviour)
 {
     callback += _behaviour;
     return(this);
 }
Esempio n. 8
0
 // Remove a behaviour when the spell is casted
 public Spell RemoveBehaviour(SpellBehaviour _behaviour)
 {
     callback -= _behaviour;
     return(this);
 }
Esempio n. 9
0
    /***********************************************************************/

    /*
     * FUNCIONES DE HECHIZO EN TERCER PUESTO
     */
    /***********************************************************************/

    // TercerPuesto == 0
    private void fasterSpell(SpellBehaviour spellBehaviour)
    {
        spellBehaviour.SetSpeed((int)Mathf.Ceil((float)(spellBehaviour.GetSpeed()) * 2.5f));
    }