CSCommon: MMatchWorldItem.h 소스 파일

MAIET

MMatchWorldItem.h

00001 #ifndef _MMATCHWORLDITEM_H
00002 #define _MMATCHWORLDITEM_H
00003 
00004 
00005 
00006 #include <vector>
00007 #include <list>
00008 #include <map>
00009 using namespace std;
00010 
00011 class MMatchStage;
00012 class MMatchObject;
00013 class MZFileSystem;
00014 
00015 
00016 // 맵에 생성된 아이템
00017 struct MMatchWorldItem
00018 {
00019     unsigned short      nUID;
00020     unsigned short      nItemID;
00021     short               nStaticSpawnIndex;
00022     float               x;
00023     float               y;
00024     float               z;
00025     int                 nLifeTime;          // 아이템 활성 시간( -1이면 무한 )
00026 
00027     union {
00028         int             nQuestItemID;       // 만약 퀘스트 아이템일 경우 QuestItem의 ID
00029     };
00030 };
00031 
00032 typedef map<unsigned short, MMatchWorldItem*> MMatchWorldItemMap;
00033 
00034 
00035 // 맵의 스폰 정보
00036 struct MMatchWorldItemSpawnInfo
00037 {
00038     unsigned short      nItemID;
00039     unsigned long int   nCoolTime;
00040     unsigned long int   nElapsedTime;
00041     float x;
00042     float y;
00043     float z;
00044     bool                bExist;
00045     bool                bUsed;
00046 };
00047 
00048 
00049 class MMatchWorldItemManager
00050 {
00051 private:
00052     MMatchStage*                        m_pMatchStage;
00053     MMatchWorldItemMap                  m_ItemMap;              // 맵에 존재하고 있는 아이템 리스트
00054 
00055     vector<MMatchWorldItemSpawnInfo>    m_SpawnInfos;           // 맵의 스폰 아이템 정보
00056     int                                 m_nSpawnItemCount;      // 스폰 아이템 정보 개수
00057     unsigned long int                   m_nLastTime;
00058 
00059     short                               m_nUIDGenerate;
00060     bool                                m_bStarted;
00061 
00062     void AddItem(const unsigned short nItemID, short nSpawnIndex, 
00063                  const float x, const float y, const float z);
00064     void AddItem(const unsigned short nItemID, short nSpawnIndex, 
00065                  const float x, const float y, const float z, int nLifeTime, int nQuestItemID);
00066     void DelItem(short nUID);
00067     void Spawn(int nSpawnIndex);
00068     void Clear();
00069     void SpawnInfoInit();
00070     void ClearItems();
00071 
00072     void RouteSpawnWorldItem(MMatchWorldItem* pWorldItem);
00073     void RouteOptainWorldItem(const MUID& uidPlayer, int nWorldItemUID);
00074     void RouteRemoveWorldItem(int nWorldItemUID);
00075 public:
00076     MMatchWorldItemManager();
00077     virtual ~MMatchWorldItemManager();
00078 
00079     // MMatchStage에서 관리하는 함수
00080     bool Create(MMatchStage* pMatchStage);
00081     void Destroy();
00082 
00083     void OnRoundBegin();
00084     void OnStageBegin(MMatchStageSetting* pStageSetting);
00085     void OnStageEnd();
00086     void Update();
00087 
00088     bool Optain(MMatchObject* pObj, short nItemUID, int& outItemID, int& outExtraValue);
00089     void SpawnDynamicItem(MMatchObject* pObj, const int nItemID, const float x, const float y, const float z);
00090     void SpawnDynamicItem(MMatchObject* pObj, const int nItemID, const float x, const float y, const float z, int nLifeTime, int nQuestItemID);
00091     void RouteAllItems(MMatchObject* pObj);
00092 
00093 };
00094 
00095 
00096 
00097 #endif


MAIET entertainment