public Coroutine TowerUnitDamage(Unit target, int damageAmount) { (int laneIndex, int sideIndex, int positionIndex) = GetPositionIdentifier(target); TowerUI sourceUI = towerManagers[1 - sideIndex].towerUIs[laneIndex]; UnitUI targetUI = FindUnitUI(target); return(StartCoroutine(SerialCoroutine( () => sourceUI.Attack(targetUI.transform.position), () => { targetUI.RenderUnit(); return null; }, () => damageTextManager.DamageTextPopup(targetUI.transform.position, $"-{damageAmount}") ))); }
public Coroutine UnitDamage(Unit source, Unit target, int damageAmount) { UnitUI sourceUI = FindUnitUI(source); UnitUI targetUI = FindUnitUI(target); targetUI.RenderUnit(); return(StartCoroutine(ParallelCoroutine( () => sourceUI.AttackMove(AttackDirection(Lane.GetLaneSidePosOf(source, Driver.instance.gameManager.Lanes).Item2)), () => damageTextManager.DamageTextPopup(targetUI.transform.position, $"-{damageAmount}") ))); }