// Update is called once per frame void Update () { if (_controlled == true) { _shootLocation = new Vector2(_shotStart.position.x, _shotStart.position.y); _hit = Physics2D.Raycast (_shootLocation, transform.right); _aim.transform.position = _hit.point; if (CrossPlatformInputManager.GetButton("CannonUp")) { if(transform.rotation.z < 0.5) { transform.Rotate (Vector3.forward * RotationSpeed * Time.deltaTime); } } if (CrossPlatformInputManager.GetAxis ("Cannon") > 0.2 || CrossPlatformInputManager.GetAxis ("Cannon") < -0.2) { Vector3 rotation = new Vector3 (0, 0, 0); Debug.Log (CrossPlatformInputManager.GetAxis ("Cannon")); if (CrossPlatformInputManager.GetAxis ("Cannon") > 0.2) { rotation = Vector3.back; } else if (CrossPlatformInputManager.GetAxis ("Cannon") < -0.2) { rotation = Vector3.forward; } if(transform.rotation.z < 0.5 || transform.rotation.z > 0) { transform.Rotate (rotation * RotationSpeed * Time.deltaTime); } } if (CrossPlatformInputManager.GetButton("CannonDown")) { if(transform.rotation.z > 0) { transform.Rotate (Vector3.back * RotationSpeed * Time.deltaTime); } } if (CrossPlatformInputManager.GetButtonDown("CannonFire")) { Shoot (); _collider.enabled = true; _controlled = false; _aim.SetActive (false); _player.CanMove = true; _camera.LockCamera (false, CameraWaitAfterShoot); _stageSwap.UnlockSwap (); } } }