Add JumpPad feature with prefab and adapter implementation

This commit is contained in:
2025-12-12 22:27:28 +01:00
parent a6d486abb7
commit 3774fb9900
9 changed files with 332 additions and 5 deletions

View File

@@ -0,0 +1,25 @@
using System;
using UnityEngine;
namespace Infrastructure.Unity
{
public class JumpPadAdapter : MonoBehaviour
{
[SerializeField] private float jumpForce = 15f;
[SerializeField] private ParticleSystem jumpVfx;
private void OnTriggerEnter(Collider other)
{
if (other.TryGetComponent<PlayerController>(out var player))
{
var vel = player.Rigidbody.linearVelocity;
vel.y = 0f;
player.Rigidbody.linearVelocity = vel;
player.Rigidbody.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
if (jumpVfx) jumpVfx.Play();
}
}
}
}