本文整理汇总了C++中UnitBase::AddDamage方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitBase::AddDamage方法的具体用法?C++ UnitBase::AddDamage怎么用?C++ UnitBase::AddDamage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitBase
的用法示例。
在下文中一共展示了UnitBase::AddDamage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void StageDig::Update(void)
{
// モグルのドリルで敵にダメージ
UnitManager &unitManager = UnitManager::GetInstance();
VECTOR position;
position.x = 7.5f;
position.y = 5.0f;
UnitBase* unit = unitManager.GetNearUnit( position, 1.0f, true );
if( unit != NULL )
{
VECTOR damageType;
unit->AddDamage(1000, UnitBase::DAMAGETYPE_NORMAL, damageType, NULL );
}
// ブロック削り判定
BlockManager &blockManager = BlockManager::GetInstance();
BlockBase* base = blockManager.GetBlock( position.x, position.y );
// 指定地点が空なら
if( base == NULL || base->m_ID == BLOCK_WATER || base->m_ID == BLOCK_FIRE)
{
float speed = 0.06f;
if( base )
{
if(base->m_ID == BLOCK_WATER )
{
speed = 0.03f;
}
else if( base->m_ID == BLOCK_FIRE && GameInput::GetInstance().GetFrame() % 10 == 0)
{
DataManager::GetInstance().m_MogllStatus.life -= EquipmentFunction_05(1);
}
}
float fallValue = EquipmentFunction_40( speed );
blockManager.AddDepth( fallValue );
DataManager &data = DataManager::GetInstance();
// 記録更新したら代入
int depth = static_cast<int>(blockManager.GetDepth() + data.m_MogllStatus.position.y * 600.0f / 40.0f);
if( data.m_SaveData.stageDepth[ data.m_SceneInt["StageNo"] ] < depth )
{
data.m_SaveData.stageDepth[ data.m_SceneInt["StageNo"] ] = depth;
}
//UnitManager::GetInstance().MoveUp( fallValue );
}
else if( EquipmentFunction_35( GameInput::GetInstance().GetFrame() ) )
{
DataManager &data = DataManager::GetInstance();
// ブロックの削りダメージ
int damage = 1;
int mogllDamage = EquipmentFunction_11( data.m_SystemData.block[ base->m_ID - 1 ].damage );
m_DigPoint += mogllDamage;
if( m_DigPoint >= 100 )
{
data.m_MogllStatus.life -= m_DigPoint / 100;
m_DigPoint = m_DigPoint % 100;
}
base->m_Life -= damage;
}
//-------------------------------------------------------------- 笹井
//今いるブロックをチェック
base = blockManager.GetBlock( position.x, position.y );
if(base)
{
if(base->m_ID == BLOCK_WATER )
{
m_SEWaterCnt--;
if( m_SEWaterCnt <= 0 &&
CheckSoundMem(DataManager::GetInstance().Get( DataManager::SoundSE57 )) == 0)
{
PlaySoundMem( DataManager::GetInstance().Get( DataManager::SoundSE57 ), DX_PLAYTYPE_BACK);
m_SEWaterCnt = 90;
}
}
else if( base->m_ID == BLOCK_FIRE)
{
if(CheckSoundMem(DataManager::GetInstance().Get( DataManager::SoundSE56 )) == 0)
PlaySoundMem( DataManager::GetInstance().Get( DataManager::SoundSE56 ), DX_PLAYTYPE_BACK);
}
if(base->m_ID != BLOCK_WATER )
m_SEWaterCnt = 0;
}
}