public static CoordStruct Destination(this ILocomotion locomotion) { CoordStruct tmp = default; locomotion.Destination(tmp.GetThisPointer()); return(tmp); }
public static CoordStruct Head_To_Coord(this ILocomotion locomotion) { CoordStruct tmp = default; locomotion.Head_To_Coord(tmp.GetThisPointer()); return(tmp); }
public static void Stop(this ILocomotion locomotion) { Ensure.That(locomotion, nameof(locomotion)).IsNotNull(); locomotion.Move(Vector3.Zero); locomotion.Rotate(Vector3.Zero); }
public static void Stop([NotNull] this ILocomotion locomotion) { Ensure.Any.IsNotNull(locomotion, nameof(locomotion)); locomotion.Move(Vector3.Zero); locomotion.Rotate(Vector3.Zero); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (Locomotion == null) { Locomotion = animator.GetComponentInParent <Character>()._Locomotion; } Locomotion.Jump(Height); }
public static Pointer <LocomotionClass> ToLocomotionClass(this ILocomotion locomotion) { Pointer <IntPtr> ptr = Marshal.GetIUnknownForObject(locomotion); Marshal.Release(ptr); ptr -= 1; return(ptr.Convert <LocomotionClass>()); }
private void Awake() { if (_characterInput == null) { _characterInput = GetComponent <ICharacterInput>(); } if (_characterMover == null) { _characterMover = GetComponent <IMover>(); } if (PlayerCamera == null) { if (GameObject.Find("[WorldTransform]") == false) { PlayerCamera = new GameObject("[WorldTransform]").transform; } } _Locomotion = new Locomotion(this.gameObject, rotationSpeed, JumpHeight, PlayerCamera, MovementVectorBlend, TurnRotationBlend, _characterInput, _characterMover); }
public static bool IsStationary(this ILocomotion locomotion, float threshold = 0.1f) => !IsMoving(locomotion, threshold) && !IsTurning(locomotion, Mathf.Max(threshold, 0));
public static bool IsTurning(this ILocomotion locomotion, float threshold = 0.1f) { Ensure.That(locomotion, nameof(locomotion)).IsNotNull(); return(locomotion.RotationalVelocity.LengthSquared() >= Mathf.Max(threshold, 0)); }
private void Start() { locomotion = gameObject.GetComponent<ILocomotion> (); }
public static bool IsStationary([NotNull] this ILocomotion locomotion, float threshold = 0.1f) { Ensure.Any.IsNotNull(locomotion, nameof(locomotion)); return(!IsMoving(locomotion, threshold) && !IsTurning(locomotion, threshold)); }
public static bool IsTurning([NotNull] this ILocomotion locomotion, float threshold = 0.1f) { Ensure.Any.IsNotNull(locomotion, nameof(locomotion)); return(locomotion.RotationalVelocity.LengthSquared() >= threshold); }
public static Pointer <TLocomotionClass> ToLocomotionClass <TLocomotionClass>(this ILocomotion locomotion) { return(locomotion.ToLocomotionClass().Convert <TLocomotionClass>()); }
public SpeedAdapter(ILocomotion newLocomotion) { _newLocomotion = newLocomotion; }