本文整理汇总了C++中GameObject::GetDestructibleState方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::GetDestructibleState方法的具体用法?C++ GameObject::GetDestructibleState怎么用?C++ GameObject::GetDestructibleState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::GetDestructibleState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessEvent
void BattlefieldTB::ProcessEvent(WorldObject* obj, uint32 eventId)
{
if (!IsWarTime())
return;
if (eventId == EVENT_COUNT_CAPTURED_BASE)
{
UpdateCapturedBaseCount();
return;
}
if (!obj)
return;
GameObject* go = obj->ToGameObject();
if (!go)
return;
TBTowerId towerId;
switch (go->GetEntry())
{
case GO_WEST_SPIRE:
towerId = TB_TOWER_WEST_SPIRE;
break;
case GO_EAST_SPIRE:
towerId = TB_TOWER_EAST_SPIRE;
break;
case GO_SOUTH_SPIRE:
towerId = TB_TOWER_SOUTH_SPIRE;
break;
default:
return;
}
if (go->GetDestructibleState() == GO_DESTRUCTIBLE_DAMAGED)
TowerDamaged(towerId);
else if (go->GetDestructibleState() == GO_DESTRUCTIBLE_DESTROYED)
TowerDestroyed(towerId);
}
示例2: FillInitialWorldStates
//.........这里部分代码省略.........
case GO_CAPTURE_POINT_WEST_A_DEFENDING:
case GO_CAPTURE_POINT_WEST_H_DEFENDING:
i = TB_BASE_WARDENS_VIGIL;
break;
default:
continue;
}
TeamId team = TEAM_NEUTRAL;
bool controlled = false;
bool capturing = false;
switch (itr->second->GetObjectiveState())
{
case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE:
case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE:
controlled = true;
team = itr->second->GetTeamId();
break;
case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
case BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
team = TEAM_ALLIANCE;
capturing = true;
break;
case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
case BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
team = TEAM_HORDE;
capturing = true;
break;
default:
team = TEAM_NEUTRAL;
break;
}
packet.Worldstates.emplace_back(uint32(TBCapturePoints[i].wsControlled[TEAM_ALLIANCE]), int32(team == TEAM_ALLIANCE && controlled ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBCapturePoints[i].wsCapturing[TEAM_ALLIANCE]), int32(team == TEAM_ALLIANCE && capturing ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBCapturePoints[i].wsNeutral), int32(team == TEAM_NEUTRAL ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBCapturePoints[i].wsCapturing[TEAM_HORDE]), int32(team == TEAM_HORDE && capturing ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBCapturePoints[i].wsControlled[TEAM_HORDE]), int32(team == TEAM_HORDE && controlled ? 1 : 0));
}
packet.Worldstates.emplace_back(uint32(TB_WS_TOWERS_DESTROYED_SHOW), int32(GetData(BATTLEFIELD_TB_DATA_TOWERS_DESTROYED)));
packet.Worldstates.emplace_back(uint32(TB_WS_BUILDINGS_CAPTURED_SHOW), int32(IsWarTime() ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_BUILDINGS_CAPTURED), int32(GetData(BATTLEFIELD_TB_DATA_BUILDINGS_CAPTURED)));
packet.Worldstates.emplace_back(uint32(TB_WS_TOWERS_DESTROYED), int32(0));
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_BATTLE_END_SHOW), int32(IsWarTime() ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_STATE_BATTLE), int32(IsWarTime() ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_STATE_PREPARATIONS), int32(GetState() == BATTLEFIELD_WARMUP ? 1 : 0));
// Not sure if TB
//packet.Worldstates.emplace_back(uint32(TB_WS_35_UNKNOWN), int32(0));
//packet.Worldstates.emplace_back(uint32(TB_WS_36_UNKNOWN), int32(0));
//packet.Worldstates.emplace_back(uint32(TB_WS_37_UNKNOWN), int32(0));
// Unused tower icons
packet.Worldstates.emplace_back(uint32(TB_WS_WEST_DAMAGED_NEUTRAL), int32(0));
packet.Worldstates.emplace_back(uint32(TB_WS_WEST_INTACT_NEUTRAL), int32(0));
packet.Worldstates.emplace_back(uint32(TB_WS_EAST_DAMAGED_NEUTRAL), int32(0));
packet.Worldstates.emplace_back(uint32(TB_WS_EAST_INTACT_NEUTRAL), int32(0));
// Towers/spires
for (uint8 i = 0; i < TB_TOWERS_COUNT; i++)
{
// Find gameobject
for (ObjectGuid guid : Towers)
{
GameObject* tower = GetGameObject(guid);
if (!tower || tower->GetEntry() != TBTowers[i].entry)
continue;
TeamId team = GetDefenderTeam(); // 0-false -> alliance; 1-true -> horde
bool intact = tower->GetDestructibleState() == GO_DESTRUCTIBLE_INTACT;
bool damaged = tower->GetDestructibleState() == GO_DESTRUCTIBLE_DAMAGED;
bool destroyed = tower->GetDestructibleState() == GO_DESTRUCTIBLE_DESTROYED;
packet.Worldstates.emplace_back(uint32(TBTowers[i].wsIntact[TEAM_ALLIANCE]), int32(!team && intact ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBTowers[i].wsDamaged[TEAM_ALLIANCE]), int32(!team && damaged ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBTowers[i].wsDestroyed), int32(destroyed ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBTowers[i].wsDamaged[TEAM_HORDE]), int32(team && damaged ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TBTowers[i].wsIntact[TEAM_HORDE]), int32(team && intact ? 1 : 0));
}
}
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_NEXT_BATTLE_SHOW), int32(!IsWarTime() ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_ALLIANCE_CONTROLS_SHOW), int32(!IsWarTime() && GetDefenderTeam() == TEAM_ALLIANCE ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_HORDE_CONTROLS_SHOW), int32(!IsWarTime() && GetDefenderTeam() == TEAM_HORDE ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_BATTLE_END), int32(IsWarTime() ? time(NULL) + (m_Timer / 1000) : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_NEXT_BATTLE), int32(!IsWarTime() ? time(NULL) + (m_Timer / 1000) : 0));
// Not sure if TB
//packet.Worldstates.emplace_back(uint32(TB_WS_65_UNKNOWN), int32(0));
//packet.Worldstates.emplace_back(uint32(TB_WS_66_UNKNOWN), int32(0));
packet.Worldstates.emplace_back(uint32(TB_WS_KEEP_ALLIANCE), int32(GetDefenderTeam() == TEAM_ALLIANCE ? 1 : 0));
packet.Worldstates.emplace_back(uint32(TB_WS_KEEP_HORDE), int32(GetDefenderTeam() == TEAM_HORDE ? 1 : 0));
}