当前位置: 首页>>代码示例>>C++>>正文


C++ Ship::Heat方法代码示例

本文整理汇总了C++中Ship::Heat方法的典型用法代码示例。如果您正苦于以下问题:C++ Ship::Heat方法的具体用法?C++ Ship::Heat怎么用?C++ Ship::Heat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ship的用法示例。


在下文中一共展示了Ship::Heat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckLock

void Projectile::CheckLock(const Ship &target)
{
	double base = hasLock ? 1. : .5;
	hasLock = false;
	
	// For each tracking type, calculate the probability that a lock will be
	// lost in a given five-second period. Then, since this check is done every
	// second, test against the fifth root of that probability.
	if(weapon->Tracking())
		hasLock |= Check(weapon->Tracking(), base);
	
	// Optical tracking is about 15% for interceptors and 75% for medium warships.
	if(weapon->OpticalTracking())
	{
		double weight = target.Mass() * target.Mass();
		double probability = weapon->OpticalTracking() * weight / (200000. + weight);
		hasLock |= Check(probability, base);
	}
	
	// Infrared tracking is 10% when heat is zero and 100% when heat is full.
	if(weapon->InfraredTracking())
	{
		double probability = weapon->InfraredTracking() * min(1., target.Heat() + .1);
		hasLock |= Check(probability, base);
	}
	
	// Radar tracking depends on whether the target ship has jamming capabilities.
	// Jamming of 1 is enough to increase your chance of dodging to 50%.
	if(weapon->RadarTracking())
	{
		double probability = weapon->RadarTracking() / (1. + target.Attributes().Get("radar jamming"));
		hasLock |= Check(probability, base);
	}
}
开发者ID:BorkBorkGoesTheCode,项目名称:endless-sky,代码行数:34,代码来源:Projectile.cpp

示例2: sprite

EscortDisplay::Icon::Icon(const Ship &ship, bool isHere)
	: sprite(ship.GetSprite().GetSprite()),
	isHere(isHere && !ship.IsDisabled()),
	stackSize(1),
	cost(ship.Cost()),
	system((!isHere && ship.GetSystem()) ? ship.GetSystem()->Name() : ""),
	low{ship.Shields(), ship.Hull(), ship.Energy(), ship.Heat(), ship.Fuel()},
	high(low)
{
}
开发者ID:Expack3,项目名称:endless-sky,代码行数:10,代码来源:EscortDisplay.cpp


注:本文中的Ship::Heat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。