#ifdef ASURA_USE_AXON
//////////////////////////////////////////////////////////////////////////////
//
// Axon_Sense_Touch.h
//
// Created by NJD - 31 August 2006
//
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __AXON_SENSE_TOUCH_H__
#define __AXON_SENSE_TOUCH_H__ 1

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

// asura
#include "Core/Asura_HashedList.h"

// axon
#include "Knowledge/Axon_Sense.h"

// F O R W A R D   D E C L A R A T I O N S ///////////////////////////////////

class Asura_Blueprint;
class Asura_Chunk_Stream;
class Asura_Message;
class Asura_Vector_3;
struct Axon_Knowledge;

//////////////////////////////////////////////////////////////////////////////
//
// Axon_Sense_Touch
//
//////////////////////////////////////////////////////////////////////////////

class Axon_Sense_Touch : public Axon_Sense< Axon_Knowledge >
{
public:
    Axon_Sense_Touch( Axon_Knowledge_System< Axon_Knowledge >* pxKnowledgeSystem );
    virtual ~Axon_Sense_Touch();
    virtual void InitialiseFromBlueprint( const Asura_Blueprint& xBlueprint ) {}
    virtual void ReadFromChunkStream( Asura_Chunk_Stream& xStream );
    virtual void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;
    virtual void Update( const float fTimeslice );
    virtual bool HandleMessage( const Asura_Message* pxMessage );

    virtual void NewTouchData( const Asura_Guid uSourceGuid, const u_int uClassification,
                               const float fDamage, const Asura_Vector_3& xPosition, const Asura_Vector_3& xDirection,
                               const u_int uDamageType, const float fDistance = 0.0f );

    static void SetTouchDuration( const float fDuration ) { s_fTouchDuration = fDuration; }

    const Asura_Hashed_List< Axon_Knowledge >* GetList() const { return &m_xTouchList; }

protected:
    virtual bool ShouldCullTouch( Axon_Knowledge& xKnowledge );
    void         DestroyAllKnowledge();

protected:
    float                               m_fSensitivity;
    float                               m_fModifier;
    Asura_Hashed_List< Axon_Knowledge > m_xTouchList;

    static float s_fTouchDuration;

private:
    struct ChunkData
    {
        enum { CURRENT_VERSION = 0 };
        float m_fModifier;
    };
};

//////////////////////////////////////////////////////////////////////////////
//
// 
//
//////////////////////////////////////////////////////////////////////////////

#endif //__AXON_SENSE_TOUCH_H__
#endif
