// method for creating the Sorcerer Class public Sorcerer() { Name = "Sorcerer"; Strength = 15; Health = 16; FightBehaviour = new SpellBehaviour(); }
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(); }
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()); } } } }
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); } } }
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); }
// Add a behaviour when the spell is casted public Spell AddBehaviour(SpellBehaviour _behaviour) { callback += _behaviour; return(this); }
// Remove a behaviour when the spell is casted public Spell RemoveBehaviour(SpellBehaviour _behaviour) { callback -= _behaviour; return(this); }
/***********************************************************************/ /* * FUNCIONES DE HECHIZO EN TERCER PUESTO */ /***********************************************************************/ // TercerPuesto == 0 private void fasterSpell(SpellBehaviour spellBehaviour) { spellBehaviour.SetSpeed((int)Mathf.Ceil((float)(spellBehaviour.GetSpeed()) * 2.5f)); }