本文整理汇总了C++中CUnit::IsAgressive方法的典型用法代码示例。如果您正苦于以下问题:C++ CUnit::IsAgressive方法的具体用法?C++ CUnit::IsAgressive怎么用?C++ CUnit::IsAgressive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUnit
的用法示例。
在下文中一共展示了CUnit::IsAgressive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoRepair
/* virtual */ void COrder_Still::Execute(CUnit &unit)
{
// If unit is not bunkered and removed, wait
if (unit.Removed
//Wyrmgus start
// && (unit.Container == nullptr || unit.Container->Type->BoolFlag[ATTACKFROMTRANSPORTER_INDEX].value == false)) {
&& (unit.Container == nullptr || !unit.Container->Type->BoolFlag[ATTACKFROMTRANSPORTER_INDEX].value || !unit.Type->BoolFlag[ATTACKFROMTRANSPORTER_INDEX].value)) { // make both the unit and the transporter have the tag be necessary for the attack to be possible
if (unit.Container != nullptr) {
LeaveShelter(unit); // leave shelter if surrounded
}
//Wyrmgus end
return ;
}
this->Finished = false;
switch (this->State) {
case SUB_STILL_STANDBY:
//Wyrmgus start
// UnitShowAnimation(unit, unit.Type->Animations->Still);
if (unit.Variable[STUN_INDEX].Value == 0) { //only show the idle animation when still if the unit is not stunned
UnitShowAnimation(unit, unit.GetAnimations()->Still);
}
if (SyncRand(100000) == 0) {
PlayUnitSound(unit, VoiceIdle);
}
unit.StepCount = 0;
//Wyrmgus end
break;
case SUB_STILL_ATTACK: // attacking unit in attack range.
AnimateActionAttack(unit, *this);
break;
}
if (unit.Anim.Unbreakable) { // animation can't be aborted here
return;
}
//Wyrmgus start
if (unit.Variable[STUN_INDEX].Value > 0) { //if unit is stunned, remain still
return;
}
//Wyrmgus end
this->State = SUB_STILL_STANDBY;
this->Finished = (this->Action == UnitActionStill);
if (this->Action == UnitActionStandGround || unit.Removed || unit.CanMove() == false) {
if (unit.AutoCastSpell) {
this->AutoCastStand(unit);
}
if (unit.IsAgressive()) {
this->AutoAttackStand(unit);
}
} else {
if (AutoCast(unit) || (unit.IsAgressive() && AutoAttack(unit))
|| AutoRepair(unit)
//Wyrmgus start
// || MoveRandomly(unit)) {
|| MoveRandomly(unit) || PickUpItem(unit)) {
//Wyrmgus end
}
}
}
示例2: AutoRepair
/* virtual */ void COrder_Still::Execute(CUnit &unit)
{
// If unit is not bunkered and removed, wait
if (unit.Removed
&& (unit.Container == NULL || unit.Container->Type->BoolFlag[ATTACKFROMTRANSPORTER_INDEX].value == false)) {
return ;
}
this->Finished = false;
switch (this->State) {
case SUB_STILL_STANDBY:
UnitShowAnimation(unit, unit.Type->Animations->Still);
break;
case SUB_STILL_ATTACK: // attacking unit in attack range.
AnimateActionAttack(unit, *this);
break;
}
if (unit.Anim.Unbreakable) { // animation can't be aborted here
return;
}
this->State = SUB_STILL_STANDBY;
this->Finished = (this->Action == UnitActionStill);
if (this->Action == UnitActionStandGround || unit.Removed || unit.CanMove() == false) {
if (unit.AutoCastSpell) {
this->AutoCastStand(unit);
}
if (unit.IsAgressive()) {
this->AutoAttackStand(unit);
}
} else {
if (AutoCast(unit) || (unit.IsAgressive() && AutoAttack(unit))
|| AutoRepair(unit)
|| MoveRandomly(unit)) {
}
}
}