- Home /
Input management with coroutines in a fighting game.
I'm currently working a fighting game and I therefore have to manage Inputs and attacks. Thing is, I use a coroutine to spawn a set of trigger colliders whenever I press a set key.
In the game logic, a combo is formed by a well timed input of the same key twice.
void NeutralLight()
{
StartCoroutine(LightA1());
if (Time.time <= moveEndTime + comboTimeThreshold && lightAttack == true)
{
StartCoroutine(LightA2());
}
CancelCalculations();
lightAttack = false;
}
(moveEndTime is set to Time.time right after going through LightA1(), comboTimeThreshold is set to 0.8f and lightAttack is true whenever the attack key is pressed, and currently the only way for it to shift value is to fully go through NeutralLight )
I'm pretty sure this doesn't work, but I hope this makes my idea clear.
Should I implement a coroutine that permanently checks for inputs (and thus shifting lightAttack's value) or should I do that in Update () ?
Your answer
Follow this Question
Related Questions
Very fast User Input Game in Unity 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
So I'm trying to make a combo with multiple attacks per layer, and not sure how. 0 Answers
Why is my function/coroutine executing a second time? 0 Answers
Checking Input on 2 different coroutines at the same time 1 Answer