本文整理汇总了C++中CUnit::GetAttackSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ CUnit::GetAttackSpeed方法的具体用法?C++ CUnit::GetAttackSpeed怎么用?C++ CUnit::GetAttackSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUnit
的用法示例。
在下文中一共展示了CUnit::GetAttackSpeed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreatePlayerUnit
void CFactory::CreatePlayerUnit(int nType)
{
PROFILE("CFactory::CreatePlayerUnit(int)");
//static float xPos = 100;
//static float yPos = 50;
CUnit* unit = new CUnit(nType);
// Use default shallow copy since no dynamic info in creation
CUnit temp = CGame::GetInstance()->GetUnitInfo(nType);
unit->SetAttackPower(temp.GetAttackPower());
unit->SetAttackSpeed(temp.GetAttackSpeed());
unit->SetMaxHP(temp.GetMaxHP());
unit->SetCurrentHP(temp.GetMaxHP());
unit->SetRange(temp.GetRange());
unit->SetSpeed(temp.GetSpeed());
unit->SetState(IDLE);
unit->SetDirection(SOUTH_WEST);
unit->SetIsPlayerUnit(true);
unit->SetAttackSoundID(CGame::GetInstance()->GetAttackSound(unit->GetType()));
// Register Events
unit->SetDeathSoundID(CGame::GetInstance()->GetDeathSound(unit->GetType()));
// Add to manager
ObjectManager::GetInstance()->AddObject(unit);
// Let it know we aren't hanging on to it
unit->Release();
STOP("CFactory::CreatePlayerUnit(int)");
}
示例2: CreateComputerUnit
void CFactory::CreateComputerUnit(int nType)
{
PROFILE("CFactory::CreateComputerUnit(int)");
//static float xPos = 100;
//static float yPos = 50;
CUnit* unit = new CUnit(nType);
// Use default shallow copy since no dynamic info in creation
CUnit temp = CGame::GetInstance()->GetCPUUnitInfo(nType);
unit->SetAttackPower(temp.GetAttackPower());
unit->SetAttackSpeed(temp.GetAttackSpeed());
unit->SetMaxHP(temp.GetMaxHP());
unit->SetCurrentHP(temp.GetMaxHP());
unit->SetRange(temp.GetRange());
unit->SetSpeed(temp.GetSpeed());
unit->SetState(IDLE);
unit->SetDirection(NORTH_WEST);
unit->SetIsPlayerUnit(false);
// Register Events
unit->SetAttackSoundID(CGame::GetInstance()->GetAttackSound(unit->GetType()));
unit->SetDeathSoundID(CGame::GetInstance()->GetDeathSound(unit->GetType()));
switch(CGame::GetInstance()->GetSelectedCity()->GetID())
{
case KCITY1:
break;
case KCITY2:
unit->SetAttackPower(unit->GetAttackPower()+2);
break;
case KCITY3:
unit->SetAttackPower(unit->GetAttackPower()+2);
unit->SetAttackSpeed(unit->GetAttackSpeed()-(unit->GetAttackSpeed()*.2f));
unit->SetSpeed(unit->GetSpeed()-(unit->GetSpeed()*.5f));
break;
case XCITY1:
break;
case XCITY2:
unit->SetAttackPower(unit->GetAttackPower()+2);
break;
case XCITY3:
unit->SetAttackPower(unit->GetAttackPower()+2);
unit->SetAttackSpeed(unit->GetAttackSpeed()-(unit->GetAttackSpeed()*.2f));
unit->SetSpeed(unit->GetSpeed()-(unit->GetSpeed()*.5f));
break;
case JCITY1:
break;
case JCITY2:
unit->SetAttackPower(unit->GetAttackPower()+2);
break;
case JCITY3:
unit->SetAttackPower(unit->GetAttackPower()+2);
unit->SetAttackSpeed(unit->GetAttackSpeed()-(unit->GetAttackSpeed()*.2f));
unit->SetSpeed(unit->GetSpeed()-(unit->GetSpeed()*.5f));
break;
}
// Add to manager
ObjectManager::GetInstance()->AddObject(unit);
// Let it know we aren't hanging on to it
unit->Release();
STOP("CFactory::CreateComputerUnit(int)");
}