Untitled

mail@pastecode.io avatar
unknown
csharp
16 days ago
669 B
1
Indexable
Never
using UnityEngine;

public class DashPanel : MonoBehaviour
{
    [SerializeField] private float dashSpeed = 50f;
    [SerializeField] private float dashDuration = 1f;

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            MoveAction moveAction = other.GetComponent<MoveAction>();
            PlayerPhysics playerPhysics = other.GetComponent<PlayerPhysics>();

            if (moveAction != null && playerPhysics != null && playerPhysics.groundInfo.ground)
            {
                moveAction.TriggerDash(dashSpeed, dashDuration, transform.forward);
            }
        }
    }
}
Leave a Comment