public override void Initialize(GameObject obj)
 {
     caster        = obj.GetComponent <AbilityCaster>();
     this.aDamage  = damage;
     this.aRange   = range;
     this.aRCForce = force;
 }
Exemple #2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         AbilityCaster caster = other.GetComponentInChildren <AbilityCaster>();
         caster.AddAbility(abilityObject);
         Destroy(gameObject);
     }
 }
 public virtual bool Remove(AbilityCaster caster)
 {
     if (caster.HasAbility(order))
     {
         caster.Remove(caster.Get(index));
         return(true);
     }
     return(false);
 }
 public virtual bool Add(AbilityCaster caster)
 {
     if (caster.HasAbility(order) == false)
     {
         caster.Add(new AbilityInfo(this));
         return(true);
     }
     return(false);
 }
Exemple #5
0
    public override void Initialize(GameObject obj)
    {
        caster        = obj.GetComponent <AbilityCaster>();
        characterSkin = obj.GetComponent <MeshRenderer>();

        this.aCharacterSkin   = characterSkin;
        this.aStat            = stat;
        this.aEffect          = effect;
        this.aEnhanceMaterial = enhancerMaterial;
    }
    public override bool Add(AbilityCaster caster)
    {
        if (base.Add(caster) == false)
        {
            return(false);
        }

        caster.Owner.Damaged += Owner_Damaged;
        return(true);
    }
Exemple #7
0
 public override bool Add(AbilityCaster caster)
 {
     if (base.Add(caster) == false)
     {
         return(false);
     }
     caster.Get(index).usableAmount.Add(0);
     caster.Owner.Attack += Owner_Attack;
     return(true);
 }
Exemple #8
0
    void Awake()
    {
        _caster       = GetComponent <AbilityCaster>();
        _eventHandler = GetComponent <EventHandler>();
        _targeting    = GetComponent <CharacterTargeting>();
        _floatingText = GetComponent <CharacterFloatingText>();
        _meleeVector  = GetComponent <CharacterMeleeVector>();

        AttackPower = _template.AttackPower;
        Armor       = _template.Armor;
        Health      = _template.Health;
        Dead        = false;
    }
 // Start is called before the first frame update
 void Start()
 {
     mover      = GetComponent <Mover>();
     controller = GetComponent <NPCcontroller>();
     health     = GetComponent <Health>();
     if (attackerScript == null)
     {
         attackerScript = GetComponent <Attacker>();
     }
     if (abilityCaster == null)
     {
         abilityCaster = GetComponent <AbilityCaster>();
     }
 }
Exemple #10
0
    //This and below could also be in the health script, However I am not sure if that is what we want
    private void OnSceneLoaded(Scene thescene, LoadSceneMode amode)
    {
        Variables = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthScript>();

        if (PlayerPrefs.GetInt("PlayerHealth") != 0)
        {
            Variables.currentHealth = PlayerPrefs.GetInt("PlayerHealth");
            Variables.sheild        = GetBool("PlayerShield");
            PlayerPrefs.SetInt("PlayerHealth", Variables.maxHealth);
            SetBool("PlayerShield", false);
        }
        else
        {
            PlayerPrefs.SetInt("PlayerHealth", Variables.maxHealth);
            SetBool("PlayerShield", false);
            Variables.currentHealth = PlayerPrefs.GetInt("PlayerHealth");
            Variables.sheild        = GetBool("PlayerShield");
        }

        BinaryFormatter binary = new BinaryFormatter();

        if (new FileInfo(Application.persistentDataPath + "/AbilitySave.txt").Exists)
        {
            using (FileStream w = File.Open(Application.persistentDataPath + "/AbilitySave.txt", FileMode.Open))
            {
                Abilitysave = (ListClass)binary.Deserialize(w);
            }
        }

        AbilityCaster abil_cast = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <AbilityCaster>();

        foreach (string Abilityname in Abilitysave.listSave)
        {
            var next_abil = (GameObject)Resources.Load("Prefabs/AbilityPrefabs/" + Abilityname);
            Debug.Log("Trying to add ability" + Abilityname);
            abil_cast.AddAbility(next_abil);
        }
        if (Position_Load != new Vector2(0, 0))
        {
            player_Trans          = GameObject.FindGameObjectWithTag("Player").transform;
            player_Trans.position = Position_Load;
        }
    }
 public override void Initialize(GameObject obj)
 {
     caster       = obj.GetComponent <AbilityCaster>();
     this.aRadius = radius;
 }
 public override void Initialize(GameObject obj)
 {
     caster = obj.GetComponent <AbilityCaster>();
     this.aCulminationTime = culminationTime;
     this.aProjectileForce = projectileForce;
 }