本文整理汇总了C++中MovementInform函数的典型用法代码示例。如果您正苦于以下问题:C++ MovementInform函数的具体用法?C++ MovementInform怎么用?C++ MovementInform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MovementInform函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Finalize
void PointMovementGenerator<T>:: Finalize(T &unit)
{
unit.ClearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
if (unit.movespline->Finalized())
MovementInform(unit);
}
开发者ID:Snoop3r,项目名称:SkyFireEMU,代码行数:7,代码来源:PointMovementGenerator.cpp
示例2: MovementInform
void WaypointMovementGenerator<Creature>::OnArrived(Creature* owner)
{
if (!owner)
return;
if (!i_path || i_path->empty())
return;
if (m_isArrivalDone)
return;
owner->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
m_isArrivalDone = true;
if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
{
sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, owner->GetGUID());
owner->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, owner, NULL);
}
// Inform script
MovementInform(owner);
owner->UpdateWaypointID(i_currentNode);
Stop(i_path->at(i_currentNode)->delay);
}
开发者ID:concept45,项目名称:Core,代码行数:25,代码来源:WaypointMovementGenerator.cpp
示例3: Finalize
void PointMovementGenerator<T>:: Finalize(T &unit)
{
if (unit.hasUnitState(UNIT_STAT_CHARGING))
unit.clearUnitState(UNIT_STAT_CHARGING | UNIT_STAT_JUMPING);
if (arrived) // without this crash!
MovementInform(unit);
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:7,代码来源:PointMovementGenerator.cpp
示例4: Stop
void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
{
if (!i_path || i_path->nodes.empty())
return;
WaypointNode const &waypoint = i_path->nodes.at(i_currentNode);
if (waypoint.delay)
{
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
Stop(waypoint.delay);
}
if (waypoint.eventId && urand(0, 99) < waypoint.eventChance)
{
TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for %s.", waypoint.eventId, i_currentNode, creature->GetGUID().ToString().c_str());
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
creature->GetMap()->ScriptsStart(sWaypointScripts, waypoint.eventId, creature, nullptr);
}
// Inform script
MovementInform(creature);
creature->UpdateWaypointID(i_currentNode);
creature->SetWalk(waypoint.moveType != WAYPOINT_MOVE_TYPE_RUN);
}
开发者ID:090809,项目名称:TrinityCore,代码行数:25,代码来源:WaypointMovementGenerator.cpp
示例5: MovementInform
void EffectMovementGenerator::Finalize(Unit* owner)
{
if (!owner)
return;
MovementInform(owner);
}
开发者ID:Expery,项目名称:Core,代码行数:7,代码来源:PointMovementGenerator.cpp
示例6: TC_LOG_DEBUG
void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
{
if (!i_path || i_path->empty())
return;
if (m_isArrivalDone)
return;
m_isArrivalDone = true;
if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
{
TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID());
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL);
}
// Inform script
MovementInform(creature);
creature->UpdateWaypointID(i_currentNode);
if (i_path->at(i_currentNode)->delay)
{
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
Stop(i_path->at(i_currentNode)->delay);
}
}
开发者ID:siknd,项目名称:TrinityCore,代码行数:26,代码来源:WaypointMovementGenerator.cpp
示例7: MovementInform
void PointMovementGenerator<T>::Finalize(T& unit)
{
unit.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE);
if (i_destinationHolder.HasArrived())
MovementInform(unit);
}
开发者ID:mynew4,项目名称:MaNGOSZero,代码行数:7,代码来源:PointMovementGenerator.cpp
示例8: defined
void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature)
{
if (!i_path || i_path->empty())
return;
if (m_isArrivalDone)
return;
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
m_isArrivalDone = true;
if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID());
#endif
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL);
}
// Inform script
MovementInform(creature);
creature->UpdateWaypointID(i_currentNode);
if (i_path->at(i_currentNode)->delay)
{
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
Stop(i_path->at(i_currentNode)->delay);
}
}
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:29,代码来源:WaypointMovementGenerator.cpp
示例9: traveller
bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
if(!&unit)
return false;
if(unit.hasUnitState(UNIT_STAT_CAN_NOT_MOVE))
{
unit.clearUnitState(UNIT_STAT_ROAMING_MOVE);
return true;
}
unit.addUnitState(UNIT_STAT_ROAMING_MOVE);
Traveller<T> traveller(unit);
if (i_destinationHolder.UpdateTraveller(traveller, diff, false))
{
if (!IsActive(unit)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
}
if(i_destinationHolder.HasArrived())
{
unit.clearUnitState(UNIT_STAT_ROAMING_MOVE);
MovementInform(unit);
return false;
}
return true;
}
开发者ID:Dreinar,项目名称:mangos,代码行数:29,代码来源:PointMovementGenerator.cpp
示例10: BLIZZLIKE_ASSERT
void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
{
if (!i_path || i_path->empty())
return;
m_lastReachedWaypoint = i_currentNode;
if (m_isArrivalDone)
return;
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
m_isArrivalDone = true;
WaypointPath::const_iterator currPoint = i_path->find(i_currentNode);
BLIZZLIKE_ASSERT(currPoint != i_path->end());
WaypointNode const& node = currPoint->second;
if (node.script_id)
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature movement start script %u at point %u for %s.", node.script_id, i_currentNode, creature.GetGuidStr().c_str());
creature.GetMap()->ScriptsStart(sCreatureMovementScripts, node.script_id, &creature, &creature);
}
// We have reached the destination and can process behavior
if (WaypointBehavior* behavior = node.behavior)
{
if (behavior->emote != 0)
creature.HandleEmote(behavior->emote);
if (behavior->spell != 0)
creature.CastSpell(&creature, behavior->spell, false);
if (behavior->model1 != 0)
creature.SetDisplayId(behavior->model1);
if (behavior->textid[0])
{
// Not only one text is set
if (behavior->textid[1])
{
// Select one from max 5 texts (0 and 1 already checked)
int i = 2;
for (; i < MAX_WAYPOINT_TEXT; ++i)
{
if (!behavior->textid[i])
break;
}
creature.MonsterSay(behavior->textid[rand() % i], LANG_UNIVERSAL);
}
else
creature.MonsterSay(behavior->textid[0], LANG_UNIVERSAL);
}
}
// Inform script
MovementInform(creature);
Stop(node.delay);
}
开发者ID:SakhWoW,项目名称:blizzlikecore,代码行数:59,代码来源:WaypointMovementGenerator.cpp
示例11: MovementInform
void PointMovementGenerator<T>::DoFinalize(T* unit)
{
if (unit->HasUnitState(UNIT_STATE_CHARGING))
unit->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (unit->movespline->Finalized())
MovementInform(unit);
}
开发者ID:Carbenium,项目名称:TrinityCore,代码行数:8,代码来源:PointMovementGenerator.cpp
示例12: Finalize
void PointMovementGenerator<T>:: Finalize(T& unit)
{
if (unit.HasUnitState(UNIT_STATE_CHARGING))
unit.ClearUnitState(UNIT_STATE_CHARGING | UNIT_STATE_JUMPING);
if (unit.movespline->Finalized())
MovementInform(unit);
}
开发者ID:Leandros,项目名称:OregonCore,代码行数:8,代码来源:PointMovementGenerator.cpp
示例13: MovementInform
void PointMovementGenerator<T>::DoFinalize(T* owner, bool active, bool movementInform)
{
MovementGenerator::AddFlag(MOVEMENTGENERATOR_FLAG_FINALIZED);
if (active)
owner->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
if (movementInform && MovementGenerator::HasFlag(MOVEMENTGENERATOR_FLAG_INFORM_ENABLED))
MovementInform(owner);
}
开发者ID:lasyan3,项目名称:TrinityCore,代码行数:9,代码来源:PointMovementGenerator.cpp
示例14: MovementInform
void PointMovementGenerator<T>::Finalize(T& unit)
{
unit.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE);
if (unit.GetTypeId() == TYPEID_UNIT)
unit.UpdateSpeed(MOVE_RUN, true);
if (unit.movespline->Finalized())
MovementInform(unit);
}
开发者ID:ShyoZarak,项目名称:mangos-classic,代码行数:9,代码来源:PointMovementGenerator.cpp
示例15: Reset
void Reset()
{
nextMovementTimer = 0;
actualAngle = me->GetAngle(CenterPos.GetPositionX(), CenterPos.GetPositionY());
direction = urand(0, 1);
if (direction)
myPositionZ = 435.0f;
else
myPositionZ = 440.0f;
// Enable Movements
MovementInform(POINT_MOTION_TYPE, POINT_KRIKTHIK_CIRCLE);
me->setActive(true);
}
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:16,代码来源:boss_striker_gadok.cpp
示例16: MovementInform
void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
{
if (!i_path || i_path->empty())
return;
if (m_isArrivalDone)
return;
creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE);
m_isArrivalDone = true;
if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)
{
sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for %u.", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID());
creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL/*, false*/);
}
// Inform script
MovementInform(creature);
Stop(i_path->at(i_currentNode)->delay);
}
开发者ID:Shutok,项目名称:HeavensGate,代码行数:20,代码来源:WaypointMovementGenerator.cpp
示例17: traveller
bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
{
if(!&unit)
return false;
if(unit.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNDED))
return true;
Traveller<T> traveller(unit);
i_destinationHolder.UpdateTraveller(traveller, diff, false);
if(i_destinationHolder.HasArrived())
{
unit.StopMoving();
MovementInform(unit);
return false;
}
return true;
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:21,代码来源:PointMovementGenerator.cpp
示例18: traveller
//.........这里部分代码省略.........
float x,y,z;
i_target->GetPosition(x, y, z);
PathNode next_point(x, y, z);
bool targetMoved = false, needNewDest = false;
bool forceRecalc = i_recalculateTravel || owner.IsStopped();
if (i_path && !forceRecalc)
{
PathNode end_point = i_path->getEndPosition();
next_point = i_path->getNextPosition();
//More distance let have better performance, less distance let have more sensitive reaction at target move.
float dist = owner.GetCombatReach() + sWorld.getRate(RATE_TARGET_POS_RECALCULATION_RANGE);
needNewDest = i_destinationHolder.HasArrived() && (!i_path->inRange(next_point, i_path->getActualEndPosition(), dist, dist) || !owner.IsWithinLOSInMap(i_target.getTarget()));
if(!needNewDest)
{
// GetClosePoint() will always return a point on the ground, so we need to
// handle the difference in elevation when the creature is flying
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly())
targetMoved = i_target->GetDistanceSqr(end_point.x, end_point.y, end_point.z) > dist*dist;
else
targetMoved = i_target->GetDistance2d(end_point.x, end_point.y) > dist;
}
}
// target moved
if (!i_path || targetMoved || needNewDest || forceRecalc)
{
// (re)calculate path
_setTargetLocation(owner);
next_point = i_path->getNextPosition();
// Set new Angle For Map::
owner.SetOrientation(owner.GetAngle(next_point.x, next_point.y));
}
// Update the Angle of the target only for Map::, no need to send packet for player
else if (!i_angle && !owner.HasInArc(0.01f, next_point.x, next_point.y))
owner.SetOrientation(owner.GetAngle(next_point.x, next_point.y));
if ((owner.IsStopped() && !i_destinationHolder.HasArrived()) || i_recalculateTravel)
{
i_recalculateTravel = false;
//Angle update will take place into owner.StopMoving()
owner.SetInFront(i_target.getTarget());
owner.StopMoving();
if(owner.IsWithinMeleeRange(i_target.getTarget()) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
owner.Attack(i_target.getTarget(), true);
}
}
}
else
{
Traveller<T> traveller(owner);
if (!i_destinationHolder.HasDestination())
{
_setTargetLocation(owner);
}
else if (owner.IsStopped() && !i_destinationHolder.HasArrived())
{
owner.addUnitState(UNIT_STAT_CHASE);
i_destinationHolder.StartTravel(traveller);
return true;
}
if (i_destinationHolder.UpdateTraveller(traveller, time_diff))
{
// target moved
if (i_targetX != i_target->GetPositionX() || i_targetY != i_target->GetPositionY()
|| i_targetZ != i_target->GetPositionZ())
{
if(_setTargetLocation(owner) || !owner.hasUnitState(UNIT_STAT_FOLLOW))
owner.SetInFront(i_target.getTarget());
i_target->GetPosition(i_targetX, i_targetY, i_targetZ);
}
if ((owner.IsStopped() && !i_destinationHolder.HasArrived()) || i_recalculateTravel)
{
i_recalculateTravel = false;
//Angle update will take place into owner.StopMoving()
owner.SetInFront(i_target.getTarget());
owner.StopMoving();
if(owner.IsWithinMeleeRange(i_target.getTarget()) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
owner.Attack(i_target.getTarget(),true);
}
}
}
// Implemented for PetAI to handle resetting flags when pet owner reached
if (i_destinationHolder.HasArrived())
MovementInform(owner);
return true;
}
开发者ID:romseguy,项目名称:Trinitycore_Azshara_2.4.3,代码行数:101,代码来源:TargetedMovementGenerator.cpp
示例19: traveller
bool
WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff)
{
if (!&unit)
return true;
if (!path_id)
return false;
// Waypoint movement can be switched on/off
// This is quite handy for escort quests and other stuff
if (unit.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
return true;
// Clear the generator if the path doesn't exist
if (!waypoints || !waypoints->size())
return false;
Traveller<Creature> traveller(unit);
i_nextMoveTime.Update(diff);
i_destinationHolder.UpdateTraveller(traveller, diff, true);
if (i_nextMoveTime.GetExpiry() < TIMEDIFF_NEXT_WP)
{
if (unit.IsStopped())
{
if (StopedByPlayer)
{
ASSERT(node);
InitTraveller(unit, *node);
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
StopedByPlayer = false;
return true;
}
if (i_currentNode == waypoints->size() - 1) // If that's our last waypoint
{
if (repeating) // If the movement is repeating
i_currentNode = 0; // Start moving all over again
else
{
unit.SetHomePosition(node->x, node->y, node->z, unit.GetOrientation());
unit.GetMotionMaster()->Initialize();
return false; // Clear the waypoint movement
}
}
else
++i_currentNode;
node = waypoints->at(i_currentNode);
InitTraveller(unit, *node);
i_destinationHolder.SetDestination(traveller, node->x, node->y, node->z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
//Call for creature group update
if (unit.GetFormation() && unit.GetFormation()->getLeader() == &unit)
unit.GetFormation()->LeaderMoveTo(node->x, node->y, node->z);
}
else
{
//Determine waittime
if (node->delay)
i_nextMoveTime.Reset(node->delay);
//note: disable "start" for mtmap
if (node->event_id && urand(0,99) < node->event_chance)
unit.GetMap()->ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL/*, false*/);
i_destinationHolder.ResetTravelTime();
MovementInform(unit);
unit.UpdateWaypointID(i_currentNode);
unit.ClearUnitState(UNIT_STAT_ROAMING);
unit.Relocate(node->x, node->y, node->z);
}
}
else
{
if (unit.IsStopped() && !i_destinationHolder.HasArrived())
{
if (!StopedByPlayer)
{
i_destinationHolder.IncreaseTravelTime(STOP_TIME_FOR_PLAYER);
i_nextMoveTime.Reset(STOP_TIME_FOR_PLAYER);
StopedByPlayer = true;
}
}
}
return true;
}
开发者ID:CamelPown,项目名称:TrueBl0OD,代码行数:91,代码来源:WaypointMovementGenerator.cpp
示例20: currentNode
//.........这里部分代码省略.........
if (behavior->spell != 0)
{
creature.CastSpell(&creature, behavior->spell, false);
if (!IsActive(creature)) // force stop processing (cast can change movegens list)
return true; // not expire now, but already lost
}
if (behavior->model1 != 0)
creature.SetDisplayId(behavior->model1);
if (behavior->textid[0])
{
// Not only one text is set
if (behavior->textid[1])
{
// Select one from max 5 texts (0 and 1 already checked)
int i = 2;
for(; i < MAX_WAYPOINT_TEXT; ++i)
{
if (!behavior->textid[i])
break;
}
creature.Say(behavior->textid[rand() % i], 0, 0);
}
else
creature.Say(behavior->textid[0], 0, 0);
}
} // wpBehaviour found
// Can only do this once for the node
m_isArrivalDone = true;
// Inform script
MovementInform(creature);
if (!IsActive(creature)) // force stop processing (movement can move out active zone with cleanup movegens list)
return true; // not expire now, but already lost
// prevent a crash at empty waypoint path.
if (!i_path || i_path->empty() || i_currentNode >= i_path->size())
{
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
return true;
}
}
} // i_creature.IsStopped()
// This is at the end of waypoint segment (incl. was previously stopped by player, extending the time)
if (i_nextMoveTime.Passed())
{
// If stopped then begin a new move segment
if (creature.IsStopped())
{
creature.addUnitState(UNIT_STAT_ROAMING_MOVE);
if (creature.canFly())
creature.AddSplineFlag(SPLINEFLAG_UNKNOWN7);
if (WaypointBehavior *behavior = i_path->at(i_currentNode).behavior)
{
if (behavior->model2 != 0)
creature.SetDisplayId(behavior->model2);
creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
}
// behavior for "departure" of the current node is done
m_isArrivalDone = false;
// Proceed with increment current node and then send to the next destination
++i_currentNode;
// Oops, end of the line so need to start from the beginning
if (i_currentNode >= i_path->size())
i_currentNode = 0;
if (i_path->at(i_currentNode).orientation != 100)
creature.SetOrientation(i_path->at(i_currentNode).orientation);
const WaypointNode &node = i_path->at(i_currentNode);
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
}
else
{
// If not stopped then stop it
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
SetStoppedByPlayer(false);
// Set TimeTracker to waittime for the current node
i_nextMoveTime.Reset(i_path->at(i_currentNode).delay);
}
}
return true;
}
开发者ID:Adalinator,项目名称:mangos,代码行数:101,代码来源:WaypointMovementGenerator.cpp
注:本文中的MovementInform函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论