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


C++ AInventory::BecomeItem方法代码示例

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


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

示例1: FixedMul

AInventory *AAmmo::CreateCopy (AActor *other)
{
	AInventory *copy;
	int amount = Amount;

	// extra ammo in baby mode and nightmare mode
	if (!(ItemFlags&IF_IGNORESKILL))
	{
		amount = FixedMul(amount, G_SkillProperty(SKILLP_AmmoFactor));
	}

	if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo) && GetClass() != RUNTIME_CLASS(AAmmo))
	{
		const PClass *type = GetParentAmmo();
		assert (type->ActorInfo != NULL);
		if (!GoAway ())
		{
			Destroy ();
		}

		copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0, NO_REPLACE));
		copy->Amount = amount;
		copy->BecomeItem ();
	}
	else
	{
		copy = Super::CreateCopy (other);
		copy->Amount = amount;
	}
	if (copy->Amount > copy->MaxAmount)
	{ // Don't pick up more ammo than you're supposed to be able to carry.
		copy->Amount = copy->MaxAmount;
	}
	return copy;
}
开发者ID:BadSanta1980,项目名称:gzdoom,代码行数:35,代码来源:a_pickups.cpp

示例2: GetParentAmmo

AInventory *AAmmo::CreateCopy (AActor *other)
{
	AInventory *copy;

	if (GetClass()->ParentType != RUNTIME_CLASS(AAmmo))
	{
		const TypeInfo *type = GetParentAmmo();
		if (!GoAway ())
		{
			Destroy ();
		}
		copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0));
		copy->Amount = Amount;
		copy->BecomeItem ();
	}
	else
	{
		copy = Super::CreateCopy (other);
	}
	if (copy->Amount > copy->MaxAmount)
	{ // Don't pick up more ammo than you're supposed to be able to carry.
		copy->Amount = copy->MaxAmount;
	}
	return copy;
}
开发者ID:doomtech,项目名称:zdoom-old,代码行数:25,代码来源:a_pickups.cpp

示例3: CreateCopy

AInventory *ACoin::CreateCopy (AActor *other)
{
	if (GetClass() == RUNTIME_CLASS(ACoin))
	{
		return Super::CreateCopy (other);
	}
	AInventory *copy = Spawn<ACoin> (0,0,0, NO_REPLACE);
	copy->Amount = Amount;
	copy->BecomeItem ();
	GoAwayAndDie ();
	return copy;
}
开发者ID:BenJamesbabala,项目名称:ViZDoom,代码行数:12,代码来源:a_coin.cpp


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