本文整理汇总了C++中Position::GetOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ Position::GetOrientation方法的具体用法?C++ Position::GetOrientation怎么用?C++ Position::GetOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::GetOrientation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RelocateOffset
void Position::RelocateOffset(const Position & offset)
{
m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
SetOrientation(GetOrientation() + offset.GetOrientation());
}
示例2: IsWithinBox
bool Position::IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const
{
// rotate the WorldObject position instead of rotating the whole cube, that way we can make a simplified
// is-in-cube check and we have to calculate only one point instead of 4
// 2PI = 360*, keep in mind that ingame orientation is counter-clockwise
double rotation = 2 * M_PI - center.GetOrientation();
double sinVal = std::sin(rotation);
double cosVal = std::cos(rotation);
float BoxDistX = GetPositionX() - center.GetPositionX();
float BoxDistY = GetPositionY() - center.GetPositionY();
float rotX = float(center.GetPositionX() + BoxDistX * cosVal - BoxDistY*sinVal);
float rotY = float(center.GetPositionY() + BoxDistY * cosVal + BoxDistX*sinVal);
// box edges are parallel to coordiante axis, so we can treat every dimension independently :D
float dz = GetPositionZ() - center.GetPositionZ();
float dx = rotX - center.GetPositionX();
float dy = rotY - center.GetPositionY();
if ((std::fabs(dx) > xradius) ||
(std::fabs(dy) > yradius) ||
(std::fabs(dz) > zradius))
return false;
return true;
}
示例3: GetPositionOffsetTo
void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const
{
float dx = endPos.GetPositionX() - GetPositionX();
float dy = endPos.GetPositionY() - GetPositionY();
retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation());
}
示例4: MovementInform
void MovementInform(uint32 type, uint32 id)
{
if (type != POINT_MOTION_TYPE)
return;
switch (id)
{
case 1:
phase = PHASE_GROUND;
events.SetPhase(PHASE_GROUND);
events.ScheduleEvent(EVENT_LAND, 0, 0, PHASE_GROUND);
break;
case 2:
me->SetFacingTo(RazorFlight.GetOrientation());
break;
}
}
示例5: UpdateAI
void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
if (_phase == PHASE_GLOB && summons.empty())
{
DoResetThreat();
me->NearTeleportTo(ViscidusCoord.GetPositionX(),
ViscidusCoord.GetPositionY(),
ViscidusCoord.GetPositionZ(),
ViscidusCoord.GetOrientation());
_hitcounter = 0;
_phase = PHASE_FROST;
InitSpells();
me->SetVisible(true);
}
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_POISONBOLT_VOLLEY:
DoCast(me, SPELL_POISONBOLT_VOLLEY);
events.ScheduleEvent(EVENT_POISONBOLT_VOLLEY, urand(10000, 15000));
break;
case EVENT_POISON_SHOCK:
DoCast(me, SPELL_POISON_SHOCK);
events.ScheduleEvent(EVENT_POISON_SHOCK, urand(7000, 12000));
break;
case EVENT_RESET_PHASE:
_hitcounter = 0;
_phase = PHASE_FROST;
break;
default:
break;
}
}
if (_phase != PHASE_GLOB)
DoMeleeAttackIfReady();
}
示例6: MovementInform
void MovementInform(uint32 type, uint32 id) override
{
if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
return;
switch (id)
{
case POINT_SLABHIDE_INTRO:
me->SetFacingTo(SlabhideIntroLandPos.GetOrientation());
me->GetMotionMaster()->MoveLand(POINT_SLABHIDE_INTRO_LAND, SlabhideIntroLandPos);
break;
case POINT_SLABHIDE_INTRO_LAND:
me->SetCanFly(false);
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetHover(false);
me->SetHomePosition(SlabhideIntroLandPos);
me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
instance->SetData(DATA_SLABHIDE_INTRO, DONE);
break;
case POINT_SLABHIDE_MIDDLE:
_isFlying = true;
events.ScheduleEvent(EVENT_TAKEOFF, 100);
break;
case POINT_SLABHIDE_IN_AIR:
events.ScheduleEvent(EVENT_STALACTITE, 400);
break;
case POINT_SLABHIDE_LAND:
_isFlying = false;
//DoCast(me, SPELL_COOLDOWN_5S); // unknown purpose
events.ScheduleEvent(EVENT_ATTACK, 1200);
break;
default:
break;
}
}
示例7: Relocate
void Vehicle::Relocate(Position pos)
{
sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", me->GetEntry());
std::set<Unit*> vehiclePlayers;
for (int8 i = 0; i < 8; i++)
vehiclePlayers.insert(GetPassenger(i));
// passengers should be removed or they will have movement stuck
RemoveAllPassengers();
for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin();
itr != vehiclePlayers.end(); ++itr)
{
if (Unit* player = (*itr))
{
// relocate/setposition doesn't work for player
player->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(),
pos.GetPositionZ(), pos.GetOrientation());
}
}
me->UpdatePosition(pos, true);
}
示例8: UpdateAI
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (uiSpawnTimer <= diff)
{
for (uint8 i = 0; i < urand(2,HEROIC(3,5)); ++i)
DoSpawnCreature(RAND(NPC_DRAKKARI_INVADER_1,NPC_DRAKKARI_INVADER_2), AddSpawnPoint.GetPositionX(), AddSpawnPoint.GetPositionY(), AddSpawnPoint.GetPositionZ(), AddSpawnPoint.GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
uiSpawnTimer = urand(30000,40000);
} else uiSpawnTimer -= diff;
if (uiConsumeTimer <= diff)
{
DoScriptText(SAY_CONSUME, m_creature);
DoCast(HEROIC(SPELL_CONSUME, H_SPELL_CONSUME));
uiConsumeTimer = 15000;
} else uiConsumeTimer -= diff;
if (bAchiev)
{
if (uiAuraCountTimer <= diff)
{
if (m_creature->HasAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME)))
{
Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME));
if (pConsumeAura && pConsumeAura->GetStackAmount() > 9)
bAchiev = false;
}
uiAuraCountTimer = 16000;
} else uiAuraCountTimer -= diff;
}
if (uiCrushTimer <= diff)
{
DoCastVictim(SPELL_CRUSH);
uiCrushTimer = urand(10000,15000);
} else uiCrushTimer -= diff;
if (uiInfectedWoundTimer <= diff)
{
DoCastVictim(SPELL_INFECTED_WOUND);
uiInfectedWoundTimer = urand(25000,35000);
} else uiInfectedWoundTimer -= diff;
if (uiExplodeCorpseTimer <= diff)
{
DoCast(HEROIC(SPELL_CORPSE_EXPLODE, H_SPELL_CORPSE_EXPLODE));
DoScriptText(SAY_EXPLODE, m_creature);
uiExplodeCorpseTimer = urand(15000,19000);
} else uiExplodeCorpseTimer -= diff;
DoMeleeAttackIfReady();
}
示例9: UpdateAI
void UpdateAI(uint32 diff) override
{
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_SELECT_TARGET:
{
std::vector<Player*> PlayerInDalaranList;
GetPlayersInDalaran(PlayerInDalaranList);
// Increases chance of event based on player count in Dalaran (100 players or more = 100% else player count%)
if (PlayerInDalaranList.empty() || urand(1, 100) > PlayerInDalaranList.size())
me->AddObjectToRemoveList();
me->SetVisible(true);
DoCastSelf(SPELL_TELEPORT_VISUAL);
if (Player* player = SelectTargetInDalaran(PlayerInDalaranList))
{
playerGuid = player->GetGUID();
Position pos = player->GetPosition();
float dist = frand(10.0f, 30.0f);
float angle = frand(0.0f, 1.0f) * M_PI * 2.0f;
player->MovePositionToFirstCollision(pos, dist, angle);
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
}
events.ScheduleEvent(EVENT_LAUGH_1, Seconds(2));
break;
}
case EVENT_LAUGH_1:
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH_NO_SHEATHE);
events.ScheduleEvent(EVENT_WANDER, 3s);
break;
case EVENT_WANDER:
me->GetMotionMaster()->MoveRandom(8);
events.ScheduleEvent(EVENT_PAUSE, 1min);
break;
case EVENT_PAUSE:
me->GetMotionMaster()->MoveIdle();
events.ScheduleEvent(EVENT_CAST, 2s);
break;
case EVENT_CAST:
if (Player* player = me->GetMap()->GetPlayer(playerGuid))
{
DoCast(player, SPELL_MANABONKED);
SendMailToPlayer(player);
}
else
me->AddObjectToRemoveList();
events.ScheduleEvent(EVENT_LAUGH_2, Seconds(8));
break;
case EVENT_LAUGH_2:
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH_NO_SHEATHE);
events.ScheduleEvent(EVENT_BLINK, 3s);
break;
case EVENT_BLINK:
DoCastSelf(SPELL_IMPROVED_BLINK);
events.ScheduleEvent(EVENT_DESPAWN, 4s);
break;
case EVENT_DESPAWN:
me->AddObjectToRemoveList();
break;
default:
break;
}
}
}
示例10: UpdateAI
//.........这里部分代码省略.........
events.ScheduleEvent(eJiKunEvents::EventTalonRake, 58 * TimeConstants::IN_MILLISECONDS);
break;
case eJiKunEvents::EventDownDraft:
m_DownDraft = true;
m_DownDraftDiff = 3000;
m_DownDraftDiffCancel = 10000;
me->CastSpell(me, eJiKunSpells::SpellDownDraft);
InformPlayers("Ji Kun uses her wings to create a massive [Down Draft]!");
events.ScheduleEvent(eJiKunEvents::EventDownDraft, 80 * TimeConstants::IN_MILLISECONDS);
break;
case eJiKunEvents::EventDownDraftDis:
m_DownDraft = false;
break;
case eJiKunEvents::EventFeedPool:
me->CastSpell(me, eJiKunSpells::SpellFeedYoung);
events.ScheduleEvent(eJiKunEvents::EventFeedPool, 38 * TimeConstants::IN_MILLISECONDS);
break;
// Eggs
case eJiKunEvents::EventYoungEgg:
{
m_Count++;
GameObject* beacon = NULL;
if (m_Count == 8)
m_Count = 0;
switch (m_Count)
{
case 0:
beacon = me->SummonGameObject(148937, l_PositionLowBottom.GetPositionX(), l_PositionLowBottom.GetPositionY(), l_PositionLowBottom.GetPositionZ(), l_PositionLowBottom.GetOrientation(), 0,0,0,0,0);
InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");
for (int i = 0; i < 7; i++)
{
me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionLowBottom.GetPositionX() + i, l_PositionLowBottom.GetPositionY() + i, l_PositionLowBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
}
break;
case 1:
beacon = me->SummonGameObject(148937, l_PositionTopBottom.GetPositionX(), l_PositionTopBottom.GetPositionY(), l_PositionTopBottom.GetPositionZ(), l_PositionTopBottom.GetOrientation(), 0, 0, 0, 0, 0);
InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");
for (int i = 0; i < 7; i++)
{
me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionTopBottom.GetPositionX() + i, l_PositionTopBottom.GetPositionY() + i, l_PositionTopBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
}
break;
case 2:
beacon = me->SummonGameObject(148937, l_PositionMidBottom.GetPositionX(), l_PositionMidBottom.GetPositionY(), l_PositionMidBottom.GetPositionZ(), l_PositionMidBottom.GetOrientation(), 0, 0, 0, 0, 0);
InformPlayers("Ji Kun spawn Hatchlings in the lower nests!");
for (int i = 0; i < 7; i++)
{
me->SummonCreature(CreatureYoungEggOfJiKun, l_PositionMidBottom.GetPositionX() + i, l_PositionMidBottom.GetPositionY() + i, l_PositionMidBottom.GetPositionZ(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN);
}
break;
case 3:
beacon = me->SummonGameObject(148937, l_PositionTopTop.GetPositionX(), l_PositionTopTop.GetPositionY(), l_PositionTopTop.GetPositionZ(), l_PositionTopTop.GetOrientation(), 0, 0, 0, 0, 0);
InformPlayers("Ji Kun spawn Hatchlings in the upper nests!");
示例11: SpawnGameObject
/// @todo this should be handled in map, maybe add a summon function in map
// There is no other way afaik...
void SpawnGameObject(uint32 entry, Position const& pos)
{
GameObject* go = new GameObject();
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
0, 0, 0, 0, 120, GO_STATE_READY))
{
delete go;
return;
}
instance->AddToMap(go);
}
示例12: UpdateAI
void UpdateAI(const uint32 uiDiff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2)
return;
if (uiTeleportTimer <= uiDiff)
{
me->InterruptNonMeleeSpells(false);
DoScriptText(SAY_TELEPORT, me);
me->GetMotionMaster()->MoveIdle();
DoCast(SPELL_TELEPORT);
uiTeleportTimer = urand(30000, 35000);
} else uiTeleportTimer -= uiDiff;
if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION))
{
if (uiCastArcaneExplosionTimer <= uiDiff)
{
bCanCast = false;
bCanGoBack = true;
DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
uiCastArcaneExplosionTimer = 2000;
}else uiCastArcaneExplosionTimer -= uiDiff;
}
if (bCanGoBack)
{
if (uiArcaneExplosionTimer <= uiDiff)
{
Position pPos;
me->getVictim()->GetPosition(&pPos);
me->NearTeleportTo(pPos.GetPositionX(), pPos.GetPositionY(), pPos.GetPositionZ(), pPos.GetOrientation());
me->GetMotionMaster()->MoveChase(me->getVictim(), 0, 0);
me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);
bCanCast = false;
bCanGoBack = false;
uiArcaneExplosionTimer = 9000;
} else uiArcaneExplosionTimer -= uiDiff;
}
if (!me->IsNonMeleeSpellCasted(false, true, true))
{
if (uiFrostBombTimer <= uiDiff)
{
DoCastVictim(SPELL_FROSTBOMB);
uiFrostBombTimer = urand(5000, 8000);
} else uiFrostBombTimer -= uiDiff;
if (uiTimeBombTimer <= uiDiff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(pUnit, SPELL_TIME_BOMB);
uiTimeBombTimer = urand(20000, 25000);
} else uiTimeBombTimer -= uiDiff;
}
DoMeleeAttackIfReady();
}
示例13: OnGossipSelect
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
case GOSSIP_ACTION_INFO_DEF+1:
player->CLOSE_GOSSIP_MENU();
CAST_AI(npc_sinclari_vh::npc_sinclariAI, (creature->AI()))->uiPhase = 1;
if (InstanceScript* instance = creature->GetInstanceScript())
instance->SetData(DATA_MAIN_EVENT_PHASE, SPECIAL);
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->SEND_GOSSIP_MENU(13854, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->NearTeleportTo(playerTeleportPosition.GetPositionX(), playerTeleportPosition.GetPositionY(), playerTeleportPosition.GetPositionZ(), playerTeleportPosition.GetOrientation(), true);
player->CLOSE_GOSSIP_MENU();
break;
}
return true;
}
示例14: UpdateCircularMovementPosition
void AreaTrigger::UpdateCircularMovementPosition(uint32 /*diff*/)
{
if (_circularMovementInfo->StartDelay > GetElapsedTimeForMovement())
return;
_circularMovementInfo->ElapsedTimeForMovement = GetElapsedTimeForMovement() - _circularMovementInfo->StartDelay;
Position pos = CalculateCircularMovementPosition();
GetMap()->AreaTriggerRelocation(this, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
#ifdef TRINITY_DEBUG
DebugVisualizePosition();
#endif
}
示例15: UpdateAI
void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
if (bIsWaitingToAppear)
{
me->StopMoving();
me->AttackStop();
if (uiIsWaitingToAppearTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
bIsWaitingToAppear = false;
} else uiIsWaitingToAppearTimer -= diff;
return;
}
if ((Phase == 1) ||(Phase == 3))
{
if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
{
for (uint8 n = 0; n < 3; ++n)
time[n] = 0;
me->GetMotionMaster()->Clear();
me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
DoCast(me, SPELL_TELESTRA_BACK);
me->SetVisible(true);
if (Phase == 1)
Phase = 2;
if (Phase == 3)
Phase = 4;
uiFireMagusGUID = 0;
uiFrostMagusGUID = 0;
uiArcaneMagusGUID = 0;
bIsWaitingToAppear = true;
uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS;
Talk(SAY_MERGE);
}
else
return;
}
if ((Phase == 0) && HealthBelowPct(50))
{
Phase = 1;
me->CastStop();
me->RemoveAllAuras();
me->SetVisible(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(SAY_SPLIT);
return;
}
if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
{
Phase = 3;
me->CastStop();
me->RemoveAllAuras();
me->SetVisible(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
Talk(SAY_SPLIT);
return;
}
if (uiCooldown)
{
if (uiCooldown <= diff)
uiCooldown = 0;
else
{
uiCooldown -= diff;
return;
}
}
if (uiIceNovaTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
DoCast(target, SPELL_ICE_NOVA, false);
uiCooldown = 1500;
}
uiIceNovaTimer = 15*IN_MILLISECONDS;
} else uiIceNovaTimer -= diff;
if (uiGravityWellTimer <= diff)
{
//.........这里部分代码省略.........