private void OnCollisionEnter(Collision collision) { if (GameManager.instance.gameOver) { return; } if (collision.collider.CompareTag("Player")) { //Start Player ability to aim playerController.canAim = true; //Reset dash playerController.ResetDashAmount(); //Stopping Player momentum playerRigid.velocity = Vector3.zero; playerController.gravityAmount = 0; playerRigid.useGravity = false; leafCollider.enabled = false; playerController.LandedOnLeaf(); if (collision.contacts[0].normal.y < 0) // negative is up { ninjaVisual.ChangeNinjaPose(0); } else { ninjaVisual.ChangeNinjaPose(2); } } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { if (playerController.firstDashHappend) { GameManager.instance.GameOver(); } else { //Start Player ability to aim playerController.canAim = true; //Stopping Player momentum playerRigid.velocity = Vector3.zero; playerController.gravityAmount = 0; playerRigid.useGravity = false; ninjaVisual.ChangeNinjaPose(0); playerController.LandedOnLeaf(); if (!ninjaVisual.ninjaVisualEnabled) { ninjaVisual.EnableStartingPose(); } } } }
void PlayerCanon() { chargeSnapshot.Stop(); firstDashHappend = true; // Player is jumping JumpButtonReleased = false; ninjaVisualController.ChangeNinjaPose(1); //Stopping all other forces playerRigidbody.velocity = Vector3.zero; //sætter det så spilleren ikke bare står stille hvis spilleren ikke sigter if (input.playerAim == Vector2.zero) { playerAim = Vector2.up; } else { playerAim = input.playerAim; } playerRigidbody.AddForce(playerAim * Mathf.Clamp(jumpingForce, jumpingForceMinMax.x, jumpingForceMinMax.y), ForceMode.VelocityChange); //Reset variables jumpingForce = jumpingForceMinMax.x; gravityAmount = initGravityAmount; Time.timeScale = 1; canonAimSlider.value = jumpingForce; currentlyAiming = false; canAim = false; doOnceDashes = true; //FMOD if (jumpCharging.IsPlaying()) { jumpCharging.Stop(); } playerCanonShoot.Invoke(); }