public void Initialize(Camera cam, GameObject[] platforms, GameObject platformsContainer, GameObject[] deathRays, GameObject deathRaysContainer, float leftCorner, float rightCorner, float startY, float deathRaysProbability, float deathRaysOffset, float initialVelocity, float velocityIncrement) { this.camBounds = CamToWorldUtility.GetCameraBoundsInWorld(cam); this.platforms = platforms; this.platformsContainer = platformsContainer; this.deathRays = deathRays; this.deathRaysContainer = deathRaysContainer; this.leftCorner = leftCorner; this.rightCorner = rightCorner; this.currentGenY = startY; this.deathRaysProbability = deathRaysProbability; this.deathRaysOffset = deathRaysOffset; this.currentVelocity = initialVelocity; this.velocityIncrement = velocityIncrement; }
void GeneratePlatforms() { CamToWorldUtility.CameraBounds camBounds = CamToWorldUtility.GetCameraBoundsInWorld(cam); float startY = camBounds.down.y; // left player float p1LeftCorner = camBounds.left.x; float p1RightCorner = camBounds.up.x; p1PlatformsGen = gameObject.AddComponent <PlatformGenerator>(); p1PlatformsGen.Initialize(cam, platforms, platformsContainer, deathRays, deathRaysContainer, p1LeftCorner, p1RightCorner, startY, deathRaysProbability, deathRaysOffset, initialVelocity, velocityIncrement); p1PlatformsGen.Generate(); // right player float p2LeftCorner = camBounds.up.x; float p2RightCorner = camBounds.right.x; p2PlatformsGen = gameObject.AddComponent <PlatformGenerator>(); p2PlatformsGen.Initialize(cam, platforms, platformsContainer, deathRays, deathRaysContainer, p2LeftCorner, p2RightCorner, startY, deathRaysProbability, deathRaysOffset, initialVelocity, velocityIncrement); p2PlatformsGen.Generate(); }