I’m having some trouble with animating my combo system. I’m trying to have it so that if the player presses the key in the middle of the animation, it will then transition to the next animation using a trigger. The trigger is working however the speed of the transitions are the same. I would like to use the blending between my Combo1 to combo2 via exit time.
Here is the code I’m using. If there is anything I could do better with this code much help is appreciated.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class ComboAttack : MonoBehaviour
{
Animator characterAnimator;
PlayerInputActions playerInputActions;
bool comboPossible;
int comboStep;
void OnEnable()
{
playerInputActions.Enable();
}
private void Awake()
{
playerInputActions = new PlayerInputActions();
characterAnimator = GetComponent<Animator>();
playerInputActions.Actions.Fire1.performed += x => Fire1();
}
public void Fire1()
{
Debug.Log("ATTACK!");
if(comboStep == 0)
{
characterAnimator.SetTrigger("Attack1");
comboStep = 1;
return;
}
if(comboStep != 0)
{
if(comboPossible)
{
comboPossible = false;
comboStep +=1;
}
}
}
public void ComboPossible()
{
comboPossible = true;
}
public void Combo()
{
if(comboStep >= 1)
characterAnimator.SetTrigger("Attack"+comboStep);
}
public void ComboReset()
{
comboPossible = false;
comboStep = 0;
}
}