using UnityEngine; namespace CreatureControl { /// /// A leg of a creature /// [System.Serializable] public class Leg { /// /// The upper leg or thigh bone /// public Transform femur; /// /// The lower leg or shank bone /// public Transform tibia; /// /// The foot bone /// public Transform tarsus; [SerializeField] private float _femurLength; public float femurLength { get { if (_femurLength <= 0) _femurLength = Vector3.Distance(this.femur.position, this.tibia.position); return _femurLength; } } // A bit inefficient is this is used a lot... public float tibiaLength => Vector3.Distance(this.tibia.position, this.tarsus.position); public float length => femurLength + tibiaLength; /// /// Check if all bones of the legs have been configured /// /// True when all bones are configured public bool isConfigured => femur != null && tibia != null && tarsus != null; } }