public virtual IEnumerator SlideIn(FightingEntity user, List <FightingEntity> targets) { if (slideType == SlideType.STEP_FORWARD) { Vector3 destination = user.transform.position; destination.x += user.IsHeroTeam() ? -stepForwardDistance : stepForwardDistance; yield return(GameManager.Instance.time.GetController().StartCoroutine(Slide(user.transform, user.transform.position, destination))); } else if (slideType == SlideType.MELEE) { Vector3 destination = Vector3.zero; float averageTargetRadius = 0; foreach (FightingEntity target in targets) { destination += target.transform.position; averageTargetRadius += target.GetComponent <FighterPositions>().fighterRadius; } destination /= targets.Count; averageTargetRadius /= targets.Count; // Distance target and destination based on the reach of this attack and the width of the target float distance = meleeReach + averageTargetRadius; destination.x += user.IsHeroTeam() ? distance : -distance; yield return(GameManager.Instance.time.GetController().StartCoroutine(Slide(user.transform, user.transform.position, destination))); } }