public void RotateCommandRight() { //Getting access to the ComandSelect global variables which are attached to the PlayterTerminalObject cs = GameObject.Find("PlayerTerminalObject").GetComponent <CommandSelect>(); //When a pipe is magenta, the pipe is rotated clockwise of their original orientation if (selected) { if (this.RotationComponent.Rotation == RotationPipe.Rotations.NORTH) { this.RotationComponent.SetRotation(RotationPipe.Rotations.EAST); } else if (this.RotationComponent.Rotation == RotationPipe.Rotations.EAST) { this.RotationComponent.SetRotation(RotationPipe.Rotations.SOUTH); } else if (this.RotationComponent.Rotation == RotationPipe.Rotations.SOUTH) { this.RotationComponent.SetRotation(RotationPipe.Rotations.WEST); } else if (this.RotationComponent.Rotation == RotationPipe.Rotations.WEST) { this.RotationComponent.SetRotation(RotationPipe.Rotations.NORTH); } GameManager.Instance.SuccessCommands += 1; GameManager.Instance.TotalCommands += 1; FindObjectOfType <AudioManager>().Play("R_Right"); } //If no pipe is magenta and a command is passed, the FullSyntaxCommands and TotalCommands values increment by 1 else { GameManager.Instance.FullSyntaxCommands += 1; GameManager.Instance.TotalCommands += 1; } cs.TickDown(); //When count becomes 0, the player loses the level and the lose screen is the only UI element visible if (cs.count == 0) { cs.loseScreen.SetActive(true); cs.GameCanvas.SetActive(false); GameObject.Find("Grid").SetActive(false); gs2.GetComponent <WinDetect>().enabled = false; } }
public void SlideCommandLeft() { //Getting access to the ComandSelect global variables which are attached to the PlayterTerminalObject cs = GameObject.Find("PlayerTerminalObject").GetComponent <CommandSelect>(); //When a pipe is magenta, the pipe is moved left by 1 unit on the grid if (selected) { for (int i = 0; i < CommandSelect.increment; i++) { collidedPipe1 = GameObject.Find("(" + (X - 1).ToString() + ", " + Y.ToString() + ")"); gs2 = GameObject.Find("Grid").GetComponent <GridScript>(); //These if/else conditionals check if there is a pipe or grid boundary that the selected pipe can collide with if (collidedPipe1 == null && X > 0) { this.MovableComponent.Move(X - 1, Y); pipe1Name = pipe1.name; CommandSelect.collideInput = true; } else if (collidedPipe1 != null) { Debug.Log(collidedPipe1.name); CommandSelect.collideInput = false; } else { CommandSelect.borderInput = true; } } //The Command global variables from GameManager update based on if the selected pipe does or doesn't collide with other objects. if (CommandSelect.collideInput == false) { GameManager.Instance.FullSyntaxCommands += 1; GameManager.Instance.TotalCommands += 1; } else if (CommandSelect.borderInput == true) { GameManager.Instance.FullSyntaxCommands += 1; GameManager.Instance.TotalCommands += 1; } else if (CommandSelect.collideInput == true) { GameManager.Instance.SuccessCommands += 1; GameManager.Instance.TotalCommands += 1; } } //If no pipe is magenta and a command is passed, the FullSyntaxCommands and TotalCommands values increment by 1 else { GameManager.Instance.FullSyntaxCommands += 1; GameManager.Instance.TotalCommands += 1; } FindObjectOfType <AudioManager>().Play("Slide_Normal"); cs.TickDown(); //When count becomes 0, the player loses the level and the lose screen is the only UI element visible if (cs.count == 0) { cs.loseScreen.SetActive(true); cs.GameCanvas.SetActive(false); GameObject.Find("Grid").SetActive(false); gs2.GetComponent <WinDetect>().enabled = false; } }