private void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q)) { Look(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Look(currentDirection.GetNextClockwise()); } }
private void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Joystick1Button3)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.Joystick1Button1)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.Joystick1Button0)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.Joystick1Button2)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.Joystick1Button4)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Joystick1Button5)) { Rotate(currentDirection.GetNextClockwise()); } }
void Update() { if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.UpArrow)) // NOTE Should use axes keys { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOposite()); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.Q) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.A)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Rotate(currentDirection.GetNextClockwise()); } }
private void Update() { GunCheck(); ColorGun(); if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Rotate(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.Space)) { StartCoroutine(Shoot()); } }
void Update() { if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W) && !gameOver) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D) && !gameOver) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S) && !gameOver) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A) && !gameOver) { Move(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.Q) && !gameOver) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E) && !gameOver) { Rotate(currentDirection.GetNextClockwise()); } }
// Update is called once per frame void Update() { if (canMove) { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } //else if (Input.GetKeyDown(KeyCode.Q)) //{ // Rotate(currentDirection.GetNextCounterclockwise()); //} //else if (Input.GetKeyDown(KeyCode.E)) //{ // Rotate(currentDirection.GetNextClockwise()); //} } }
void Update() { /* * if (!isLocalPlayer) * { * return; * } */ if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { Move(currentDirection); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(currentDirection.GetNextClockwise()); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(currentDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(currentDirection.GetNextCounterclockwise()); } /* * var x = Input.GetAxis("Horizontal"); * var z = Input.GetAxis("Vertical"); */ if (Input.GetKeyDown(KeyCode.Q)) { Look(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Look(currentDirection.GetNextClockwise()); } }
void Update() { //Vector2 v3 = new Vector3(0.0f, Input.GetAxis("Horizontal"), 0.0f);//put in y instead //transform.Rotate(v3 * rotateSpeed * Time.deltaTime); controller = GetComponent <CharacterController> (); //if (controller.isGrounded) { //*FIX DISSSSS** // Debug.Log ("In grounded"); moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical")); if (deltaMoveInput) { moveDirection = new Vector3(0f, 0.0f, 1f); } moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; moveDirection.y -= gravity * Time.deltaTime; if (canMoveAround) { controller.Move(moveDirection * Time.deltaTime); } if (isTurning) { UpdateTurning(); } else // ignore additional input to turn if a turn is already in progress { if (canMoveAround) { if (Input.GetKeyDown(KeyCode.Q) || mustTurnLeft) { //transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Rotate(currentDirection.GetNextCounterclockwise()); } if (Input.GetKeyDown(KeyCode.E) || mustTurnRight) { //transform.localRotation = Quaternion.Euler(0f, 90f, 0f); Rotate(currentDirection.GetNextClockwise()); } } } }
void Update() { if (!isLocalPlayer) { return; } var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f; var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f; if (Input.GetKeyDown(KeyCode.Q)) { Rotate(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Rotate(currentDirection.GetNextClockwise()); } transform.Rotate(0, x, 0); transform.Translate(0, 0, z); }
void FixedUpdate() { if (!isInMaze) { float yStore = moveDirection.y; moveDirection = transform.forward * Input.GetAxis("Vertical") + transform.right * Input.GetAxis("Horizontal"); moveDirection = moveDirection.normalized * moveSpeed; moveDirection.y = yStore; //No jump unless on the groud if (controller.isGrounded && Input.GetButtonDown("Jump")) { moveDirection.y = jumpForce; } moveDirection.y += Physics.gravity.y * gravityScale * Time.deltaTime * 2; controller.Move(moveDirection * Time.deltaTime); } if (mazeSteps == 0) { stepsLeft.transform.GetChild(0).GetComponent <Text>().text = "You have no more Moves, press ESC to reset."; } if (isInMaze && mazeSteps > 0) { if (Input.GetButtonDown("Jump")) { moveDirection.y = jumpForce; } moveDirection.y += Physics.gravity.y * gravityScale * Time.deltaTime / 4; controller.Move(moveDirection * Time.deltaTime); game.SetPlayerLocation(this, curCell); if (transform.position.y <= 2) { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { IntVector2 lastCoord = curCell.coordinates; Move(curDirection); IntVector2 currCoord = curCell.coordinates; if (currCoord == new IntVector2(7, 7)) { endPanel.SetActive(true); } if (currCoord != lastCoord) { mazeSteps--; stepsLeft.transform.GetChild(0).GetComponent <Text>().text = mazeSteps.ToString(); coord = curCell.coordinates; game.ResetMatrix(curCell.coordinates); game.SetPlayerLocation(this, currCoord); } Look(curDirection); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Look(curDirection.GetOpposite()); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Look(curDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Look(curDirection.GetNextClockwise()); } } } }
private void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { Move(MazeDirection.North); Look(MazeDirection.North); } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { Move(MazeDirection.East); Look(MazeDirection.East); } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { Move(MazeDirection.South); Look(MazeDirection.South); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { Move(MazeDirection.West); Look(MazeDirection.West); } else if (Input.GetKeyDown(KeyCode.Q)) { Look(currentDirection.GetNextCounterclockwise()); } else if (Input.GetKeyDown(KeyCode.E)) { Look(currentDirection.GetNextClockwise()); } // for buttons on UI if (Input.GetMouseButtonDown(0) && EventSystem.current.currentSelectedGameObject != null) { if (EventSystem.current.currentSelectedGameObject.name == "ButtonNorth") { Move(MazeDirection.North); Look(MazeDirection.North); } else if (EventSystem.current.currentSelectedGameObject.name == "ButtonEast") { Move(MazeDirection.East); Look(MazeDirection.East); } else if (EventSystem.current.currentSelectedGameObject.name == "ButtonSouth") { Move(MazeDirection.South); Look(MazeDirection.South); } else if (EventSystem.current.currentSelectedGameObject.name == "ButtonWest") { Move(MazeDirection.West); Look(MazeDirection.West); } //else if (EventSystem.current.currentSelectedGameObject.name == "ButtonTurnLeft") //{ // Look(currentDirection.GetNextCounterclockwise()); //} //else if (EventSystem.current.currentSelectedGameObject.name == "ButtonTurnRight") //{ // Look(currentDirection.GetNextClockwise()); //} } }
public void Rotate(MazeDirection direction) { transform.localRotation = direction.GetNextClockwise().ToRotation(); }