private void SpawnPathHazard(GameObject hazardToSpawn, float xPosition, float zOffset, string pathName, float time) { Vector3 spawnPosition = new Vector3(xPosition, spawnValues.y, spawnValues.z + zOffset); Quaternion spawnRotation = Quaternion.Euler(0, 0, 0); GameObject hazard = Instantiate(hazardToSpawn, spawnPosition, spawnRotation) as GameObject; MoveObjectByPath script = hazard.AddComponent <MoveObjectByPath> () as MoveObjectByPath; script.pathName = pathName; script.time = time; }
private void SpawnAngleHazard(GameObject hazardToSpawn, float xPosition, float angle, float zOffset, HazardConfig config) { Vector3 spawnPosition = new Vector3(xPosition, spawnValues.y, spawnValues.z + zOffset); Quaternion spawnRotation = Quaternion.Euler(0, angle, 0); GameObject hazard = Instantiate(hazardToSpawn, spawnPosition, spawnRotation) as GameObject; MoveObjectByPath script = hazard.AddComponent <MoveObjectByPath> () as MoveObjectByPath; script.pathName = "FromLeft"; script.time = 20; }