本文整理汇总了C++中CMonster::SpawnMonster方法的典型用法代码示例。如果您正苦于以下问题:C++ CMonster::SpawnMonster方法的具体用法?C++ CMonster::SpawnMonster怎么用?C++ CMonster::SpawnMonster使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMonster
的用法示例。
在下文中一共展示了CMonster::SpawnMonster方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VisiblityList
// update visibility list
bool CPlayer::VisiblityList( )
{
if(!this->Session->inGame) return true;
std::vector<CPlayer*> newVisiblePlayers;
std::vector<CDrop*> newVisibleDrops;
std::vector<unsigned int> newVisibleMonsters;
std::vector<CNPC*> newVisibleNPCs;
// Clients
CMap* map = GServer->MapList.Index[Position->Map];
for(UINT i=0;i<map->PlayerList.size();i++)
{
CPlayer* otherclient = map->PlayerList.at(i);
if ( this==otherclient || !otherclient->Session->inGame)
{
continue;
}
float distance = GServer->distance( this->Position->current, otherclient->Position->current );
if ( GServer->IsVisible( this, otherclient ) )
{
if ( distance < MAXVISUALRANGE && !otherclient->isInvisibleMode )
{
newVisiblePlayers.push_back( otherclient );
}
else
{
ClearObject( otherclient->clientid );
}
}
else
{
if ( distance < MINVISUALRANGE && !otherclient->isInvisibleMode )
{
newVisiblePlayers.push_back( otherclient );
otherclient->SpawnToPlayer(this, otherclient);
}
}
}
// Monsters
for(UINT i=0;i<map->MonsterList.size();i++)
{
CMonster* thismon = map->MonsterList.at( i );
float distance = GServer->distance ( this->Position->current, thismon->Position->current );
if ( GServer->IsVisible( this, thismon ) )
{
if (distance < MAXVISUALRANGE )
{
newVisibleMonsters.push_back( thismon->clientid);
}
else
{
ClearObject( thismon->clientid );
}
}
else
{
if ( distance< MINVISUALRANGE )
{
newVisibleMonsters.push_back( thismon->clientid);
thismon->SpawnMonster(this, thismon );
}
}
}
// Drops
for(unsigned i=0; i<map->DropsList.size(); i++)
{
CDrop* thisdrop = map->DropsList.at(i);
float distance = GServer->distance( this->Position->current, thisdrop->pos );
if ( GServer->IsVisible( this, thisdrop ) )
{
if ( distance< MAXVISUALRANGE )
{
newVisibleDrops.push_back( thisdrop );
}
else
{
this->ClearObject( thisdrop->clientid );
}
}
else
{
if ( distance < MINVISUALRANGE )
{
newVisibleDrops.push_back( thisdrop );
GServer->pakSpawnDrop( this, thisdrop );
}
}
}
// Npcs
for(unsigned i=0; i<map->NPCList.size(); i++)
{
CNPC* thisnpc = map->NPCList.at(i);
float distance = GServer->distance( this->Position->current, thisnpc->pos );
if ( GServer->IsVisible( this, thisnpc ) )
{
if ( distance < MAXVISUALRANGE )
{
newVisibleNPCs.push_back( thisnpc );
}
else
//.........这里部分代码省略.........