Springboard & FallingPlatform

This commit is contained in:
2026-02-18 13:08:01 +01:00
parent f8d0d83476
commit b07c9a0d2a
9 changed files with 3367 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
using UnityEngine;
using UnityEngine.Events;
public class Springboard : MonoBehaviour
{
[SerializeField] private float _force = 60;
[SerializeField] private float _duration = .4f;
[SerializeField] private AnimationCurve _curve = AnimationCurve.EaseInOut(0, 1, 1, 0);
[SerializeField] private UnityEvent _onJump;
void OnTriggerEnter(Collider col)
{
if (Player.Owner && col.gameObject == Player.Owner.gameObject)
{
Debug.Log("Player triggered springboard");
Player.Owner.AddExtraForce(Vector3.up * _force, true, _duration, _curve);
_onJump?.Invoke();
}
}
}