Beispiel #1
0
        public override void updateMovement(CharacterMovement movement)
        {
            animator.SetFloat("moveAmount", movement.moveAmount);
            Vector3 desiredMoveDirection = (movement.position - transform.position).normalized;

            desiredMoveDirection.y = 0f;
            if (desiredMoveDirection == Vector3.zero)
            {
                desiredMoveDirection = transform.forward;
            }

            transform.rotation = Quaternion.LookRotation(desiredMoveDirection);
            this.movement      = movement;
        }
Beispiel #2
0
        public virtual void updateMovement(CharacterMovement movement)
        {
            animator.SetFloat("moveAmount", movement.moveAmount);
            Vector3 desiredMoveDirection = movement.direction;

            desiredMoveDirection.y = 0f;
            if (desiredMoveDirection == Vector3.zero)
            {
                desiredMoveDirection = transform.forward;
            }

            Quaternion lookAngle = Quaternion.LookRotation(desiredMoveDirection);

            transform.rotation = Quaternion.RotateTowards(transform.rotation, lookAngle, rotationSpeed);
            this.movement      = movement;
        }
Beispiel #3
0
 public static void deserialize(byte[] data, ref Int32 offset, out CharacterMovement value)
 {
     deserialize(data, ref offset, out value.moveAmount);
     deserialize(data, ref offset, out value.direction);
     deserialize(data, ref offset, out value.position);
 }
Beispiel #4
0
 public static void serialize(MemoryStream stream, CharacterMovement value)
 {
     serialize(stream, value.moveAmount);
     serialize(stream, value.direction);
     serialize(stream, value.position);
 }