BOOL ActorStateMachine::SetNewAction(string systemName){ ACTIONid actionID = this->ActionIDMap[systemName]; FnActor actor; actor.Object(this->character); if (actor.MakeCurrentAction(0,NULL,actionID) == FAILED_ID){ sprintf(debug, "%s make current action %s fail\n", debug, systemName.c_str()); return FALSE; }else{ //sprintf(debug, "%s %s make successful\n", debug, systemName.c_str()); } if (actor.Play(0,START, 0.0, FALSE,TRUE) == FALSE){ sprintf(debug, "%s %s play action failed\n", debug, systemName.c_str()); return FALSE; }else{ //sprintf(debug, "%s %s play successful\n", debug, systemName.c_str()); } return TRUE; }
void OurActor::ourPlayAction() { FnActor actor; actor.Object( aID ); if(::actorChangePose( aID, current_OurAction->actID )) { current_frame = 0; } //it's a loop action? if( current_OurAction->type == Action_type::ACTION_IDLE() || current_OurAction->type == Action_type::ACTION_WALK() ) { bool notOver; notOver = actor.Play(0, ONCE, current_OurAction->play_speed, false, true); if( notOver ) current_frame += current_OurAction->play_speed; else { current_frame = 0; actor.MakeCurrentAction(0, NULL, current_OurAction->actID); } } else { bool notOver; notOver = actor.Play(0, ONCE, current_OurAction->play_speed, FALSE, TRUE); if( !notOver ) { if( current_OurAction->type.value != Action_type::ACTION_DIE() ) current_OurAction = ourIdleAction; } else current_frame += current_OurAction->play_speed; } playActionAudio(); playActionFx(); }