using System.Collections.Generic; using System.Linq; using UnityEngine; namespace Moonlit.FootstepPro { [AddComponentMenu("FootprintSystem/Detectors/MaximumDistanceToGround")] public class MaximumDistanceToGround : IStepDetector { [SerializeField] private float MaxDistance; public override bool Detect(Foot foot) { List list = Physics.RaycastAll(foot.transform.position + foot.Controller.Up, -foot.Controller.Up).ToList(); if (list.Count == 0) { return false; } List list2 = list.Where(delegate(RaycastHit x) { Surface component = x.collider.GetComponent(); return component != null && component.Type != null; }).ToList(); if (list2.Count == 0) { return false; } RaycastHit[] array = list2.OrderBy((RaycastHit x) => x.distance).ToArray(); return array[0].distance - 1f < MaxDistance; } public override void Callback(bool footPlaced) { } private void Reset() { _Type = CombineType.Required; } } }