Nanook.TheGhost.ProjectSong.alignBattleStarPowerToFaceOff C# (CSharp) Method

alignBattleStarPowerToFaceOff() private method

Move the star power to fit in with the face off. We can't move the face off as there's only one, but each star power could be different
private alignBattleStarPowerToFaceOff ( int battleStarPower, int faceOff ) : void
battleStarPower int
faceOff int
return void
        private void alignBattleStarPowerToFaceOff(int[] battleStarPower, int[] faceOff)
        {
            //remove empty sp
            List<int> sp = new List<int>();
            for (int i = 0; i < battleStarPower.Length; i += 3)
            {
                for (int j = 0; j < faceOff.Length; j += 2)
                {
                    //if the section ends within a face off section but starts before it.
                    if (battleStarPower[i] + battleStarPower[i + 1] >= faceOff[j] && battleStarPower[i] + battleStarPower[i + 1] < faceOff[j] + faceOff[j + 1] &&
                        battleStarPower[i] < faceOff[j])
                    {
                        if (battleStarPower[i + 1] > faceOff[j + 1])
                            battleStarPower[i + 1] = faceOff[j + 1]; //set lengths the same

                        battleStarPower[i] = faceOff[j]; //align the star power to the start of the face off section
                    }

                    //if the section starts within a face off section but ends after it.
                    if (battleStarPower[i] >= faceOff[j] && battleStarPower[i] < faceOff[j] + faceOff[j + 1] &&
                        battleStarPower[i] + battleStarPower[i + 1] > faceOff[j] + faceOff[j + 1])
                    {
                        if (battleStarPower[i + 1] > faceOff[j + 1])
                            battleStarPower[i + 1] = faceOff[j + 1]; //set lengths the same

                        battleStarPower[i] = (faceOff[j] + faceOff[j + 1]) - battleStarPower[i + 1]; //move section to the end of the face off section
                    }

                }
            }
        }