public override void Proceed(ControlledDivision Host) { if (!IsFinished && Host.FindVisibleDivision(RememberedTargetId, out ControlledDivision division)) { var distanceToTarget = (division.Controller.transform.position - Host.Controller.transform.position).magnitude; if (distanceToTarget > Host.MaxHitRange) { IsFinished = true; return; } float totalAttackerDamage = 0; for (int i = 0; i < Host.Soldiers.Count; i++) { Soldier soldier = Host.Soldiers[i]; if (distanceToTarget > soldier.MinRange && distanceToTarget < soldier.MaxRange) { var result = soldier.Attack(ref division, distanceToTarget); totalAttackerDamage += result.DamageToDefender; } } bool isDestroyed = division.CheckDamageDone(Host); bool isHostDestroyed = Host.CheckDamageDone(division); if (isDestroyed) { RememberedDivision RememberedTarget = GetRememberedDivisionFromHost(Host, RememberedTargetId); RememberedTarget.HasBeenDestroyed = true; RememberedTarget.TimeStamp = GameManager.Instance.GameTime; IsFinished = true; } } }