本文整理汇总了C++中Door::SetClosing方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::SetClosing方法的具体用法?C++ Door::SetClosing怎么用?C++ Door::SetClosing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::SetClosing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenDoor
//
// OpenDoor
//
void Raycaster::OpenDoor(bool hasKey, bool *needAKey)
{
static int doorPosX, doorPosY;
static Uint32 lDoorOpen = 0;
int i;
// Don't close doors we're standing in
if(map[(int)posY][(int)posX] == DOOR_INDEX)
return;
for(i=0; i<4; i++)
{
switch(i)
{
case 0:
doorPosX = (int)posX;
doorPosY = (int)posY + 1;
break;
case 1:
doorPosX = (int)posX + 1;
doorPosY = (int)posY;
break;
case 2:
doorPosX = (int)posX;
doorPosY = (int)posY - 1;
break;
case 3:
doorPosX = (int)posX - 1;
doorPosY = (int)posY;
break;
}
if(doorPosX < 0 || doorPosY < 0)
continue;
if(map[doorPosY][doorPosX] == DOOR_INDEX || map[doorPosY][doorPosX] == LOCKED_DOOR_INDEX)
{
if(lDoorOpen == 0)
lDoorOpen = SDL_GetTicks();
else if(SDL_GetTicks() - lDoorOpen < DOOR_CHG_TIME)
continue;
Door *door = GetDoorAt(doorPosX, doorPosY);
//door->SetOpen(!door->IsOpen());
if(!door->IsLockedDoor() || hasKey)
{
if(!door->IsOpen())
door->SetOpening(true);
else
door->SetClosing(true);
lDoorOpen = SDL_GetTicks();
}
else if(door->IsLockedDoor())
*needAKey = true;
return;
}
else if(map[doorPosY][doorPosX] == EXIT_DOOR_INDEX)
mapChange = true;
}
}