Files
BABA_YAGA/Assets/Scripts/Player/Generic/Triggers/vJumpMultiplierTrigger.cs

28 lines
887 B
C#
Raw Normal View History

2026-05-30 09:16:35 +07:00
using UnityEngine;
namespace Invector.vCharacterController
{
public class vJumpMultiplierTrigger : MonoBehaviour
{
public float multiplier = 5;
public float timeToReset = 0.5f;
void OnTriggerStay(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
var motor = other.GetComponent<vThirdPersonController>();
if (motor && (motor.isJumping || !motor.isGrounded) && motor._rigidbody.linearVelocity.y <= 0)
{
motor.SetJumpMultiplier(multiplier, timeToReset);
motor.isJumping = false;
motor.verticalVelocity = 0;
motor.heightReached = transform.position.y;
motor.isGrounded = true;
motor.Jump();
}
}
}
}
}