//*******************************************************************
//
// File: Asura_Affector.h                    
//
// Created: 9 Nov 2006
//
// Description: 
//
//*******************************************************************

#ifndef _ASURA_AFFECTOR_H_
#define _ASURA_AFFECTOR_H_

#if defined( ASURA_USE_AFFECTORS) && 1 == ASURA_USE_AFFECTORS

// other libraries
#include "Core/Asura_Maths.h"

// internal dependencies

// forward declarations
class Asura_Chunk_Stream;

//*******************************************************************
// Constants
//*******************************************************************


//*******************************************************************
// Class Definitions
//*******************************************************************

class Asura_Affector
{
	/// Kevin Lea - 25/09/2002 15:25:13 - Asura_Affector's are created/destroyed from a 
	/// memory pool, and so don't want (or need) a constructor or destructor

	public:
		void Reset (void)
		{
			m_uFlags	= 0;
			m_bActive	= true;
			m_fRange	= 1.0f;
			m_fStrength	= 1.0f;
			m_xPosition.Zero();
		}

		void	ReadFromChunkStream	(Asura_Chunk_Stream& xStream);
		void	WriteToChunkStream	(Asura_Chunk_Stream& xStream) const;


		inline void SetAsActive(const bool bFlag)
		{
			m_bActive = bFlag;
		}

		/// Kevin Lea - 16/09/2002 17:46:15 - access methods
		
		inline bool IsActive(void) const
		{
			return m_bActive;
		}

		inline void SetPosition(const Asura_Vector_3& xPosition)
		{
			m_xPosition = Asura_AVector3( xPosition);
		}

		inline const Asura_Vector_3 GetPosition(void) const
		{
			return Asura_Vector_3( m_xPosition);
		}

		inline const Asura_AVector3& GetPositionA(void) const
		{
			return m_xPosition;
		}

		inline void SetRange(const float fRange)
		{
			m_fRange = fRange;
		}
		inline float GetRange(void) const
		{
			return m_fRange;
		}

		inline void SetStrength(const float fStrength)
		{
			m_fStrength = fStrength;
		}
		inline float GetStrength(void) const
		{
			return m_fStrength;
		}

		inline void SetFlags(const u_int uFlags)
		{
			m_uFlags = uFlags;
		}
		inline u_int GetFlags(void) const
		{
			return m_uFlags;
		}

		Asura_Affector& operator= (const Asura_Affector& xOther)
		{
			m_xPosition		= xOther.m_xPosition;
			m_fRange		= xOther.m_fRange;
			m_fStrength		= xOther.m_fStrength;
			m_uFlags		= xOther.m_uFlags;
			return(*this);
		}

	private:
		
		Asura_AVector3	m_xPosition;
		float			m_fRange;
		float			m_fStrength;

		union
		{
			u_int		m_uFlags;

			struct
			{
				u_int	m_bActive : 1;
			};
		};
};



//*******************************************************************
// Inline Function Definitions
//*******************************************************************


//*******************************************************************
//
// (c) 2006 Rebellion
//
// Warning: This computer program is protected by copyright law and 
// international treaties. Unauthorized reproduction or distribution
// of this program, or any portion of it, may result in severe civil and
// criminal penalties, and will be prosecuted to the maximum extent 
// possible under the law.
//
//*******************************************************************

#endif //defined( ASURA_USE_AFFECTORS) && 1 == ASURA_USE_AFFECTORS

#endif // _ASURA_AFFECTOR_H_
