本文整理汇总了C++中GetGameRules函数的典型用法代码示例。如果您正苦于以下问题:C++ GetGameRules函数的具体用法?C++ GetGameRules怎么用?C++ GetGameRules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetGameRules函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: BALANCE_VAR
void AvHBaseBuildable::StartRecycle()
{
if(!GetHasUpgrade(this->pev->iuser4, MASK_RECYCLING))
{
int theRecycleTime = (GetGameRules()->GetCheatsEnabled() && !GetGameRules()->GetIsCheatEnabled(kcSlowResearch)) ? 2 : BALANCE_VAR(kRecycleTime);
// Play recycle animation in reverse (would like to play them slower according to recycle time, but it doesn't work for all structures, seems dependent on # of keyframes)
int theAnimation = this->GetRecycleAnimation();
float theTimeForAnim = this->GetTimeForAnimation(theAnimation);
float theFrameRate = -1;//-theTimeForAnim/theRecycleTime;
this->PlayAnimationAtIndex(theAnimation, true, theFrameRate);
// Schedule time to give points back
SetThink(&AvHBaseBuildable::RecycleComplete);
this->mTimeRecycleStarted = gpGlobals->time;
this->mTimeRecycleDone = gpGlobals->time + theRecycleTime;
this->pev->nextthink = this->mTimeRecycleDone;
float theVolume = .5f;
EMIT_SOUND(this->edict(), CHAN_AUTO, kBuildableRecycleSound, theVolume, ATTN_NORM);
SetUpgradeMask(&this->pev->iuser4, MASK_RECYCLING);
// run any events for this class on recycling the structure
this->UpdateOnRecycle();
// Remove tech immediately, so research or building isn't started using this tech
this->TriggerRemoveTech();
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:33,代码来源:AvHBaseBuildable.cpp
示例2: GetGameRules
void AvHHive::SetHasBeenBuilt()
{
AvHBuildable::SetHasBeenBuilt();
GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_HIVE_COMPLETE, this->entindex());
// Make hive support any unassigned upgrade technologies (happens after a hive supporting a technology is destroyed and then rebuilt)
AvHTeamNumber theTeam = (AvHTeamNumber)this->pev->team;
AvHTeam* theTeamPointer = GetGameRules()->GetTeam(theTeam);
if(theTeamPointer)
{
AvHAlienUpgradeListType theUpgrades = theTeamPointer->GetAlienUpgrades();
if(AvHGetNumUpgradesInCategoryInList(theUpgrades, ALIEN_UPGRADE_CATEGORY_DEFENSE) > 0)
{
AvHSUUpdateHiveTechology(theTeam, ALIEN_BUILD_DEFENSE_CHAMBER);
}
if(AvHGetNumUpgradesInCategoryInList(theUpgrades, ALIEN_UPGRADE_CATEGORY_MOVEMENT) > 0)
{
AvHSUUpdateHiveTechology(theTeam, ALIEN_BUILD_MOVEMENT_CHAMBER);
}
if(AvHGetNumUpgradesInCategoryInList(theUpgrades, ALIEN_UPGRADE_CATEGORY_SENSORY) > 0)
{
AvHSUUpdateHiveTechology(theTeam, ALIEN_BUILD_SENSORY_CHAMBER);
}
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:29,代码来源:AvHHive.cpp
示例3: GetGameRules
void AvHBaseBuildable::BuildableTouch(CBaseEntity* inEntity)
{
if(inEntity->pev->team != this->pev->team)
{
this->Uncloak();
// GHOSTBUILDING: Destroy and return res.
if (this->mGhost && inEntity->IsAlive() && inEntity->IsPlayer())
{
this->TakeDamage(inEntity->pev, this->pev, 80000, DMG_GENERIC);
AvHTeam* theTeam = GetGameRules()->GetTeam(AvHTeamNumber(this->pev->team));
if (theTeam)
{
float thePercentage = .8f;
float thePointsBack = GetGameRules()->GetCostForMessageID(this->mMessageID) * thePercentage;
theTeam->SetTeamResources(theTeam->GetTeamResources() + thePointsBack);
AvHSUPlayNumericEventAboveStructure(thePointsBack, this);
}
// Uncloak the player
AvHCloakable *theCloakable=dynamic_cast<AvHCloakable *>(inEntity);
if ( theCloakable ) {
theCloakable->Uncloak();
}
}
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:30,代码来源:AvHBaseBuildable.cpp
示例4: Vector
void AvHHive::HiveAliveThink(void)
{
// For some reason, velocity is non-zero when created (meant they were showing up on motion-tracking)
this->pev->velocity = Vector(0, 0, 0);
if(GetGameRules()->GetGameStarted())
{
if(!this->mActive)
{
bool theIsBuilding, theIsResearching;
float thePercentage;
AvHSHUGetBuildResearchState(this->pev->iuser3, this->pev->iuser4, this->pev->fuser1, theIsBuilding, theIsResearching, thePercentage);
float theBuildTime = GetGameRules()->GetBuildTimeForMessageID(this->GetMessageID());
float theBuildPercentage = kHiveAliveThinkInterval/theBuildTime;
float theNewPercentage = min(thePercentage + theBuildPercentage, 1.0f);
this->SetNormalizedBuildPercentage(theNewPercentage);
}
else
{
this->ProcessHealing();
// Play idle anims
AvHBaseBuildable::AnimateThink();
}
this->UpdateReinforcements();
//this->UpdateUmbra();
}
// Set next think
this->pev->nextthink = gpGlobals->time + kHiveAliveThinkInterval;
}
开发者ID:Arkshine,项目名称:NS,代码行数:35,代码来源:AvHHive.cpp
示例5: processBalanceChange
void AvHTechTree::processBalanceChange(void)
{
// Run through our tech nodes and update cost and build time
TechNodeMap::iterator current, end = mNodesByMsg.end();
for( current = mNodesByMsg.begin(); current != end; ++current )
{
current->second->setBuildTime(GetGameRules()->GetBuildTimeForMessageID(current->first));
current->second->setCost(GetGameRules()->GetCostForMessageID(current->first));
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:10,代码来源:AvHTechTree.cpp
示例6: GetGameRules
void AvHBaseBuildable::UpdateDamageEffects()
{
if(GetGameRules()->GetGameStarted() && this->GetIsBuilt())
{
// Add special effects for structures that are hurt or almost dead
float theMaxHealth = GetGameRules()->GetBaseHealthForMessageID(this->GetMessageID());
float theHealthScalar = this->pev->health/theMaxHealth;
float theTimeInterval = max(gpGlobals->time - this->mTimeOfLastDamageUpdate, .1f);
const float kParticleSystemLifetime = 5.0f;
int theAverageSoundInterval = -1;
// If we're at 25% health or less, emit black smoke
if(gpGlobals->time > (this->mTimeOfLastDamageEffect + kParticleSystemLifetime))
{
if(theHealthScalar < .25f)
{
AvHSUPlayParticleEvent(kpsBuildableLightDamage, this->edict(), this->pev->origin);
this->mTimeOfLastDamageEffect = gpGlobals->time;
theAverageSoundInterval = 3;
}
// If we're at 50% health or less, emit light smoke
else if(theHealthScalar < .5f)
{
AvHSUPlayParticleEvent(kpsBuildableLightDamage, this->edict(), this->pev->origin);
this->mTimeOfLastDamageEffect = gpGlobals->time;
theAverageSoundInterval = 5;
}
}
// If we're at less then 75% health, spark occasionally
if(theHealthScalar < .75f)
{
int theRandomChance = RANDOM_LONG(0, (float)8/theTimeInterval);
if(theRandomChance == 0)
{
UTIL_Sparks(this->pev->origin);
UTIL_Sparks(this->pev->origin);
const char* theHurtSoundToPlay = kBuildableHurt1Sound;
if(RANDOM_LONG(0, 1) == 1)
{
theHurtSoundToPlay = kBuildableHurt2Sound;
}
float theVolume = .3f;
EMIT_SOUND(this->edict(), CHAN_AUTO, theHurtSoundToPlay, theVolume, ATTN_NORM);
}
}
this->mTimeOfLastDamageUpdate = gpGlobals->time;
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:53,代码来源:AvHBaseBuildable.cpp
示例7: compareWorldChecksum
// takes filename, returns whether errors were encountered, returns whether checksums are identical or not
static int compareWorldChecksum(lua_State* inState)
{
bool theSuccess = false;
bool theChecksumsAreEqual = false;
const char* theFileName = lua_tostring(inState, 1);
Checksum theOldChecksum;
theSuccess = theOldChecksum.ReadFromFile(theFileName);
Checksum theNewChecksum;
GetGameRules()->ComputeWorldChecksum(theNewChecksum);
if(theSuccess)
{
StringList theErrors;
theChecksumsAreEqual = theNewChecksum.Compare(theOldChecksum, theErrors);
}
// Return function success
lua_pushnumber(inState, theSuccess);
// Return checksums are equal
lua_pushnumber(inState, theChecksumsAreEqual);
return 2;
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:26,代码来源:AvHScriptServer.cpp
示例8: MAKE_STRING
void AvHUmbraProjectile::Spawn(void)
{
this->Precache();
CBaseEntity::Spawn();
this->pev->movetype = MOVETYPE_FLY;
this->pev->classname = MAKE_STRING(kwsUmbraProjectile);
SET_MODEL(ENT(this->pev), kClientUmbraSprite);
this->pev->solid = SOLID_BBOX;
if(!GetGameRules()->GetDrawInvisibleEntities())
{
this->pev->effects = EF_NODRAW;
}
else
{
this->pev->frame = 0;
this->pev->scale = 0.5;
this->pev->rendermode = kRenderTransAlpha;
this->pev->renderamt = 255;
}
UTIL_SetSize(this->pev, Vector( 0, 0, 0), Vector(0, 0, 0));
SetTouch(&AvHUmbraProjectile::UmbraTouch);
}
开发者ID:Arkshine,项目名称:NS,代码行数:28,代码来源:AvHUmbraGun.cpp
示例9: MAKE_STRING
void AvHHive::Spawn()
{
this->Precache();
AvHBaseBuildable::Spawn();
this->pev->classname = MAKE_STRING(kesTeamHive);
//this->pev->movetype = MOVETYPE_FLY;
this->pev->movetype = MOVETYPE_FLY;
this->pev->solid = SOLID_NOT;
this->pev->flags = 0;
this->pev->iuser3 = AVH_USER3_HIVE;
this->mMaxHitPoints = GetGameRules()->GetBaseHealthForMessageID(ALIEN_BUILD_HIVE);
SET_MODEL( ENT(this->pev), kHiveModel);
//this->pev->scale = 2;
// this->pev->sequence = 0;
// this->pev->frame = 0;
// ResetSequenceInfo();
this->ResetEntity();
}
开发者ID:Arkshine,项目名称:NS,代码行数:26,代码来源:AvHHive.cpp
示例10: GetGameRules
void AvHResearchManager::UpdateResearch()
{
// Run through every item in the list and update research, marking any done
for(ResearchListType::iterator theIter = this->mResearchingTech.begin(); theIter != this->mResearchingTech.end(); )
{
if(theIter->GetCanEntityContinueResearch())
{
bool theHighTechCheat = GetGameRules()->GetIsCheatEnabled(kcHighTech);
if(theIter->UpdateResearch() || theHighTechCheat)
{
AvHMessageID theResearchingTech = theIter->GetResearching();
int theEntityIndex = theIter->GetEntityIndex();
this->SetResearchDone(theResearchingTech, theEntityIndex);
theIter = this->mResearchingTech.erase(theIter);
}
else
{
theIter++;
}
}
else
{
theIter = this->mResearchingTech.erase(theIter);
}
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:28,代码来源:AvHResearchManager.cpp
示例11: GetGameRules
void HolidayManager::HookIfNecessary()
{
// Already hooked
if (m_iHookID)
return;
// Nothing wants us
if (m_isHolidayForward->GetFunctionCount() == 0)
return;
void *pGameRules = GetGameRules();
if (!pGameRules)
{
if (m_bInMap)
{
g_pSM->LogError(myself, "Gamerules ptr not found. TF2_OnIsHolidayActive will not be available.");
}
return;
}
static int offset = -1;
if (offset == -1)
{
if (!g_pGameConf->GetOffset("IsHolidayActive", &offset))
{
g_pSM->LogError(myself, "IsHolidayActive gamedata offset missing. TF2_OnIsHolidayActive will not be available.");
return;
}
SH_MANUALHOOK_RECONFIGURE(IsHolidayActive, offset, 0, 0);
}
m_iHookID = SH_ADD_MANUALHOOK(IsHolidayActive, pGameRules, SH_MEMBER(this, &HolidayManager::Hook_IsHolidayActive), false);
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:34,代码来源:holiday.cpp
示例12: MAKE_STRING
void AvHSpike::Spawn()
{
this->Precache();
CBaseEntity::Spawn();
this->pev->movetype = MOVETYPE_FLY;
this->pev->classname = MAKE_STRING(kSpikeProjectileClassName);
SET_MODEL(ENT(this->pev), kSpikeProjectileModel);
this->pev->solid = SOLID_BBOX;
this->mDamage = 0.0f;
// Comment out effects line, uncomment next four, then comment out creation of temp entity in EV_SpikeGun to see server side Spike for testing
if(!GetGameRules()->GetDrawInvisibleEntities())
{
this->pev->effects = EF_NODRAW;
}
else
{
this->pev->frame = 0;
this->pev->scale = 0.5;
this->pev->rendermode = kRenderTransAlpha;
this->pev->renderamt = 255;
}
//UTIL_SetSize(this->pev, Vector( 0, 0, 0), Vector(0, 0, 0));
// UTIL_SetSize(this->pev, Vector( -16, -16, -16), Vector(16, 16, 16));
//UTIL_SetSize(this->pev, Vector( -50, -50, -50), Vector(50, 50, 50));
SetTouch(&AvHSpike::SpikeTouch);
// Enforce short range
SetThink(&AvHSpike::SpikeDeath);
this->pev->nextthink = gpGlobals->time + kSpikeLifetime;
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:35,代码来源:AvHAlienTurret.cpp
示例13: AvHBuildable
AvHBaseBuildable::AvHBaseBuildable(AvHTechID inTechID, AvHMessageID inMessageID, char* inClassName, int inUser3) : AvHBuildable(inTechID), kStartAlpha(128), mAverageUseSoundLength(.5f)
{
this->mClassName = inClassName;
this->mMessageID = inMessageID;
this->mBaseHealth = GetGameRules()->GetBaseHealthForMessageID(inMessageID);
char* theModelName = AvHSHUGetBuildTechModelName(inMessageID);
ASSERT(theModelName);
this->mModelName = theModelName;
this->mSelectID = inUser3;
this->mTimeToConstruct = GetGameRules()->GetBuildTimeForMessageID(inMessageID);
// Very important that this doesn't go in Init(), else mapper-placed structures disappear on map-reset
this->mPersistent = false;
this->Init();
}
开发者ID:Arkshine,项目名称:NS,代码行数:19,代码来源:AvHBaseBuildable.cpp
示例14: GetGameRules
void AvHBuildable::TriggerAddTech() const
{
AvHTeamNumber theTeamNumber = this->GetTeamNumber();
AvHTeam* theTeam = GetGameRules()->GetTeam(theTeamNumber);
if(theTeam)
{
theTeam->TriggerAddTech(this->mTechID);
}
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:10,代码来源:AvHBuildable.cpp
示例15: InitializeBuildable
// Requires mSelectID and mMessageID to be set
// Sets the pev user variables, mBaseHealth, pev->health and pev->armorvalue
void AvHBaseBuildable::InternalInitializeBuildable()
{
// Always buildable
InitializeBuildable(this->pev->iuser3, this->pev->iuser4, this->pev->fuser1, this->mSelectID);
this->mBaseHealth = GetGameRules()->GetBaseHealthForMessageID(this->mMessageID);
this->pev->health = this->mBaseHealth*kBaseHealthPercentage;
this->pev->max_health = this->mBaseHealth;
// Store max health in armorvalue
//this->pev->armorvalue = GetGameRules()->GetBaseHealthForMessageID(this->mMessageID);
}
开发者ID:Arkshine,项目名称:NS,代码行数:13,代码来源:AvHBaseBuildable.cpp
示例16:
int AvHPlayer::GetExperienceLevel() const
{
int theLevel = 1;
if(GetGameRules()->GetIsCombatMode())
{
theLevel = AvHPlayerUpgrade::GetPlayerLevel(this->GetExperience());
}
return theLevel;
}
开发者ID:Arkshine,项目名称:NS,代码行数:11,代码来源:AvHCombat.cpp
示例17: SetExperience
void AvHPlayer::SetExperience(float inExperience)
{
if(GetGameRules()->GetIsCombatMode())
{
int theCurrentLevel = AvHPlayerUpgrade::GetPlayerLevel(this->GetExperience());
this->mExperience = inExperience;
// Update server player data in case we get disconnected
AvHTeam* theTeam = this->GetTeamPointer();
if(theTeam)
{
AvHServerPlayerData* theServerPlayerData = this->GetServerPlayerData();
if(theServerPlayerData)
{
theServerPlayerData->SetExperience(this->mExperience);
}
}
int theNewLevel = AvHPlayerUpgrade::GetPlayerLevel(this->GetExperience());
if(theCurrentLevel != theNewLevel)
{
int theIsMarine = this->GetIsMarine();
PLAYBACK_EVENT_FULL(0, this->edict(), gLevelUpEventID, 0, this->pev->origin, (float *)&g_vecZero, 0.0, 0.0, theIsMarine, 0, 0, 0 );
// Give player health and armor back on level-up, to allow more soloing, heroics, and reduce dependence on hives/resupply
AvHUser3 theUser3 = AvHUser3(this->pev->iuser3);
float theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(this->pev->iuser4, theUser3, theCurrentLevel);
float theHealthPercentage = this->pev->health/theMaxHealth;
float theLevelUpHealthPercentage = BALANCE_IVAR(kCombatLevelupHealthIncreasePercent)/100.0f;
theHealthPercentage = min(theHealthPercentage + theLevelUpHealthPercentage, 1.0f);
this->pev->health = theHealthPercentage*theMaxHealth;
float theMaxArmor = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, theUser3);
float theArmorPercentage = this->pev->armorvalue/theMaxArmor;
float theLevelUpArmorPercentage = BALANCE_IVAR(kCombatLevelupArmorIncreasePercent)/100.0f;
theArmorPercentage = min(theArmorPercentage + theLevelUpArmorPercentage, 1.0f);
this->pev->armorvalue = theArmorPercentage*theMaxArmor;
// Unlock tiers as player levels up
// if(theNewLevel >= 4)
// {
// this->mCombatNodes.SetResearchDone(COMBAT_TIER2_UNLOCK);
// }
// if(theNewLevel >= 7)
// {
// this->mCombatNodes.SetResearchDone(COMBAT_TIER3_UNLOCK);
// }
}
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:54,代码来源:AvHCombat.cpp
示例18: AvHSUGetEntityFromIndex
bool AvHResearchNode::UpdateResearch()
{
bool theResearchDone = false;
AvHMessageID theResearchingTech = this->GetResearching();
if(theResearchingTech != MESSAGE_NULL)
{
CBaseEntity* theResearchEntity = AvHSUGetEntityFromIndex(this->mEntityIndex);
ASSERT(theResearchEntity);
float theTimeResearchDone = this->GetTimeResearchDone();
// Set time during the first update
if(theTimeResearchDone < 0)
{
this->mTimeResearchStarted = gpGlobals->time;
theTimeResearchDone = this->mTimeResearchStarted + GetGameRules()->GetBuildTimeForMessageID(theResearchingTech);
this->mTimeResearchDone = theTimeResearchDone;
theResearchEntity->pev->iuser2 = (int)this->mResearch;
}
if((gpGlobals->time >= theTimeResearchDone) || GetGameRules()->GetIsTesting())
{
theResearchDone = true;
//AvHSHUSetBuildResearchState(theResearchEntity->pev->iuser3, theResearchEntity->pev->iuser4, theResearchEntity->pev->fuser1, false, 0.0f);
// theResearchEntity->pev->fuser1 = 0.0f;
// theResearchEntity->pev->iuser2 = 0;
}
else
{
float theNormalizedResearchFactor = (gpGlobals->time - this->mTimeResearchStarted)/(this->mTimeResearchDone - this->mTimeResearchStarted);
theNormalizedResearchFactor = min(max(theNormalizedResearchFactor, 0.0f), 1.0f);
//theResearchEntity->pev->fuser1 = (kResearchFuser1Base + theNormalizedResearchFactor)*kNormalizationNetworkFactor;
AvHSHUSetBuildResearchState(theResearchEntity->pev->iuser3, theResearchEntity->pev->iuser4, theResearchEntity->pev->fuser1, false, theNormalizedResearchFactor);
}
}
return theResearchDone;
}
开发者ID:Arkshine,项目名称:NS,代码行数:40,代码来源:AvHResearchManager.cpp
示例19: ResetSequenceInfo
void AvHHive::CueRespawnEffect(AvHPlayer* inPlayer)
{
// Play hive animation, play effect for player?
this->pev->sequence = 4;
this->pev->frame = 0;
ResetSequenceInfo();
// Create umbra around spawning players, but not until after late-join period (to avoid a ton of umbras all at once)
if(!GetGameRules()->GetArePlayersAllowedToJoinImmediately())
{
//this->CreateUmbra(inPlayer->pev->origin);
}
}
开发者ID:Arkshine,项目名称:NS,代码行数:13,代码来源:AvHHive.cpp
示例20: ASSERT
bool AvHResearchManager::SetResearchDone(AvHMessageID inTech, int inEntityIndex)
{
bool theFoundIt = false;
if(this->mTechNodes.SetResearchDone(inTech))
{
edict_t* theEdict = g_engfuncs.pfnPEntityOfEntIndex(inEntityIndex);
ASSERT(!theEdict->free);
CBaseEntity* theEntity = CBaseEntity::Instance(theEdict);
ASSERT(theEntity);
// Potentially inform all entities and team of upgrade
GetGameRules()->ProcessTeamUpgrade(inTech, this->mTeamNumber, inEntityIndex, true);
// Hook research complete
AvHSUResearchComplete(theEntity, inTech);
// No longer researching
//theEntity->pev->fuser1 = kResearchFuser1Base*kNormalizationNetworkFactor;
AvHSHUSetBuildResearchState(theEntity->pev->iuser3, theEntity->pev->iuser4, theEntity->pev->fuser1, true, 0.0f);
// Tell entity that it's no longer researching
AvHBuildable* theBuildable = dynamic_cast<AvHBuildable*>(theEntity);
if(theBuildable)
{
theBuildable->SetResearching(false);
}
// Send message indicating research is done
GetGameRules()->TriggerAlert(this->mTeamNumber, ALERT_RESEARCH_COMPLETE, inEntityIndex);
theFoundIt = true;
}
return theFoundIt;
}
开发者ID:Arkshine,项目名称:NS,代码行数:36,代码来源:AvHResearchManager.cpp
注:本文中的GetGameRules函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论