using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace Framework.DataHandling
{
    /// <summary>
    /// The QuaternionData class is used to serialize the Quaternion class as 
    /// Unity classes cannot be serialized.
    /// </summary>
    [Serializable]
    public class QuaternionData
    {
        public float x;
        public float y;
        public float z;
        public float w;

        /// <summary>
        /// Initializes a new instance of the <see cref="QuaternionData"/> class.
        /// Does so by taking in a Quaternion object and storing all of its 
        /// significant values.
        /// </summary>
        /// <param name="vector3">The quaternion.</param>
        public QuaternionData(Quaternion quaternion)
        {
            this.x = quaternion.x;
            this.y = quaternion.y;
            this.z = quaternion.z;
            this.w = quaternion.w;
        }

        /// <summary>
        /// Converts this QuaternionData object back into a Quaternion object.
        /// </summary>
        /// <returns></returns>
        public Quaternion ToQuaternion()
        {
            return new Quaternion(this.x, this.y, this.z, this.w);
        }
    }
}
