If I want to use a same button to enter state and exit state. (No need to hold the button down.) How I do it?
You could track if youre already in target mode… use a bool value in the input reader…
bool isTareting;
if(isTargeting) cancelEvent else TargetEvent…
It’s actually infinitely easier than that. You’re already in the targeting state, so there’s no need to see if we’re targeting.
public override void Enter()
{
stateMachine.Animator.CrossFadeInFixedTime(TargetingBlendTree, .2f);
stateMachine.InputReader.CancelEvent += OnCancel;
stateMachine.InputReader.TargetEvent += OnCancel; //This would make pressing tab (target) again would cancel.
}
5 Likes
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.