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

namespace Framework.DataHandling
{
    /// <summary>
    /// The NavMeshAgentData class is used to serialize the NavMeshAgent class as 
    /// Unity classes cannot be serialized.
    /// </summary>
    [Serializable]
    public class NavMeshAgentData
    {
        public Vector3Data velocity;

        /// <summary>
        /// Initializes a new instance of the <see cref="NavMeshAgentData"/> class.
        /// </summary>
        /// <param name="transform">The transform.</param>
        public NavMeshAgentData(NavMeshAgent navMeshAgent)
        {
            this.velocity = new Vector3Data(navMeshAgent.velocity);
        }

        /// <summary>
        /// Applies the stored values of this NavMeshAgentData object to a given
        /// NavMeshAgent.
        /// </summary>
        /// <param name="navMeshAgent">The NavMeshAgent.</param>
        public void ToNavMeshAgent(NavMeshAgent navMeshAgent)
        {
            navMeshAgent.velocity = this.velocity.ToVector3();
        }
    }
}