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


C++ Weapon::Init方法代码示例

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


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

示例1: Init

void Character::Init( Screen3D& Screen, WorldManager* WM, MeshManager& MM, SoundManager& AM,  char* ObjectFile )
{
	//load in the animated mesh
	char TempBuffer[255];
	GetIniValue(ObjectFile, "graphics", "animation_file", TempBuffer);
	MeshA.Init( Screen, MM, TempBuffer );

	//Store some pointery things
	WMPtr = WM;
	MMPtr = &MM;


	Health = GetIniValue(ObjectFile, "properties", "health");
	//Load in the character's primary weapon
	GetIniValue(ObjectFile, "weapon", "weapon", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{

		//Create the weapon
		Weapon* DefaultWeapon = new Weapon;
		DefaultWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		//Add it to the world
		WMPtr->Add( DefaultWeapon );

		//also add it locally
		this->AddEntity(DefaultWeapon );
	}

	//load in the side arm
	GetIniValue(ObjectFile, "weapon", "sidearm", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{
		Weapon* SideWeapon = new Weapon;
		SideWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		WMPtr->Add( SideWeapon );

		this->AddEntity(SideWeapon );
	}

	CurrentState = "idle";

	//CharacterScript = GetSSLKernel()->TaskMan.BuildScript( "..\\scripts\\enemy.shil", NULL );

/*
	Value V;
	V.SetNum( ID );
	GetSSLKernel()->TaskMan.AddFunctionParameter( CharacterScript, V );
	GetSSLKernel()->TaskMan.CallAppFunction( CharacterScript, "SetCharacterHandle", 1 );
	GetSSLKernel()->TaskMan.RunActiveScripts( 100);*/
}
开发者ID:fathat,项目名称:game-src,代码行数:52,代码来源:Character.cpp

示例2: Init

void NetworkAvatar::Init( Screen3D& Screen, WorldManager* WM, MeshManager& MM, SoundManager& AM,  char* ObjectFile )
{
	//load in the animated mesh
	char TempBuffer[255];
	GetIniValue(ObjectFile, "graphics", "animation_file", TempBuffer);
	MeshA.Init( Screen, MM, TempBuffer );


	//Store some pointery things
	WMPtr = WM;
	MMPtr = &MM;

	//Load in the character's primary weapon
	GetIniValue(ObjectFile, "weapon", "weapon", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{

		//Create the weapon
		Weapon* DefaultWeapon = new Weapon;
		DefaultWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		//Add it to the world
		WMPtr->Add( DefaultWeapon );

		//also add it locally
		this->AddEntity(DefaultWeapon );
	}

	//load in the side arm
	GetIniValue(ObjectFile, "weapon", "sidearm", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{
		Weapon* SideWeapon = new Weapon;
		SideWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		WMPtr->Add( SideWeapon );

		this->AddEntity(SideWeapon );
	}

	//load in the third weapon
	GetIniValue(ObjectFile, "weapon", "third", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{
		Weapon* SideWeapon = new Weapon;
		SideWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		WMPtr->Add( SideWeapon );

		this->AddEntity(SideWeapon );
	}

	//load in the fourth weapon
	GetIniValue(ObjectFile, "weapon", "fourth", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{
		Weapon* SideWeapon = new Weapon;
		SideWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		WMPtr->Add( SideWeapon );

		this->AddEntity(SideWeapon );
	}

	//load in the fifth weapon
	GetIniValue(ObjectFile, "weapon", "fifth", TempBuffer);
	if( strcmpi(TempBuffer, "nostring") != 0)
	{
		Weapon* SideWeapon = new Weapon;
		SideWeapon->Init( Screen, WM, MM, AM, TempBuffer );

		WMPtr->Add( SideWeapon );

		this->AddEntity(SideWeapon );
	}



}
开发者ID:fathat,项目名称:game-src,代码行数:79,代码来源:NetworkObject.cpp


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