本文整理汇总了C++中Mutate函数的典型用法代码示例。如果您正苦于以下问题:C++ Mutate函数的具体用法?C++ Mutate怎么用?C++ Mutate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Mutate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{
//this function may make players fall below map
if (_owner->GetTypeId() == TYPEID_PLAYER)
return;
float x, y, z;
float moveTimeHalf = speedZ / Movement::gravity;
float dist = 2 * moveTimeHalf * speedXY;
float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
_owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI);
Movement::MoveSplineInit init(*_owner);
init.MoveTo(x, y, z);
init.SetParabolic(max_height, 0);
init.SetOrientationFixed(true);
init.SetVelocity(speedXY);
init.Launch();
Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED);
}
开发者ID:AtVirus,项目名称:SkyFireEMU,代码行数:21,代码来源:MotionMaster.cpp
示例2: init
void MotionMaster::MoveFall(uint32 id/*=0*/)
{
// use larger distance for vmap height search than in most other cases
float tz = _owner->GetMap()->GetHeight(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
return;
}
// Abort too if the ground is very near
if (fabs(_owner->GetPositionZ() - tz) < 0.1f)
return;
Movement::MoveSplineInit init(*_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(),tz);
init.SetFall();
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
开发者ID:Facelive,项目名称:ArkCORE2,代码行数:21,代码来源:MotionMaster.cpp
示例3: init
void MotionMaster::MoveFall()
{
// use larger distance for vmap height search than in most other cases
float tz = m_owner->GetMap()->GetHeight(m_owner->GetPhaseMask(), m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
sLog.outError("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
m_owner->GetMap()->GetId(), m_owner->GetPositionX(), m_owner->GetPositionY(), m_owner->GetPositionZ());
return;
}
// Abort too if the ground is very near
if (fabs(m_owner->GetPositionZ() - tz) < 0.1f)
return;
Movement::MoveSplineInit init(*m_owner);
init.MoveTo(m_owner->GetPositionX(),m_owner->GetPositionY(),tz);
init.SetFall();
init.Launch();
Mutate(new EffectMovementGenerator(0), UNIT_ACTION_EFFECT);
}
开发者ID:alolo,项目名称:mangos,代码行数:21,代码来源:MotionMaster.cpp
示例4: FlightPathMovementGenerator
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
if (path < sTaxiPathNodesByPath.size())
{
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode);
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
else
{
TC_LOG_ERROR("misc", "%s attempt taxi to (not existed Path %u node %u)",
_owner->GetName().c_str(), path, pathnode);
}
}
else
{
TC_LOG_ERROR("misc", "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
}
}
开发者ID:Exodius,项目名称:chuspi,代码行数:21,代码来源:MotionMaster.cpp
示例5: DEBUG_FILTER_LOG
void MotionMaster::MoveTargetedHome()
{
// if (m_owner->hasUnitState(UNIT_STAT_LOST_CONTROL))
// return;
if (m_owner->GetTypeId() == TYPEID_UNIT && !((Creature*)m_owner)->GetCharmerOrOwnerGuid())
{
// Manual exception for linked mobs
if (m_owner->IsLinkingEventTrigger() && m_owner->GetMap()->GetCreatureLinkingHolder()->TryFollowMaster((Creature*)m_owner))
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "MotionMaster: %s refollowed linked master", m_owner->GetGuidStr().c_str());
else
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "MotionMaster: %s targeted home", m_owner->GetGuidStr().c_str());
Mutate(new HomeMovementGenerator<Creature>(), UNIT_ACTION_HOME);
}
}
else if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGuid())
{
if (Unit* target = ((Creature*)m_owner)->GetCharmerOrOwner())
{
float angle = ((Creature*)m_owner)->IsPet() ? ((Pet*)m_owner)->GetPetFollowAngle() : PET_FOLLOW_ANGLE;
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "MotionMaster: %s follow to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str());
switch (((Creature*)m_owner)->GetCharmState(CHARM_STATE_COMMAND))
{
case COMMAND_STAY:
MoveIdle();
break;
case COMMAND_FOLLOW:
case COMMAND_ATTACK:
default:
MoveFollow(target, PET_FOLLOW_DIST, angle);
break;
}
}
else
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s attempt but fail to follow owner", m_owner->GetGuidStr().c_str());
}
else
sLog.outError("MotionMaster: %s attempt targeted home", m_owner->GetGuidStr().c_str());
}
开发者ID:Sar777,项目名称:mangos3,代码行数:40,代码来源:MotionMaster.cpp
示例6: DEBUG_FILTER_LOG
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if (m_owner->GetTypeId() == TYPEID_PLAYER)
{
if (path < sTaxiPathNodesByPath.size())
{
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s taxi to (Path %u node %u)", m_owner->GetGuidStr().c_str(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode);
Mutate(mgen);
}
else
{
sLog.outError("%s attempt taxi to (nonexistent Path %u node %u)",
m_owner->GetGuidStr().c_str(), path, pathnode);
}
}
else
{
sLog.outError("%s attempt taxi to (Path %u node %u)",
m_owner->GetGuidStr().c_str(), path, pathnode);
}
}
开发者ID:mathman,项目名称:mangos-tbc,代码行数:22,代码来源:MotionMaster.cpp
示例7: top
void MotionMaster::MovePath(uint32 path_id, bool repeatable)
{
if (!path_id)
return;
//We set waypoint movement as new default movement generator
// clear ALL movement generators (including default)
/*while (!empty())
{
MovementGenerator *curr = top();
curr->Finalize(*_owner);
pop();
if (!isStatic(curr))
delete curr;
}*/
//_owner->GetTypeId() == TYPEID_PLAYER ?
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
TC_LOG_DEBUG("misc", "%s start moving over path (Id:%u, repeatable: %s)",
_owner->GetGUID().ToString().c_str(), path_id, repeatable ? "YES" : "NO");
}
开发者ID:alex1kiss,项目名称:LegacyCore_6.x.x,代码行数:22,代码来源:MotionMaster.cpp
示例8: to
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if(i_owner->GetTypeId() == TYPEID_PLAYER)
{
if(path < sTaxiPathNodesByPath.size())
{
sLog->outStaticDebug("%s taxi to (Path %u node %u)", i_owner->GetName(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode);
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
else
{
sLog->outError("%s attempt taxi to (not existed Path %u node %u)",
i_owner->GetName(), path, pathnode);
}
}
else
{
sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode);
}
}
开发者ID:Darkelmo,项目名称:MythCore,代码行数:22,代码来源:MotionMaster.cpp
示例9: MoveWaypoint
void MotionMaster::MoveWaypoint(int32 id /*=0*/, uint32 source /*=0==PATH_NO_PATH*/, uint32 initialDelay /*=0*/, uint32 overwriteEntry /*=0*/)
{
if (m_owner->GetTypeId() == TYPEID_UNIT)
{
if (GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
sLog.outError("%s attempt to MoveWaypoint() but is already using waypoint", m_owner->GetGuidStr().c_str());
return;
}
Creature* creature = (Creature*)m_owner;
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s start MoveWaypoint()", m_owner->GetGuidStr().c_str());
WaypointMovementGenerator<Creature>* newWPMMgen = new WaypointMovementGenerator<Creature>(*creature);
Mutate(newWPMMgen);
newWPMMgen->InitializeWaypointPath(*creature, id, (WaypointPathOrigin)source, initialDelay, overwriteEntry);
}
else
{
sLog.outError("Non-creature %s attempt to MoveWaypoint()", m_owner->GetGuidStr().c_str());
}
}
开发者ID:HerrTrigger,项目名称:mangos-wotlk,代码行数:22,代码来源:MotionMaster.cpp
示例10: Mutate
int CONTROLLER::Mutate_Biased(double mutationProbability) {
int mutationOccurred = false;
for (int i=0; i<numTimeSteps; i++) {
for (int j=0; j<numMotorGroups; j++) {
if ( Rand(0,1) < mutationProbability ) {
Mutate(i,j);
mutationOccurred = true;
}
}
}
motors->Print();
printf("\n");
return( mutationOccurred );
}
开发者ID:jbongard,项目名称:cords,代码行数:22,代码来源:controller.cpp
示例11: Crossover
//! Reproduce candidates to create the next generation.
void CNE::Reproduce()
{
// Sort fitness values. Smaller fitness value means better performance.
index = arma::sort_index(fitnessValues);
// First parent.
size_t mom;
// Second parent.
size_t dad;
for (size_t i = numElite; i < populationSize - 1; i++)
{
// Select 2 different parents from elite group randomly [0, numElite).
mom = mlpack::math::RandInt(0, numElite);
dad = mlpack::math::RandInt(0, numElite);
// Making sure both parents are not the same.
if (mom == dad)
{
if (dad != numElite - 1)
{
dad++;
}
else
{
dad--;
}
}
// Parents generate 2 children replacing the dropped-out candidates.
// Also finding the index of these candidates in the population matrix.
Crossover(index[mom], index[dad], index[i], index[i + 1]);
}
// Mutating the weights with small noise values.
// This is done to bring change in the next generation.
Mutate();
}
开发者ID:sbrodehl,项目名称:mlpack,代码行数:40,代码来源:cne_impl.hpp
示例12: point
void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id)
{
sLog->outDebug(LOG_FILTER_GENERAL, "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
if (speedXY <= 0.1f)
return;
float moveTimeHalf = speedZ / Movement::gravity;
float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ);
int32 timerToDestination = 0;
Movement::MoveSplineInit init(_owner);
init.MoveTo(x, y, z, false);
init.SetParabolic(max_height, 0);
init.SetVelocity(speedXY);
timerToDestination = init.Launch();
if (_owner->ToPlayer())
_owner->ToPlayer()->SetJumpTimerDestination(timerToDestination + 100);
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
开发者ID:Jildor,项目名称:4.3.4-Core,代码行数:23,代码来源:MotionMaster.cpp
示例13: DEBUG_LOG
void
MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
{
if(path < sTaxiPathNodesByPath.size())
{
DEBUG_LOG("Player (GUID: %u) taxi to (Path %u node %u)", i_owner->GetGUIDLow(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path],pathnode);
Mutate(mgen);
}
else
{
sLog.outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode );
}
}
else
{
sLog.outError("%u attempt taxi to (Path %u node %u)",
i_owner->GetGUIDLow(), path, pathnode );
}
}
开发者ID:AwkwardDev,项目名称:MangosFX,代码行数:23,代码来源:MotionMaster.cpp
示例14: DEBUG_LOG
void
MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
{
if(path < sTaxiPathNodesByPath.size())
{
DEBUG_LOG("%s taxi to (Path %u node %u)", i_owner->GetObjectGuid().GetString().c_str(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path],pathnode);
Mutate(mgen);
}
else
{
sLog.outError("%s attempt taxi to (not existed Path %u node %u)",
i_owner->GetObjectGuid().GetString().c_str(), path, pathnode );
}
}
else
{
sLog.outError("%s attempt taxi to (Path %u node %u)",
i_owner->GetObjectGuid().GetString().c_str(), path, pathnode );
}
}
开发者ID:Bootz,项目名称:diamondcore,代码行数:23,代码来源:MotionMaster.cpp
示例15: TC_LOG_DEBUG
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
if (path < sTaxiPathNodesByPath.size())
{
TC_LOG_DEBUG("misc", "%s taxi to (Path %u node %u).", _owner->GetName().c_str(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(pathnode);
mgen->LoadPath(_owner->ToPlayer());
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
else
{
TC_LOG_ERROR("misc", "%s attempted taxi to (non-existing Path %u node %u).",
_owner->GetName().c_str(), path, pathnode);
}
}
else
{
TC_LOG_ERROR("misc", "Creature (Entry: %u GUID: %u) attempted taxi to (Path %u node %u).",
_owner->GetEntry(), _owner->GetGUID().GetCounter(), path, pathnode);
}
}
开发者ID:martial69320,项目名称:cerberus,代码行数:23,代码来源:MotionMaster.cpp
示例16: top
void MotionMaster::MovePath(uint32 path_id, bool repeatable)
{
if (!path_id)
return;
//We set waypoint movement as new default movement generator
// clear ALL movement generators (including default)
/*while (!empty())
{
MovementGenerator *curr = top();
curr->Finalize(*i_owner);
pop();
if (!isStatic(curr))
delete curr;
}*/
//i_owner->GetTypeId() == TYPEID_PLAYER ?
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
}
开发者ID:Bluedead,项目名称:SkyFireEMU,代码行数:23,代码来源:MotionMaster.cpp
示例17: TC_LOG_DEBUG
void MotionMaster::MoveFall(uint32 id/*=0*/)
{
// use larger distance for vmap height search than in most other cases
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);;
// try to find ground Z
if (tz <= INVALID_HEIGHT)
tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), MAX_HEIGHT, true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
TC_LOG_DEBUG("misc", "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
return;
}
// Abort too if the ground is very near
if (fabs(_owner->GetPositionZ() - tz) < 0.1f)
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
_owner->m_movementInfo.SetFallTime(0);
}
Position pos = _owner->GetPosition();
pos.m_positionZ = tz;
_owner->GetFirstCollisionPosition(pos, fabs(_owner->GetPositionZ() - tz), 0);
tz = pos.GetPositionZ();
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz);
init.SetFall();
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
开发者ID:Exodius,项目名称:chuspi,代码行数:37,代码来源:MotionMaster.cpp
示例18: float
void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount)
{
float step = 2 * float(M_PI) / stepCount * (clockwise ? -1.0f : 1.0f);
Position const& pos = { x, y, z, 0.0f };
float angle = pos.GetAbsoluteAngle(_owner->GetPositionX(), _owner->GetPositionY());
Movement::MoveSplineInit init(_owner);
for (uint8 i = 0; i < stepCount; angle += step, ++i)
{
G3D::Vector3 point;
point.x = x + radius * cosf(angle);
point.y = y + radius * sinf(angle);
if (_owner->IsFlying())
point.z = z;
else
point.z = _owner->GetMapHeight(point.x, point.y, z) + _owner->GetHoverOffset();
init.Path().push_back(point);
}
if (_owner->IsFlying())
{
init.SetFly();
init.SetCyclic();
init.SetAnimation(Movement::ToFly);
}
else
{
init.SetWalk(true);
init.SetCyclic();
}
Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, 0), MOTION_SLOT_ACTIVE);
}
开发者ID:m-uu,项目名称:ElunaTrinityWotlk,代码行数:36,代码来源:MotionMaster.cpp
示例19: TC_LOG_DEBUG
void MotionMaster::MoveFall(uint32 id /*=0*/)
{
// use larger distance for vmap height search than in most other cases
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
TC_LOG_DEBUG("misc", "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ());
return;
}
// Abort too if the ground is very near
if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
_owner->SetFall(true);
Movement::MoveSplineInit init(_owner);
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz, false);
init.SetFall();
init.Launch();
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
开发者ID:alex1kiss,项目名称:LegacyCore_6.x.x,代码行数:24,代码来源:MotionMaster.cpp
示例20: ReadHeader
void MP4ContentIdDescriptor::Read(MP4File* pFile)
{
ReadHeader(pFile);
/* read the first property, 'compatiblity' */
ReadProperties(pFile, 0, 1);
/* if compatiblity != 0 */
if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) {
/* we don't understand it */
VERBOSE_READ(pFile->GetVerbosity(),
printf("incompatible content id descriptor\n"));
return;
}
/* read the next four properties */
ReadProperties(pFile, 1, 4);
/* which allows us to reconfigure ourselves */
Mutate();
/* read the remaining properties */
ReadProperties(pFile, 5);
}
开发者ID:hellowangh,项目名称:avs-transcoder,代码行数:24,代码来源:descriptors.cpp
注:本文中的Mutate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论