private void Awake() { construcionsList = new PriorityList <Transform>(); foreach (GameObject tower in GameObject.FindGameObjectsWithTag("Tower")) { int towerOrder = tower.GetComponent <TowerAttackOrder>().orderInAttack; PriorityPair <Transform> towerPair = new PriorityPair <Transform>(tower.transform, towerOrder); construcionsList.Add(towerPair); } GameObject core = GameObject.FindGameObjectWithTag("Core"); int lastTowerOrder = 0; if (construcionsList.GetFirst() != null) { lastTowerOrder = construcionsList.GetFirst().Priority; } PriorityPair <Transform> corePair = new PriorityPair <Transform>(core.transform, lastTowerOrder + 1); construcionsList.Add(corePair); troopData = GetComponent <RunTimeTroopData>(); //TO:DO adapt to use Troop class with RunTimeData data movementAction = GetComponent <TroopMovementActions>(); attackAction = GetComponent <TroopAttackActions>(); }
public override void Die() { TroopAttackActions attackAction = GetComponent <TroopAttackActions>(); if (attackAction.IsAttacking) { attackAction.StopAttack(); } if (deathEffect != null) { Instantiate(deathEffect, transform.position, transform.rotation); } Destroy(gameObject); }
public TroopAttackI(IsometricCharacterAnimator isometricCharacterAnimations, RunTimeTroopData troopData) { troopAnimations = isometricCharacterAnimations; attackActions = troopData.GetComponent <TroopAttackActions>(); }