//Get circle collider reference. private void Awake() { //Set quadrant x and y values. rightQuadrant.x = 35.0f; rightQuadrant.y = 125.0f; lowerQuadrant.x = 125.01f; lowerQuadrant.y = 215.0f; leftQuadrant.x = 215.01f; leftQuadrant.y = 305.0f; enemyDetection = GetComponent <CircleCollider2D>(); anim = GetComponent <Animator>(); gameMan = FindObjectOfType <GameManager>(); attackPool = GetComponent <AttackPool>(); gameMan.aliveUnits.Add(this); //Set isActive to false. This will be set to true when the player places one down. //isActive = false; //Initialize attack timer. attackTimer = attackInterval; animResetTimer = 0.5f; //Set enemy detection range. if (enemyDetection) { enemyDetection.radius = attackRange; } else { Debug.LogWarning("A unit called: " + gameObject.name + " has no enemy detection circle collider!"); } }
// Use this for initialization void Awake() { instance = this; totalAvailable = gameObject.transform.childCount; availableAttacks = new List <Attack>(); pendingAttacksInfo = new List <AttackInfo>(); foreach (Transform child in transform) { availableAttacks.Add(child.GetComponent <Attack>()); } }