using Unity.Burst; using Unity.Entities; using UnityEngine; namespace GarmentButton.PathFinding { [BurstCompile] public class PathFinderMono : MonoBehaviour { [Min(0f)] public float MoveSpeed = 4f; [Min(0f)] public float StopDistance = 0.15f; } public class PathFinderMonoBaker : Baker { public override void Bake(PathFinderMono authoring) { var entity = GetEntity(TransformUsageFlags.Dynamic); AddBuffer(entity); AddComponent(entity); AddComponent(entity); AddComponent(entity); AddComponent(entity); AddComponent(entity, new PathRigidbodyMovement { MoveSpeed = authoring.MoveSpeed, StopDistance = authoring.StopDistance, }); SetComponentEnabled(entity, false); } } }