// Use this for initialization void Start() { maxHP = 100; currentHP = 100; this.SetTimeBetweenAttacks(defaultTimeBetweenAttacks); timeSinceLastAttack = 0f; health = transform.GetChild(0).GetChild(0).gameObject.GetComponent <BarScript>(); attackTimer = transform.GetChild(0).GetChild(1).gameObject.GetComponent <BarScript>(); enemyArea = GameObject.Find("EnemySpace").GetComponent <EnemyArea>(); allyArea = GameObject.Find("AllySpace").GetComponent <AllyArea>(); }
void Start() { targets = new List <Character>(); enemyArea = GameObject.Find("EnemySpace").GetComponent <EnemyArea>(); allyArea = GameObject.Find("AllySpace").GetComponent <AllyArea>(); targets = enemyArea.GetEnemies(); if (targets == null) { Debug.Log("targets in Ally instance is null"); } SetTarget(targets[0]); this.GetEventManager().AddNewListener(this); }