// a platform has been spawned, now spawn the scene objects and setup for a turn if needed private void platformSpawned(PlatformObject platform, ObjectLocation location, Vector3 direction, Vector3 distance, bool activateImmediately) { int localIndex; bool isTurn = platform.isRightTurn || platform.isLeftTurn; if (isTurn || spawnFullLength) { // set largestScene to 0 to prevent the scene spawner from waiting for space for the largest scene object spawnData.largestScene = 0; spawnData.useWidthBuffer = false; } // spawn all of the scene objects until we have spawned enough scene objects setupSection(location, true); while ((localIndex = infiniteObjectManager.getNextObjectIndex(ObjectType.Scene, spawnData)) != -1) { spawnSceneObject(localIndex, location, distance + localSceneDistance[(int)location] * direction + localSceneHeight[(int)location] * Vector3.up + turnOffset, direction, activateImmediately); } if (isTurn) { spawnData.largestScene = largestSceneLength; spawnData.useWidthBuffer = true; turnPlatform[(int)location] = platform; if (location == ObjectLocation.Center) { setupPlatformTurn(); } } else { localDistance[(int)location] += platformSizes[infiniteObjectHistory.getLastLocalIndex(ObjectType.Platform)].z; localPlatformHeight[(int)location] += platformSizes[infiniteObjectHistory.getLastLocalIndex(ObjectType.Platform)].y; if (platform.sectionTransition) { infiniteObjectHistory.didSpawnSectionTranition(location, false); } } }