/// <summary> /// updates individul unit. /// </summary> /// <param name="unit"></param> void UpdateUnit(Unit unit, ref int topUnit, ref int index, ref bool allDead, int i) { if (unit.alive) { allDead = false; unit.ManualUpdate(); int zPosition = (int)unit.position.z; if (zPosition > topUnit) { topUnit = zPosition; index = i; } } else { if (unit.hit) { ParticleSystem particleSystem = ParticleSystemFactory.CreateParticleEffectSystem(ParticleSystemFactory.ParticleEffect.Death, unit.colour); particleSystem.transform.position = new Vector3(unit.position.x, particleSystem.transform.position.y, unit.position.z); _particles.Add(particleSystem); unit.hit = false; } } }