public void AttackAnimation(Creep creep) { int towerLine = tower.LinePosition; int creepLine = creep.GetLinePosition(); bool isTargetForward = IsTargetFoward(creep.creepTransform); if (isTargetForward) // target forward { animator.Play(Constants.ANIM_TOWER_ATTACK_FORWARD); } else { animator.Play(Constants.ANIM_TOWER_ATTACK_BACK); } }
public Tower GetTargetTower(Creep creep) { List <Tower> twrs = lines [creep.GetLinePosition()].lineTowers; Tower target = GetMainTargetTower(creep); float temp = float.MaxValue; for (int i = 0; i < twrs.Count; i++) { float dist = Mathf.Abs(twrs [i].towerTransform.position.x - creep.creepTransform.position.x); if (dist <= temp) { target = twrs [i]; temp = dist; } } return(target); }
public void RemoveCreepFromEnemyList(Creep creep) { lines [creep.GetLinePosition()].lineCreeps.Remove(creep); GameEvents.current.EnemyAppear(); }
public void AddCreepToEnemyList(Creep creep) { lines [creep.GetLinePosition()].lineCreeps.Add(creep); GameEvents.current.EnemyAppear(); }
public Tower GetMainTargetTower(Creep creep) { return(sortedTowers [creep.GetLinePosition()]); }