本文整理汇总了C++中UnitObj::GetFootInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitObj::GetFootInstance方法的具体用法?C++ UnitObj::GetFootInstance怎么用?C++ UnitObj::GetFootInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitObj
的用法示例。
在下文中一共展示了UnitObj::GetFootInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderRallyPoint
//
// RenderRallyPoint
//
// Display a rally point
//
static void RenderRallyPoint()
{
Point<S32> srcPoint(0, 0);
Point<U32> dstPoint(0, 0);
Matrix src, dst;
// Get the single selected unit
UnitObj *unit = data.cInfo.oneUnit.GetPointer();
// Is there a rally point
if (unit && unit->GetFootInstance() && unit->GetRallyPoint(dstPoint))
{
// Setup destination
dst.ClearData();
dst.posit.x = WorldCtrl::CellToMetresX(dstPoint.x);
dst.posit.z = WorldCtrl::CellToMetresZ(dstPoint.z);
dst.posit.y = TerrainData::FindFloorWithWater(dst.posit.x, dst.posit.z);
// Find the source
srcPoint.Set(S32(dstPoint.x), S32(dstPoint.z));
unit->GetFootInstance()->ClampToFringe(srcPoint);
src.ClearData();
src.posit.x = WorldCtrl::CellToMetresX(srcPoint.x);
src.posit.z = WorldCtrl::CellToMetresZ(srcPoint.z);
src.posit.y = TerrainData::FindFloorWithWater(src.posit.x, src.posit.z);
}
else
{
// Act as if not selected
unit = NULL;
}
if
(
// Rally unit has been deselected
(!unit && rallyUnitId)
||
(
// Have a rally point unit
unit
&&
(
// Different to last one
(unit->Id() != rallyUnitId)
||
// Rally point location has changed
(rallyUnitId && (dstPoint != rallyPoint))
)
)
)
{
// Dispose of any current particle
if (rallyParticle.Alive())
{
delete rallyParticle;
}
// Is there a unit selected
if (unit)
{
// Never display a trail when same point
if ((srcPoint.x != S32(dstPoint.x)) || (srcPoint.z != S32(dstPoint.z)))
{
// Create the runner particle
if (ParticleClass *p = ParticleSystem::FindType(0x94E362BD)) // "Client::Rally"
{
Matrix m(src);
m.posit.y += 3.0F;
Vector v(0.0f, 0.0f, 0.0f);
rallyParticle = ParticleSystem::New(p, m, v, v, dst.posit - src.posit, 0.0F);
}
}
// Remember this unit's info
rallyUnitId = unit->Id();
rallyPoint = dstPoint;
}
else
{
rallyUnitId = 0;
}
}
// Render the start and end points
if (unit)
{
Common::Display::Mesh(0x693D5359, src, Color(0.0F, 0.8F, 0.0F, 0.7F)); // "Location"
Common::Display::Mesh(0x693D5359, dst, Color(0.0F, 1.0F, 0.0F, 0.7F)); // "Location"
}
//.........这里部分代码省略.........