private int IndexOfPlatformOnNextLayer(Enemy enemy) { var curPlatform = enemy.platform; var curPlatforms = GetPlatformsFromLayer(enemy.IndexOfLayer); var nextPlatforms = GetPlatformsFromLayer(enemy.IndexOfLayer - 1); enemyMover.DisconnectEnemy(enemy); var curIndex = curPlatforms.IndexOf(curPlatform); var curLength = curPlatforms.Length; var nextLength = nextPlatforms.Length; var nextIndex = (int)(curIndex * ((double)nextLength / curLength)); return(nextIndex); }