// set up all initial pipes and return the second pipe public Pipe SetupInitialPipes() { // generate all initial pipes in the system for (int i = 0; i < pipes.Length; i++) { Pipe pipe = pipes[i]; float prevPipeEndRadius = 2f; if (i > 0) { prevPipeEndRadius = pipes[i - 1].GetPipeEndRadius(); } pipe.Generate(prevPipeEndRadius, i > emptyPipeCount); if (i > 0) { pipe.AlignWith(pipes[i - 1]); pipes[i - 1].nextPipe = pipes[i]; // set next pipe } } AlignNextPipeWithOrigin(); // move the opening of the first pipe to world origin transform.localPosition = new Vector3(0f, -pipes[StartingPipeIndex].CurveRadius); return(pipes[StartingPipeIndex]); }
private void Awake() { pipes = new Pipe[pipeCount]; for (int i = 0; i < pipes.Length; i++) { Pipe pipe = pipes[i] = Instantiate <Pipe>(pipePrefab); pipe.transform.SetParent(transform, false); if (i > 0) { pipe.AlignWith(pipes[i - 1]); } } }
//Sets the first pipe so no obsticles or collectables are available public Pipe SetupFirstPipe() { for (int i = 0; i < pipes.Length; i++) { Pipe pipe = pipes[i]; pipe.Generate(i > emptyPipeCount); if (i > 0) { pipe.AlignWith(pipes[i - 1]); } } AlignNextPipeWithOrigin(); transform.localPosition = new Vector3(0f, -pipes[1].CurveRadius); return(pipes[1]); }
private void Awake() { pipes = new Pipe[pipeCount]; for (int i = 0; i < pipes.Length; i++) { Pipe pipe = pipes[i] = Instantiate(pipePrefab); pipe.transform.SetParent(transform); pipe.Generate(i > emptyPipeCount); if (i > 0) { pipe.AlignWith(pipes[i - 1]); } } AlignNextPipeWithOrigin(); }
private void Awake() { pipes = new Pipe[pipeCount]; for (int i = 0; i < pipes.Length; i++) { Pipe pipe = pipes[i] = Instantiate <Pipe>(pipePrefab); pipe.transform.SetParent(transform, false); pipe.Generate(); RenderSettings.fogColor = Color.cyan; pipe.gameObject.AddComponent <MeshCollider>(); pipe.gameObject.AddComponent <Rigidbody>().isKinematic = true; audioSource.Play(); if (i > 0) { pipe.AlignWith(pipes[i - 1]); } } AlignNextPipeWithOrigin(); }
private void GeneratePipe() { Pipe pipe = Instantiate <Pipe>(pipePrefab); pipe.transform.SetParent(transform, false); if (pipes.Count > 0) { pipe.AlignWith(pipes[pipes.Count - 1]); } pipes.Add(pipe); if (noObstaclePipeCount == 0) { itemPlacers[Random.Range(0, itemPlacers.Length)].PlaceItems(pipe); } else { noObstaclePipeCount--; } }
private void Awake() { randomizeOfColors(); pipes = new Pipe[pipeCount]; for (int i = 0; i < pipes.Length; i++) { Pipe pipe = pipes[i] = Instantiate <Pipe>(pipePrefab); pipe.transform.SetParent(transform, false); pipe.Generate(WhitePipe, NewLevel, StartOfGame); WhitePipe++; if (i > 0) { pipe.AlignWith(pipes[i - 1]); } } // Color1.color = new Color(Random.value, Random.value, Random.value, 1); //Color2.color = new Color(Random.value, Random.value, Random.value, 1); //Color3.color = new Color(Random.value, Random.value, Random.value, 1); AlignNextPipeWithOrigin(WhitePipe, newLevel); //randomizeOfColors(); ColoringOfButtons(); pipes[pipeCount - 1].GetComponent <Renderer>().material.color = Color.red; StartOfGame = false; }