Esempio n. 1
0
        public static CoordStruct Destination(this ILocomotion locomotion)
        {
            CoordStruct tmp = default;

            locomotion.Destination(tmp.GetThisPointer());
            return(tmp);
        }
Esempio n. 2
0
        public static CoordStruct Head_To_Coord(this ILocomotion locomotion)
        {
            CoordStruct tmp = default;

            locomotion.Head_To_Coord(tmp.GetThisPointer());
            return(tmp);
        }
Esempio n. 3
0
        public static void Stop(this ILocomotion locomotion)
        {
            Ensure.That(locomotion, nameof(locomotion)).IsNotNull();

            locomotion.Move(Vector3.Zero);
            locomotion.Rotate(Vector3.Zero);
        }
Esempio n. 4
0
        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);
 }
Esempio n. 6
0
        public static Pointer <LocomotionClass> ToLocomotionClass(this ILocomotion locomotion)
        {
            Pointer <IntPtr> ptr = Marshal.GetIUnknownForObject(locomotion);

            Marshal.Release(ptr);
            ptr -= 1;

            return(ptr.Convert <LocomotionClass>());
        }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 public static bool IsStationary(this ILocomotion locomotion, float threshold = 0.1f) =>
 !IsMoving(locomotion, threshold) && !IsTurning(locomotion, Mathf.Max(threshold, 0));
Esempio n. 9
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));
        }
Esempio n. 10
0
 private void Start()
 {
     locomotion = gameObject.GetComponent<ILocomotion> ();
 }
Esempio n. 11
0
        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));
        }
Esempio n. 12
0
        public static bool IsTurning([NotNull] this ILocomotion locomotion, float threshold = 0.1f)
        {
            Ensure.Any.IsNotNull(locomotion, nameof(locomotion));

            return(locomotion.RotationalVelocity.LengthSquared() >= threshold);
        }
Esempio n. 13
0
 public static Pointer <TLocomotionClass> ToLocomotionClass <TLocomotionClass>(this ILocomotion locomotion)
 {
     return(locomotion.ToLocomotionClass().Convert <TLocomotionClass>());
 }
Esempio n. 14
0
 public SpeedAdapter(ILocomotion newLocomotion)
 {
     _newLocomotion = newLocomotion;
 }