49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Moonlit.FootstepPro
|
|
{
|
|
[Serializable]
|
|
public abstract class IFootstepController : MonoBehaviour
|
|
{
|
|
public Vector3 Up
|
|
{
|
|
get
|
|
{
|
|
return base.transform.up;
|
|
}
|
|
}
|
|
|
|
public abstract void Callback(RaycastHit hitInfo, FootInfo footInfo);
|
|
|
|
protected GameObject GetPrefab(SurfaceType surfaceType, FootInfo footInfo)
|
|
{
|
|
return footInfo.Data.GetPrefab(surfaceType);
|
|
}
|
|
|
|
protected SurfaceType GetSurfaceType(RaycastHit hitInfo)
|
|
{
|
|
return hitInfo.collider.GetComponent<Surface>().Type;
|
|
}
|
|
|
|
protected Vector3 GetStandardPosition(RaycastHit hitInfo)
|
|
{
|
|
return hitInfo.point;
|
|
}
|
|
|
|
protected Quaternion GetStandardRotation(RaycastHit hitInfo, FootInfo footInfo)
|
|
{
|
|
Quaternion quaternion = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
|
|
Vector3 eulerAngles = footInfo.Rotation.eulerAngles;
|
|
Vector3 normalized = base.transform.up.normalized;
|
|
Quaternion quaternion2 = Quaternion.Euler(new Vector3(eulerAngles.x * normalized.x, eulerAngles.y * normalized.y, eulerAngles.z * normalized.z));
|
|
return quaternion * quaternion2;
|
|
}
|
|
|
|
protected float GetSurfaceDistance(RaycastHit hitInfo, FootInfo footInfo)
|
|
{
|
|
return Vector3.Distance(hitInfo.point, footInfo.Position);
|
|
}
|
|
}
|
|
}
|