本文整理汇总了C++中Track::GetRelation方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetRelation方法的具体用法?C++ Track::GetRelation怎么用?C++ Track::GetRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetRelation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
Sensor::ThreatLevel::Value Sensor::IdentifyThreat(const Track& track) const
{
assert(player);
if (!UseThreatAssessment())
return ThreatLevel::None;
if (track.IsExploding())
return ThreatLevel::None;
if (track.HasWeaponLock())
{
// I am being targetted by...
switch (track.GetType())
{
case Track::Type::Missile:
return ThreatLevel::High;
case Track::Type::CapitalShip:
if (track.GetRelation() == Track::Relation::Enemy)
return ThreatLevel::Medium;
break;
case Track::Type::Ship:
if (track.HasTurrets())
return ThreatLevel::Medium;
if (!track.HasWeapons())
{
// So what are you going to threaten me with? Exhaustion gas?
return ThreatLevel::None;
}
break;
default:
break;
}
return ThreatLevel::Low;
}
return ThreatLevel::None;
}
示例2: GetColor
GFXColor Sensor::GetColor(const Track& track) const
{
assert(player);
static GFXColor friendColor = RetrColor("friend", GFXColor(-1, -1, -1, -1));
static GFXColor enemyColor = RetrColor("enemy", GFXColor(-1, -1, -1, -1));
static GFXColor neutralColor = RetrColor("neutral", GFXColor(-1, -1, -1, -1));
static GFXColor baseColor = RetrColor("base", GFXColor( -1, -1, -1, -1 ));
static GFXColor planetColor = RetrColor("planet", GFXColor( -1, -1, -1, -1 ));
static GFXColor jumpColor = RetrColor("jump", GFXColor( 0, 1, 1, .8 ));
static GFXColor navColor = RetrColor("nav", GFXColor( 1, 1, 1, 1 ));
static GFXColor starColor = RetrColor("star", GFXColor( 1, 1, 1, 1 ));
static GFXColor missileColor = RetrColor("missile", GFXColor( .25, 0, .5, 1 ));
static GFXColor cargoColor = RetrColor("cargo", GFXColor( .6, .2, 0, 1 ));
static GFXColor noColor = RetrColor("black_and_white", GFXColor( .5, .5, .5 ));
Track::Type::Value trackType = track.GetType();
ThreatLevel::Value threatLevel = IdentifyThreat(track);
if (UseThreatAssessment())
{
switch (trackType)
{
case Track::Type::Missile:
return missileColor;
default:
break;
}
}
if (UseObjectRecognition())
{
switch (trackType)
{
case Track::Type::Nebula:
case Track::Type::Star:
return starColor;
case Track::Type::Planet:
case Track::Type::DeadPlanet:
return planetColor;
case Track::Type::Base:
if (track.HasLock())
return enemyColor;
return baseColor;
case Track::Type::JumpPoint:
return jumpColor;
default:
break;
}
}
if (UseFriendFoe())
{
switch (trackType)
{
case Track::Type::CapitalShip:
case Track::Type::Ship:
{
if (track.HasLock())
return enemyColor;
switch (track.GetRelation())
{
case Track::Relation::Friend:
return friendColor;
case Track::Relation::Enemy:
if (UseThreatAssessment() && (threatLevel == ThreatLevel::None))
return neutralColor;
return enemyColor;
default:
return neutralColor;
}
}
case Track::Type::Cargo:
return cargoColor;
default:
break;
}
}
return noColor;
}