Hello,

This may be more of a fundamental C# question:

So I'm working with a simple function in my playerMovement script which controls the player's movement and animation properties.

One thing I'm trying to do is make it so that the character will stop animating when in a battle menu (for a real time game)

My strategy to do this has been to access the game object's combatant and then use the "IsChoosing" property to determine to gather if it is "true" or "false" during game time.



using ORKFramework;
Combatant combatant;


void Start()
{
combatant = ComponentHelper.GetCombatant(gameObject);
}
void FixedUpdate(){
CheckPlayerBattleMenu();
}

void CheckPlayerBattleMenu() {
if (combatant.Actions.IsChoosing)
{
Debug.Log("is choosing");
}
}


What I want to test here is, "if the selected combatant IsChoosing == true in game. Debug to the console 'is choosing'"

This way, later I can alter the character's anime animation.

Though I can't seem to capture changes to this property during game time. As it always returns "false" no matter what.

Is there something I'm missing here?

Or am I missing something important about properties that I'm not considering?

Thanks!
  • IsChoosing should be true while the combatant chooses an action (e.g. when the battle menu is opened). Alternatively, you can also register to the ChoosingStateChanged event handler to get notified when IsChoosing changes.

    The inspector of the Combatant Component also outputs the state in case you want to check there.
  • Yeah you're right as always haha.

    Apparently, I didn't notice that the script I was using was getting disabled during the game for reasons I understand (fortunately)

    Many thanks!
Sign In or Register to comment.