//===========================================================================//
// File:	SimpleChannelAnimator.hpp                                                 
// Project: MechWarrior 4
// Contents: 
//			
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 12/17/99  JSE  Initial coding, 
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Fasa Interactive, Inc.
// All Rights reserved worldwide
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL
//===========================================================================//

#pragma once

namespace MechWarrior4 {


	//##########################################################################
	//#########################    SimpleChannelAnimator    ###############################
	//##########################################################################
	
	template <class T> class SimpleChannelAnimatorOf 
	{
	public:
				
		SimpleChannelAnimatorOf()
		{
			currentTime = 0.0f;
			totalTime = 0.0f;
			dirtyFlag = true;
		};

		~SimpleChannelAnimatorOf()
			{};


		void Init(T start_position, T end_position, Stuff::Scalar total_time)
		{
			currentTime = 0;
			currentPosition = start_position;
			startPosition = start_position;
			endPosition = end_position;
			totalTime = total_time;
			dirtyFlag = true;
		}
		
		T GetCurrentValue()
		{
			if (dirtyFlag)
				UpdatePosition();

			return currentPosition;
		}

		void UpdateTime(Stuff::Scalar time_slice)
		{	
		
			if (currentTime < totalTime)
			{
				currentTime += time_slice;
				dirtyFlag = true;
			}
		}

		bool AnimDone()
		{
			if (currentTime >= totalTime)
				return true;

			return false;
		}

		void UpdatePosition(void);

		bool dirtyFlag;
		
		Stuff::Scalar currentTime;
		Stuff::Scalar totalTime;

		T currentPosition;
		T startPosition;
		T endPosition;
	};







}

