bool UPawnActionsComponent::K2_PushAction(UPawnAction* NewAction, EAIRequestPriority::Type Priority, UObject* Instigator) { if (NewAction) { return PushAction(*NewAction, Priority, Instigator); } return false; }
EBTNodeResult::Type UBTTask_PushPawnAction::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) { UPawnAction* ActionCopy = Action ? DuplicateObject<UPawnAction>(Action, &OwnerComp) : nullptr; if (ActionCopy == nullptr) { return EBTNodeResult::Failed; } return PushAction(OwnerComp, *ActionCopy); }
void UnitStateMgr::DropAllStates() { // Assume, that if only one action - that IDLE appears (rechecked later). if (m_actions.size() > 1 ) { DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "UnitStateMgr:DropAllStates %s drop all active states (count = %u)", GetOwnerStr().c_str(), m_actions.size()); DropActionHigherThen(UNIT_ACTION_PRIORITY_IDLE); } // Unique action after dropping may be not UNIT_ACTION_IDLE if (m_actions.empty() || GetCurrentState() != UNIT_ACTION_IDLE) PushAction(UNIT_ACTION_IDLE); }
void UnitStateMgr::DropAllStates() { DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "UnitStateMgr:DropAllStates %s drop all active states", GetOwnerStr().c_str()); DropActionHigherThen(UNIT_ACTION_PRIORITY_IDLE); PushAction(UNIT_ACTION_IDLE); }
void UnitStateMgr::PushAction(UnitActionId actionId, UnitActionPtr state) { PushAction(actionId, state, staticActionInfo[actionId].priority, staticActionInfo[actionId].restoreable); }
void UnitStateMgr::PushAction(UnitActionId actionId, UnitActionPriority priority) { UnitActionPtr state = CreateStandartState(actionId); PushAction(actionId, state, priority, ACTION_TYPE_NONRESTOREABLE); }
void UnitStateMgr::PushAction(UnitActionId actionId) { UnitActionPtr state = CreateStandartState(actionId); PushAction(actionId, state, staticActionInfo[actionId].priority, staticActionInfo[actionId].restoreable); }
void DisplayList::DoButtonAction(SObject* target, int transition) { SCharacter* ch = target->character; FLASHASSERT(ch->type == buttonChar); if ( ch->tagCode == stagDefineButton2 ) { // Handle the new style button SParser parser; parser.Attach(ch->data, 0); BOOL first = true; for (;;) { S32 link = parser.pos; int offset = parser.GetWord(); if ( !first ) { int code = parser.GetWord(); if ( code & (1<<transition) ) { PushAction(parser.script+parser.pos, target->thread); } } if ( !offset ) break; parser.pos = link + offset; first = false; } } else { // Handle the old style button if ( transition == bsOverDownToOverUp ) { // Do the button action on the mouse up in SParser parser; parser.Attach(ch->data, 0); // Skip over the child data for (;;) { U8 stateFlags = parser.GetByte(); if ( !stateFlags ) break; MATRIX m; parser.SkipBytes(4);//GetWord(); //parser.GetWord(); parser.GetMatrix(&m); } // Handle the action PushAction(parser.script+parser.pos, target->thread); } } #ifdef SOUND {// Play the sound int state = 0; switch ( transition ) { case bsIdleToOverDown: case bsIdleToOverUp: state = sbtnOverState; break; case bsOverUpToOverDown: state = sbtnDownState; break; case bsOverDownToOverUp: state = sbtnHitTestState; break; case bsOverUpToIdle: case bsOutDownToIdle: case bsOverDownToIdle: state = sbtnUpState; break; } if ( state && ch->button.soundData ) { SParser parser; parser.Attach(ch->button.soundData, 0); // Skip the sounds for ( int i = 1; i < state; i <<= 1 ) { U16 tag = parser.GetWord(); if ( tag ) parser.GetSoundInfo(0);// skip the data } // Get the sound we want U16 tag = parser.GetWord(); if ( tag ) { SCharacter* sound = ch->player->FindCharacter(tag); if ( !sound || sound->type != soundChar ) return; CSoundChannel* channel = new CSoundChannel(); if ( channel ) { channel->AddRef(); channel->sound = &sound->sound; channel->tag = (U32)this; parser.GetSoundInfo(channel); // set up envelope, inPoint, loops, etc... theSoundMix->AddSound(channel); channel->Release(); } } } } #endif }