BVB Source Codes

CRYENGINE Show TargetTrackGroup.h Source code

Return Download CRYENGINE: download TargetTrackGroup.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: Contains an agent's target tracks and handles updating them
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 02:01:2010: Created by Kevin Kirst
  12.  
  13. *************************************************************************/
  14.  
  15. #ifndef __TARGET_TRACK_GROUP_H__
  16. #define __TARGET_TRACK_GROUP_H__
  17.  
  18. #include "TargetTrackCommon.h"
  19.  
  20. class CTargetTrack;
  21. struct IDebugHistoryManager;
  22.  
  23. // Needed for CreateDummyPotentialTarget
  24. #include <CryAISystem/IPerceptionHandler.h>
  25.  
  26. class CTargetTrackGroup
  27. {
  28. public:
  29.         CTargetTrackGroup(TargetTrackHelpers::ITargetTrackPoolProxy* pTrackPoolProxy, tAIObjectID aiObjectId, uint32 uConfigHash, int nTargetLimit);
  30.         ~CTargetTrackGroup();
  31.  
  32.         tAIObjectID GetAIObjectID() const       { return m_aiObjectId; }
  33.         tAIObjectID GetLastBestTargetID() const { return m_aiLastBestTargetId; }
  34.         uint32      GetConfigHash() const       { return m_uConfigHash; }
  35.         int         GetTargetLimit() const      { return m_nTargetLimit; }
  36.         bool        IsEnabled() const           { return m_bEnabled; }
  37.         void        SetEnabled(bool bEnabled)   { m_bEnabled = bEnabled; }
  38.  
  39.         void        Reset();
  40.         void        Serialize_Write(TSerialize ser);
  41.         void        Serialize_Read(TSerialize ser);
  42.  
  43.         void        Update(TargetTrackHelpers::ITargetTrackConfigProxy* pConfigProxy);
  44.  
  45.         bool        HandleStimulusEvent(const TargetTrackHelpers::STargetTrackStimulusEvent& stimulusEvent, uint32 uStimulusNameHash);
  46.         bool        TriggerPulse(tAIObjectID targetID, uint32 uStimulusNameHash, uint32 uPulseNameHash);
  47.         bool        TriggerPulse(uint32 uStimulusNameHash, uint32 uPulseNameHash);
  48.         bool        GetDesiredTarget(TargetTrackHelpers::EDesiredTargetMethod eMethod, CWeakRef<CAIObject>& outTarget, SAIPotentialTarget*& pOutTargetInfo);
  49.         uint32      GetBestTrack(TargetTrackHelpers::EDesiredTargetMethod eMethod, CTargetTrack** tracks, uint32 maxCount);
  50.  
  51.         bool        IsPotentialTarget(tAIObjectID aiTargetId) const;
  52.         bool        IsDesiredTarget(tAIObjectID aiTargetId) const;
  53.  
  54. #ifdef TARGET_TRACK_DEBUG
  55.         // Debugging
  56.         void DebugDrawTracks(TargetTrackHelpers::ITargetTrackConfigProxy* pConfigProxy, bool bLastDraw);
  57.         void DebugDrawTargets(int nMode, int nTargetedCount, bool bExtraInfo = false);
  58. #endif //TARGET_TRACK_DEBUG
  59.  
  60.         typedef VectorMap<tAIObjectID, CTargetTrack*> TTargetTrackContainer;
  61.  
  62.         TTargetTrackContainer& GetTargetTracks() { return m_TargetTracks; }
  63.  
  64. private:
  65.         // Copy-construction and assignment not supported
  66.         CTargetTrackGroup(CTargetTrackGroup const&);
  67.         CTargetTrackGroup& operator=(CTargetTrackGroup const&);
  68.  
  69.         void               UpdateSortedTracks(bool bForced = false);
  70.         bool               TestTrackAgainstFilters(CTargetTrack* pTrack, TargetTrackHelpers::EDesiredTargetMethod eMethod) const;
  71.  
  72.         // Stimulus handling helpers
  73.         bool HandleStimulusEvent_All(const TargetTrackHelpers::STargetTrackStimulusEvent& stimulusEvent, uint32 uStimulusNameHash);
  74.         bool HandleStimulusEvent_Target(const TargetTrackHelpers::STargetTrackStimulusEvent& stimulusEvent, uint32 uStimulusNameHash, CTargetTrack* pTrack);
  75.  
  76.         // Returns the target track to be used for the given id
  77.         CTargetTrack* GetTargetTrack(tAIObjectID aiTargetId);
  78.         void          DeleteTargetTracks();
  79.  
  80.         //void UpdateTargetRepresentation(const CTargetTrack *pBestTrack, tAIObjectID &outTargetId, SAIPotentialTarget* &pOutTargetInfo);
  81.         void UpdateTargetRepresentation(const CTargetTrack* pBestTrack, CWeakRef<CAIObject>& outTarget, SAIPotentialTarget*& pOutTargetInfo);
  82.  
  83.         void InitDummy(); // set common dummy properties after creation.
  84.  
  85. private:
  86.         TTargetTrackContainer m_TargetTracks;
  87.  
  88.         typedef std::vector<CTargetTrack*> TSortedTracks;
  89.         TSortedTracks                              m_SortedTracks;
  90.  
  91.         TargetTrackHelpers::ITargetTrackPoolProxy* m_pTrackPoolProxy;
  92.         tAIObjectID                                m_aiObjectId;
  93.         tAIObjectID                                m_aiLastBestTargetId;
  94.         uint32             m_uConfigHash;
  95.         int                m_nTargetLimit;
  96.         bool               m_bNeedSort;
  97.         bool               m_bEnabled;
  98.  
  99.         SAIPotentialTarget m_dummyPotentialTarget;
  100.  
  101. #ifdef TARGET_TRACK_DEBUG
  102.         // Debugging
  103.         bool FindFreeGraphSlot(uint32& outIndex) const;
  104.  
  105.         float                 m_fLastGraphUpdate;
  106.         IDebugHistoryManager* m_pDebugHistoryManager;
  107.         enum { DEBUG_GRAPH_OCCUPIED_SIZE = 16 };
  108.         bool                  m_bDebugGraphOccupied[DEBUG_GRAPH_OCCUPIED_SIZE];
  109. #endif //TARGET_TRACK_DEBUG
  110. };
  111.  
  112. #endif //__TARGET_TRACK_GROUP_H__
  113.  
downloadTargetTrackGroup.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top