コード例 #1
0
//----------------------------------------------------------------------------------------------
bool AttackGroundAction::Execute(RtsGame& game, const WorldClock& p_clock)
{
    EntityClassType attackerType = (EntityClassType)_params[PARAM_EntityClassId];
    AbstractAdapter *pAdapter = g_OnlineCaseBasedPlanner->Reasoner()->Adapter();
    bool executed = false;

    // Adapt attacker
    _attackerId = pAdapter->GetEntityObjectId(attackerType,AdapterEx::AttackerStatesRank);

    if (_attackerId != INVALID_TID)
    {
        GameEntity* pGameAttacker = game.Self()->GetEntity(_attackerId);
        _ASSERTE(pGameAttacker);
        pGameAttacker->Lock(this);

        // Adapt attack position
        _position = pAdapter->AdaptEnemyBorder();
        executed = pGameAttacker->AttackGround(_position);
    }
    
    return executed;
}