Exemplo n.º 1
0
    private void OnDeath()
    {
        gameObject.SetActive(false);
        IsPlayerDead.Value = true;
        GameObject ragdoll = Instantiate(ragdollPrefab, transform.position, transform.rotation);

        Rigidbody[] ragdollsRbs = ragdoll.GetComponentsInChildren <Rigidbody>();
        ragdollsRbs.ForEach(r => r.velocity = PreviousVelocity.Value);
        freeLookCam.Follow = ragdollsRbs[0].transform;
        freeLookCam.LookAt = ragdollsRbs[0].transform;

        //Force stop all vibrations to prevent getting stuck
        LeanTween.value(0f, 1f, .5f)
        .setOnComplete(_ =>
        {
            MMVibrationManager.StopContinuousHaptic(true);
            MMVibrationManager.StopAllHaptics(true);
        });
    }
Exemplo n.º 2
0
 void OnApplicationQuit()
 {
     //Stop all vibrations when quitting game/editor, to prevent getting stuck
     MMVibrationManager.StopContinuousHaptic(true);
     MMVibrationManager.StopAllHaptics(true);
 }