public void getDirection() { // Get bullet's direction. bulletDirection.x = 0f; bulletDirection.z = 0f; playerDirection = playerController.playerDirection; switch (playerDirection) { case ProjectConst.Direction.UP: bulletDirection.z = 1; break; case ProjectConst.Direction.DOWN: bulletDirection.z = -1; break; case ProjectConst.Direction.RIGHT: bulletDirection.x = 1; break; case ProjectConst.Direction.LEFT: bulletDirection.x = -1; break; default: break; } }
private void GetMovementInputs() { if (isMoveUp || isMoveDown) { if (isMoveUp) { movement.z = 1.0f; playerDirection = ProjectConst.Direction.UP; } if (isMoveDown) { movement.z = -1.0f; playerDirection = ProjectConst.Direction.DOWN; } } else { movement.z = 0; } if (isMoveRight || isMoveLeft) { if (isMoveRight) { movement.x = 1.0f; playerDirection = ProjectConst.Direction.RIGHT; } if (isMoveLeft) { movement.x = -1.0f; playerDirection = ProjectConst.Direction.LEFT; } } else { movement.x = 0; } }