/* * Responsible for the heavy lifting of creating the altered ramp object using the base prefab along with the given * parameter ranges */ public void GenerateRamp() { // Instantiates a new gameObject instance of the rampPrefab GameObject generatedRamp = (GameObject)Instantiate(rampPrefab); // Creates a scaling vector for all the dimensions of the ramp and applies it to its localScale length = RandomGeneration.CalculateRandomFloatRange(minLength, maxLength, seedValue); height = RandomGeneration.CalculateRandomFloatRange(minHeight, maxHeight, seedValue); width = RandomGeneration.CalculateRandomFloatRange(minWidth, maxWidth, seedValue); Vector3 rampScalingFactor = new Vector3(length, height, width); generatedRamp.transform.localScale = rampScalingFactor; // Positions ramp within its scenario and sets it as child of overall scenario gameObject generatedRamp.transform.position = RandomGeneration.RandomVector3WithinBounds(minStart, maxStart, seedValue); generatedRamp.transform.SetParent(scenarioParent, false); }
/* * Responsible for the heavy lifting of creating the altered seesaw object using the base prefab along with the given * parameter ranges */ public void GenerateSeesaw() { // Instantiates a new gameObject instance of the seesawPrefab GameObject generatedSeesaw = (GameObject)Instantiate(seesawPrefab); // Creates a scaling vector for all the dimensions of the seesaw and applies it to its localScale Vector3 seesawScalingFactor = new Vector3( RandomGeneration.CalculateRandomFloatRange(minLength, maxLength, seedValue), RandomGeneration.CalculateRandomFloatRange(minHeight, maxHeight, seedValue), RandomGeneration.CalculateRandomFloatRange(minWidth, maxWidth, seedValue)); generatedSeesaw.transform.localScale = seesawScalingFactor; // Positions seesaw within its scenario and sets it as child of overall scenario gameObject generatedSeesaw.transform.position = RandomGeneration.RandomVector3WithinBounds(minStart, maxStart, seedValue); generatedSeesaw.transform.SetParent(scenarioParent, false); }
/* * Responsible for the heavy lifting of creating the altered seesaw object using the base prefab along with the given * parameter ranges */ public void GenerateObstacle() { // Instantiates a new gameObject instance of the obstacle int selectedPrefabIndex = Random.Range(0, prefabOptions.Length); generatedObstacle = (GameObject)Instantiate(prefabOptions[selectedPrefabIndex]); // Creates a scaling vector for all the dimensions of the seesaw and applies it to its localScale length = RandomGeneration.CalculateRandomFloatRange(minLength, maxLength, seedValue); height = RandomGeneration.CalculateRandomFloatRange(minHeight, maxHeight, seedValue); width = RandomGeneration.CalculateRandomFloatRange(minWidth, maxWidth, seedValue); //Vector3 obstacleScalingFactor = new Vector3( // RandomGeneration.CalculateRandomFloatRange(minLength, maxLength, seedValue), // RandomGeneration.CalculateRandomFloatRange(minHeight, maxHeight, seedValue), // RandomGeneration.CalculateRandomFloatRange(minWidth, maxWidth, seedValue)); Vector3 obstacleScalingFactor = new Vector3(length, height, width); generatedObstacle.transform.localScale = obstacleScalingFactor; // Positions seesaw within its scenario and sets it as child of overall scenario gameObject generatedObstacle.transform.position = RandomGeneration.RandomVector3WithinBounds(minStart, maxStart, seedValue); generatedObstacle.transform.SetParent(scenarioParent, false); }