public void Execute(int index)
        {
            FormationIntegrityData data = integrityData[index];

            var n = navigators[index];

            if (!formations[index].EnableMovement || data.unitsFar + data.unitsClose >= data.unitCount ||
                formations[index].FormationState == FormationData.State.Spawning)
            {
                n.speed = 0f;
            }
            else
            {
                n.speed = math.lerp(1f, 2.1f, 1 - (data.unitsClose / (float)data.unitCount));
            }

            navigators[index] = n;
        }
        public void Execute(int index)
        {
            var integrityData    = new FormationIntegrityData();
            var unitsInFormation = formationUnitData[index];

            for (var i = 0; i < formationData[index].UnitCount; ++i)
            {
                var unitEntity = unitsInFormation[i].entity;

                if (unitEntity == new Entity())
                {
                    break;                             // if it's a null entity we reached
                }
                var unitTransform = transforms[unitEntity];
                var unitData      = minionData[unitEntity];
                var target        = minionTargets[unitEntity].Target;

                if (unitData.attackCycle >= 0)
                {
                    ++integrityData.unitsAttacking;
                }

                var distance = math.length(target - unitTransform.Position);

                if (distance < FormationPathFindSystem.FarDistance)
                {
                    ++integrityData.unitCount;
                    if (distance >= FormationPathFindSystem.CloseDistance)
                    {
                        ++integrityData.unitsClose;
                    }
                }
                else
                {
                    ++integrityData.unitsFar;
                }
            }

            formationIntegrityData[index] = integrityData;
        }