private void Update() { if (IsVR) { if (OVRInput.Get(OVRInput.RawButton.RHandTrigger)) { GameObject CurrentBullet; CurrentBullet = GetBullet(); CurrentBullet.SetActive(true); CurrentBullet.transform.position = BulletSpawnPoint.transform.position; BulletRB[CurrentBulletIndex].velocity = transform.forward * BulletSpeed; CurrentBullet.transform.up = transform.forward; AimLine.SetPosition(0, new Vector3(LineOBJPos.transform.position.x, LineOBJPos.transform.position.y + 0.040f, LineOBJPos.transform.position.z)); AimLine.SetPosition(1, LineOBJPos.transform.forward * 100.0f); } } else { if (Input.GetMouseButtonDown(0)) { GameObject CurrentBullet; CurrentBullet = GetBullet(); CurrentBullet.SetActive(true); CurrentBullet.transform.position = BulletSpawnPoint.transform.position; BulletRB[CurrentBulletIndex].velocity = transform.forward * BulletSpeed; CurrentBullet.transform.up = transform.forward; } } }
// Use this for initialization void Start() { playerSprite = GetComponent <SpriteRenderer>(); playerRigid = GetComponent <Rigidbody2D>(); playerAnimator = GetComponent <Animator>(); playerCollider = GetComponent <BoxCollider2D>(); crouchCollider = GameObject.Find("CrouchCollider").GetComponent <BoxCollider2D>(); currentBullet = CurrentBullet.Default; }