private void KillPlayer() { if (bodyCollider.IsTouchingLayers(LayerMask.GetMask("Enemy", "Hazards")) && isAlive) { myCinemachine2DOneShotAudio.ForcePlay2DClip(playerDeathSound, Camera.main.transform.position); myAnimator.SetTrigger("Die"); Vector2 deathKnockback = new Vector2(Mathf.Sign(directionOfLaunch.x) * deathKnockbackForce, deathKnockbackForce * 2); myRigidbody2D.velocity = deathKnockback; StartCoroutine(ImmobilizePlayerCorpse()); isAlive = false; myGameSession.ProcessPlayerDeath(); } }
private void PlayerJumping() { if (!feetCollider.IsTouchingLayers(LayerMask.GetMask("Ground")) && !feetCollider.IsTouchingLayers(LayerMask.GetMask("Plataform"))) { return; } if (Input.GetButtonDown("Jump")) { myCinemachine2DOneShotAudio.ForcePlay2DClip(playerJumpSound, Camera.main.transform.position); myRigidbody2D.velocity += Vector2.up * jumpingSpeed; } }
private void OnTriggerEnter2D(Collider2D collision) { //HideElements(); myCinemachine2DOneShotAudio.ForcePlay2DClip(portalSound, Camera.main.transform.position); StartCoroutine(myGameSession.LoadNextScene()); }
private void PlayFlagSound() { myCinemachine2DOneShotAudio.ForcePlay2DClip(flagSound, Camera.main.transform.position); }