Game Development Reference
In-Depth Information
} GOAL_TYPE;
GOAL_TYPE MyGame::GetBestAction()
{
// Calc our remaining health if we get the Health Kit first
int HealthFirst = mMyHealth
- Damage( mTimeToHealth, mDamageRate )
- Damage( mTimeHealthToArmor, mDamageRate )
- Damage( mTimeToArmor, mArmoredDamageRate )
+ mHealthKitValue;
// Calc our remaining health if we get the Armor first
int ArmorFirst = mMyHealth
- Damage( mTimeToArmor, mDamageRate )
- Damage( mTimeHealthToArmor, mArmoredDamageRate )
- Damage( mTimeToHealth, mArmoredDamageRate )
+ mHealthKitValue;
// If both methods would leave us WORSE off than we started
// then do neither.
if ( ( mMyHealth > HealthFirst ) &&
( mMyHealth > ArmorFirst ) ) {
return GOAL_NONE;
}
// Return which of the two approaches will leave us with
// the most remaining health.
if ( HealthFirst > ArmorFirst ) {
return GOAL_HEALTH_ARMOR;
Search WWH ::




Custom Search