Exemple #1
0
        public static CoordStruct Destination(this ILocomotion locomotion)
        {
            CoordStruct tmp = default;

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

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

            locomotion.Move(Vector3.Zero);
            locomotion.Rotate(Vector3.Zero);
        }
Exemple #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);
 }
Exemple #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>());
        }
Exemple #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);
 }
Exemple #8
0
 public static bool IsStationary(this ILocomotion locomotion, float threshold = 0.1f) =>
 !IsMoving(locomotion, threshold) && !IsTurning(locomotion, Mathf.Max(threshold, 0));
Exemple #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));
        }
Exemple #10
0
 private void Start()
 {
     locomotion = gameObject.GetComponent<ILocomotion> ();
 }
Exemple #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));
        }
Exemple #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);
        }
Exemple #13
0
 public static Pointer <TLocomotionClass> ToLocomotionClass <TLocomotionClass>(this ILocomotion locomotion)
 {
     return(locomotion.ToLocomotionClass().Convert <TLocomotionClass>());
 }
Exemple #14
0
 public SpeedAdapter(ILocomotion newLocomotion)
 {
     _newLocomotion = newLocomotion;
 }