本文整理汇总了C++中CUnit::ChangeLos方法的典型用法代码示例。如果您正苦于以下问题:C++ CUnit::ChangeLos方法的具体用法?C++ CUnit::ChangeLos怎么用?C++ CUnit::ChangeLos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUnit
的用法示例。
在下文中一共展示了CUnit::ChangeLos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadUnit
//.........这里部分代码省略.........
unit->sonarRadius = ud->sonarRadius / (SQUARE_SIZE * 8);
unit->jammerRadius = ud->jammerRadius / (SQUARE_SIZE * 8);
unit->sonarJamRadius = ud->sonarJamRadius / (SQUARE_SIZE * 8);
unit->seismicRadius = ud->seismicRadius / (SQUARE_SIZE * 8);
unit->seismicSignature = ud->seismicSignature;
unit->hasRadarCapacity = unit->radarRadius || unit->sonarRadius ||
unit->jammerRadius || unit->sonarJamRadius ||
unit->seismicRadius;
unit->stealth = ud->stealth;
unit->sonarStealth = ud->sonarStealth;
unit->category = ud->category;
unit->armorType = ud->armorType;
unit->floatOnWater =
ud->floater || (ud->movedata && ((ud->movedata->moveType == MoveData::Hover_Move) ||
(ud->movedata->moveType == MoveData::Ship_Move)));
unit->maxSpeed = ud->speed / GAME_SPEED;
unit->decloakDistance = ud->decloakDistance;
unit->flankingBonusMode = ud->flankingBonusMode;
unit->flankingBonusDir = ud->flankingBonusDir;
unit->flankingBonusMobility = ud->flankingBonusMobilityAdd * 1000;
unit->flankingBonusMobilityAdd = ud->flankingBonusMobilityAdd;
unit->flankingBonusAvgDamage = (ud->flankingBonusMax + ud->flankingBonusMin) * 0.5f;
unit->flankingBonusDifDamage = (ud->flankingBonusMax - ud->flankingBonusMin) * 0.5f;
if(ud->highTrajectoryType==1)
unit->useHighTrajectory=true;
if(ud->fireState >= 0)
unit->fireState = ud->fireState;
if(build){
unit->ChangeLos(1,1);
unit->health=0.1f;
} else {
unit->ChangeLos((int)(ud->losRadius),(int)(ud->airLosRadius));
}
if (type == "GroundUnit") {
new CMobileCAI(unit);
}
else if (type == "Transport") {
new CTransportCAI(unit);
}
else if (type == "Factory") {
new CFactoryCAI(unit);
}
else if (type == "Builder") {
new CBuilderCAI(unit);
}
else if (type == "Bomber") {
if (ud->hoverAttack) {
new CMobileCAI(unit);
} else {
new CAirCAI(unit);
}
}
else if(type == "Fighter"){
if (ud->hoverAttack) {
new CMobileCAI(unit);
} else {
new CAirCAI(unit);
}
}
else {
示例2: LoadUnit
CUnit* CUnitLoader::LoadUnit(const string& name, float3 pos, int side, bool build)
{
CUnit* unit;
START_TIME_PROFILE;
UnitDef* ud= unitDefHandler->GetUnitByName(name);
if(!ud){
char t[500];
sprintf(t,"Couldnt find unittype %s",name.c_str());
handleerror(0,t,"Error loading unit",0);
exit(0);
}
string type = ud->type;
if(!build){
pos.y=ground->GetHeight2(pos.x,pos.z);
if(ud->floater && pos.y<0)
pos.y = -ud->waterline;
}
bool blocking = false; //Used to tell if ground area shall be blocked of not.
//unit = new CUnit(pos, side);
if (side < 0)
side = MAX_TEAMS-1;
if(type=="GroundUnit"){
unit=new CUnit;
blocking = true;
} else if (type=="Transport"){
unit=new CTransportUnit;
blocking = true;
} else if (type=="Building"){
unit=new CBuilding;
blocking = true;
} else if (type=="Factory"){
unit=new CFactory;
blocking = true;
} else if (type=="Builder"){
unit=new CBuilder;
blocking = true;
} else if (type=="Bomber" || type=="Fighter"){
unit=new CUnit;
} else if (type == "MetalExtractor") {
unit = new CExtractorBuilding;
blocking = true;
} else {
(*info) << "Unknown unit type " << type.c_str() << "\n";
return 0;
}
unit->UnitInit (ud, side, pos);
unit->beingBuilt=build;
unit->power=ud->power;
unit->maxHealth=ud->health;
unit->health=ud->health;
//unit->metalUpkeep=ud->metalUpkeep*16.0f/GAME_SPEED;
//unit->energyUpkeep=ud->energyUpkeep*16.0f/GAME_SPEED;
unit->controlRadius=(int)(ud->controlRadius/SQUARE_SIZE);
unit->losHeight=ud->losHeight;
unit->metalCost=ud->metalCost;
unit->energyCost=ud->energyCost;
unit->buildTime=ud->buildTime;
unit->aihint=ud->aihint;
unit->tooltip=ud->humanName + " " + ud->tooltip;
unit->armoredMultiple=max(0.0001f,ud->armoredMultiple); //armored multiple of 0 will crash spring
unit->wreckName=ud->wreckName;
unit->realLosRadius=(int) (ud->losRadius/(SQUARE_SIZE*2));
unit->realAirLosRadius=(int) (ud->airLosRadius/(SQUARE_SIZE*4));
unit->upright=ud->upright;
unit->xsize=ud->xsize;
unit->ysize=ud->ysize;
unit->radarRadius=ud->radarRadius/(SQUARE_SIZE*8);
unit->sonarRadius=ud->sonarRadius/(SQUARE_SIZE*8);
unit->jammerRadius=ud->jammerRadius/(SQUARE_SIZE*8);
unit->sonarJamRadius=ud->sonarJamRadius/(SQUARE_SIZE*8);
unit->hasRadarCapacity=unit->radarRadius || unit->sonarRadius || unit->jammerRadius || unit->sonarJamRadius;
unit->stealth=ud->stealth;
unit->category=ud->category;
unit->armorType=ud->armorType;
unit->floatOnWater = ud->floater || (ud->movedata && ((ud->movedata->moveType == MoveData::Hover_Move) || (ud->movedata->moveType == MoveData::Ship_Move)));
if(ud->highTrajectoryType==1)
unit->useHighTrajectory=true;
if(build){
unit->ChangeLos(1,1);
unit->health=0.1;
} else {
unit->ChangeLos((int)(ud->losRadius/SQUARE_SIZE),(int)(ud->airLosRadius/(SQUARE_SIZE*2)));
}
if(type=="GroundUnit"){
new CMobileCAI(unit);
} else if(type=="Transport"){
new CTransportCAI(unit);
} else if(type=="Factory"){
new CFactoryCAI(unit);
} else if(type=="Builder"){
new CBuilderCAI(unit);
//.........这里部分代码省略.........
示例3: LoadUnit
//.........这里部分代码省略.........
unit->sonarRadius = ud->sonarRadius / (SQUARE_SIZE * 8);
unit->jammerRadius = ud->jammerRadius / (SQUARE_SIZE * 8);
unit->sonarJamRadius = ud->sonarJamRadius / (SQUARE_SIZE * 8);
unit->seismicRadius = ud->seismicRadius / (SQUARE_SIZE * 8);
unit->seismicSignature = ud->seismicSignature;
unit->hasRadarCapacity = unit->radarRadius || unit->sonarRadius ||
unit->jammerRadius || unit->sonarJamRadius ||
unit->seismicRadius;
unit->stealth = ud->stealth;
unit->sonarStealth = ud->sonarStealth;
unit->category = ud->category;
unit->armorType = ud->armorType;
unit->floatOnWater =
ud->floater || (ud->movedata && ((ud->movedata->moveType == MoveData::Hover_Move) ||
(ud->movedata->moveType == MoveData::Ship_Move)));
unit->maxSpeed = ud->speed / 30.0f;
unit->decloakDistance = ud->decloakDistance;
unit->flankingBonusMode = ud->flankingBonusMode;
unit->flankingBonusDir = ud->flankingBonusDir;
unit->flankingBonusMobility = ud->flankingBonusMobilityAdd * 1000;
unit->flankingBonusMobilityAdd = ud->flankingBonusMobilityAdd;
unit->flankingBonusAvgDamage = (ud->flankingBonusMax + ud->flankingBonusMin) * 0.5f;
unit->flankingBonusDifDamage = (ud->flankingBonusMax - ud->flankingBonusMin) * 0.5f;
if(ud->highTrajectoryType==1)
unit->useHighTrajectory=true;
if(ud->fireState >= 0)
unit->fireState = ud->fireState;
if(build){
unit->ChangeLos(1,1);
unit->health=0.1f;
} else {
unit->ChangeLos((int)(ud->losRadius),(int)(ud->airLosRadius));
}
if (type == "GroundUnit") {
SAFE_NEW CMobileCAI(unit);
}
else if (type == "Transport") {
SAFE_NEW CTransportCAI(unit);
}
else if (type == "Factory") {
SAFE_NEW CFactoryCAI(unit);
}
else if (type == "Builder") {
SAFE_NEW CBuilderCAI(unit);
}
else if (type == "Bomber") {
if (ud->hoverAttack) {
SAFE_NEW CMobileCAI(unit);
} else {
SAFE_NEW CAirCAI(unit);
}
}
else if(type == "Fighter"){
if (ud->hoverAttack) {
SAFE_NEW CMobileCAI(unit);
} else {
SAFE_NEW CAirCAI(unit);
}
}
else {