
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_InventoryItem_PredatorCloak.h
// Author : Andy Tate
// Date   : 28-Nov-2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __AVP_INVENTORYITEM_PREDATORCLOAK_H__
#define __AVP_INVENTORYITEM_PREDATORCLOAK_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

#include "Inventory/AVP_Inventory_Item.h"


////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////

class AVP_Actor_DynamicStat;
class AVP_ClientActor_Predator;
class AVP_Vertebrate_StateHandler;
class AVP_CloakEffect;


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Class        : AVP_InventoryItem_Cloak
// Author       : Andy Tate
// Date         : 28-Nov-2007
//
// Description  : Class used to handle the Predator's cloaking via the
//				  inventory-system.
////////////////////////////////////////////////////////////////////////////////

class AVP_InventoryItem_Cloak : public AVP_Inventory_Item
{
public:
	// Public enumerated types...
	enum CloakTransitionTypes
	{
		TT_MANUAL	= NUM_ITEM_TRANSITION_TYPES,
		TT_AUTOMATIC,
		TT_INSTANT,

		NUM_CLOAK_TRANSITION_TYPES
	};

	enum CloakUsageTypes
	{
		UT_CLOAK	= NUM_ITEM_USAGE_TYPES,

		NUM_CLOAK_USAGE_TYPES
	};

	// Public functions...
	AVP_InventoryItem_Cloak(AVP_Inventory_Group& xParentGroup);
	virtual ~AVP_InventoryItem_Cloak();

	// Chunk processing functions...
	virtual	void	ReadFromChunkStream(Asura_Chunk_Stream& xStream);
	virtual	void	WriteToChunkStream(Asura_Chunk_Stream& xStream) const;

	// Accessor functions...
	AVP_CloakEffect*	GetCloakEffect(void) const	{ return(m_pxCloakEffect); }

	virtual bool GetCanUseIdling(const bool bInstant, const u_int uTransitionType) const;
	virtual bool GetCanUseUsageType(const u_int uUsageType, const u_int uTransitionType) const;

protected:
	// Protected variables...
	AVP_CloakEffect*	m_pxCloakEffect;
	float				m_fCloakedEnergyDrainStanding;
	float				m_fCloakedEnergyDrainWalking;
	float				m_fCloakedEnergyDrainRunning;
	float				m_fCloakedEnergyDrainSprinting;
	float				m_fCloakedEnergyDrainCrouching;

	// Anim controller hash, for manual transitions on the client.
	Asura_Hash_ID m_uAnimControllerHash;

	Asura_Handle m_iSoundHandle;

	// Protected functions...
	bool			UpdateEnergy(AVP_ClientActor_Predator& xPred, AVP_Actor_DynamicStat& xDynamicEnergy);
	void			PlayOneShotSound(AVP_ClientEntity_Actor& xClient, const Asura_Hash_ID uBlueprintParamHash);

	// Overridden state functions...
	virtual void	OnStateChange(const u_int uOldState, const u_int uNewState);

	virtual void	UpdateClientState(AVP_ClientEntity_Actor& xClient);
	virtual void	UpdateServerState(AVP_ServerEntity_Actor& xServer);

	// Since we play the same anim regardless of whether we're beginning or ending using, a shared function is the obvious way to go.
	void PlayAnimation();

private:
	void GetStaticDataFromBlueprint();

	typedef AVP_Inventory_Item PARENT;

	AVP_InventoryItem_Cloak(void);
	AVP_InventoryItem_Cloak(const AVP_InventoryItem_Cloak& xOther);
	AVP_InventoryItem_Cloak&	operator=(const AVP_InventoryItem_Cloak& xOther);

	static const u_int uCURRENT_CHUNK_VERSION = 1;
};

#endif   // ifndef __AVP_INVENTORYITEM_PREDATORCLOAK_H__


/// End of file. ///
