//
// ToolsAVP_Entity_AdvancedVolumeTrigger.h
//
// Created by Anthony Gregson - 08/09/05 (from ToolsFPSDemo_Entity_AdvancedVolumeTrigger by Andrew Weinkove - 14/04/2004)
// 
// Copyright (C) 2005 Rebellion, All Rights Reserved.
//


#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __TOOLSAVP_ENTITY_ADVANCEDVOLUMETRIGGER_H__
#define __TOOLSAVP_ENTITY_ADVANCEDVOLUMETRIGGER_H__

#include "Entity/Tools_Entity_AdvancedVolumeTrigger.h"
#include "Objects/Tools_Object_System.h"

//////////////////////////////////////////////////////////////////////////////////////////////////
/*-------------------------------------------**
** ToolsAVP_Entity_AdvancedVolumeTrigger **
**-------------------------------------------*/

class ToolsAVP_Entity_AdvancedVolumeTrigger : public Tools_Entity_AdvancedVolumeTrigger 
{
    friend class ToolsAVP_ChooseEntityForAdvancedVolumeTrigger;

protected:
	ToolsAVP_Entity_AdvancedVolumeTrigger( Asura_Entity* pxEntity );
	~ToolsAVP_Entity_AdvancedVolumeTrigger();

public:
	static void Create();
	static Tools_Object* Create( Asura_Entity* pxEntity );

	void AddOverlayControls(class Asura_Overlay* pxNewOverlay,class Asura_Vector_2& xOffset);

    void OnSelection();
    void OnDeselection();

private:
    static ToolsAVP_Entity_AdvancedVolumeTrigger* s_pxThis;
    Tools_ChooseObject* m_pxChooseObject;

private:
    static void SetSpecificGuid();
    static void GoToObjectWithGuid();
    void SetSpecificGuid( Tools_Object* pxObject );
};

class ToolsAVP_ChooseEntityForAdvancedVolumeTrigger : public Tools_ChooseObject
{
public :
	ToolsAVP_ChooseEntityForAdvancedVolumeTrigger( ToolsAVP_Entity_AdvancedVolumeTrigger* pxVolumeTrigger )
    : m_pxVolumeTrigger( pxVolumeTrigger )
    {}

    virtual bool CanBeSelected( Tools_Object* pxObject ) { return true; }
	virtual void ObjectSelected( Tools_Object* pxObject )
    {
        m_pxVolumeTrigger->SetSpecificGuid( pxObject );
    }
    virtual void OnFinish() { m_pxVolumeTrigger->m_pxChooseObject = 0; delete this; }

private:
    ToolsAVP_Entity_AdvancedVolumeTrigger* m_pxVolumeTrigger;
};

#endif //__TOOLSAVP_ENTITY_ADVANCEDVOLUMETRIGGER_H__
