namespace Zinnia.Tracking.Velocity
{
using UnityEngine;
using Zinnia.Extension;
///
/// Tracked Velocity information.
///
public abstract class VelocityTracker : MonoBehaviour
{
///
/// The state of whether the is active.
///
/// Whether the is considered active.
public virtual bool IsActive()
{
return this.CheckIsActiveAndEnabled();
}
///
/// Gets the current velocity of the source.
///
/// The current velocity of the source
public virtual Vector3 GetVelocity()
{
return IsActive() ? DoGetVelocity() : Vector3.zero;
}
///
/// Gets the current angular velocity of the source.
///
/// The current angular velocity of the source
public virtual Vector3 GetAngularVelocity()
{
return (IsActive() ? DoGetAngularVelocity() : Vector3.zero);
}
///
/// Gets the current velocity of the source.
///
/// The current velocity of the source
protected abstract Vector3 DoGetVelocity();
///
/// Gets the current angular velocity of the source.
///
/// The current angular velocity of the source
protected abstract Vector3 DoGetAngularVelocity();
}
}