本文整理汇总了C++中Guard::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ Guard::Update方法的具体用法?C++ Guard::Update怎么用?C++ Guard::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guard
的用法示例。
在下文中一共展示了Guard::Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateGamePlay
void GameState_BasePlayable::UpdateGamePlay (float dT) {
const sf::Input& sfInput = Game->GetRenderWindow()->GetInput();
if (sfInput.IsKeyDown(sf::Key::Add)) Game->GetWorldCamera2D()->Zoom(1 + CAM_ZOOM_SPD * dT);
else if (sfInput.IsKeyDown(sf::Key::Subtract)) Game->GetWorldCamera2D()->Zoom(1 - CAM_ZOOM_SPD * dT);
if (player) {
player->Update(dT);
Game->GetWorldCamera2D()->SetCenterOfView(player->GetPosition());
if (chest && player->CanInteractWith(chest)) {
HUD->SetInteractContextNote(chest, "chest_collect");
}
else if (princess && player->CanInteractWith(princess)) {
HUD->SetInteractContextNote(princess, princess->IsFollowingAnyone() ?
"princess_stop" : "princess_follow");
}
else {
HUD->SetInteractContextNote(0);
}
}
else {
sf::Vector2f worldOffset(0, 0);
if (sfInput.IsKeyDown(sf::Key::Left)) worldOffset.x -= CAM_MOVE_SPD * dT;
else if (sfInput.IsKeyDown(sf::Key::Right)) worldOffset.x += CAM_MOVE_SPD * dT;
if (sfInput.IsKeyDown(sf::Key::Up)) worldOffset.y -= CAM_MOVE_SPD * dT;
else if (sfInput.IsKeyDown(sf::Key::Down)) worldOffset.y += CAM_MOVE_SPD * dT;
if (worldOffset != sf::Vector2f(0, 0)) Game->GetWorldCamera2D()->Move(worldOffset);
}
if (princess) princess->Update(dT);
if (HUD->GetInteractee()) {
if (!interacteeHighlight) {
interacteeHighlight = new WorldSprite("Content/Textures/glow.png",
LAYER_INTERACTEEHIGHLIGHT);
AddWorldSpace(interacteeHighlight);
SortAscendingWorld();
}
interacteeHighlight->SetPosition(HUD->GetInteractee()->GetPosition());
}
else {
PopWorldSpace(interacteeHighlight);
delete interacteeHighlight;
interacteeHighlight = 0;
}
const EntityMap& guards = (*GameObjects)[ID_GUARD];
Guard* guard;
for (EntityMap::const_iterator itG = guards.begin(); itG != guards.end(); itG++) {
guard = dynamic_cast<Guard*>(itG->second);
guard->Update(dT);
if (player) {
if (guard->CanSeePlayer(player)) {
OnGameFinished(false);
}
}
}
}