using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CombatManager : MonoBehaviour
{
[Header(“Animation Settings”)]
public Animator characterAnimator;
[Header("Attack Settings")]
public float ClickCooldown;
public float attackWait;
public float noInputResetTimer;
private StarterInputs input;
private int timesClicked = 0;
[Header("Debug")]
public float lastClicked = 0;
public float timer;
void Awake()
{
input = new StarterInputs();
}
void OnEnable()
{
input.Enable();
}
void OnDisable()
{
input.Disable();
}
void Update()
{
if(input.Player.NormalAttack.triggered)
{
AttackDelay();
// Attacks
Attack();
timer = 0;
}
}
void AttackDelay()
{
if(Time.time - lastClicked < ClickCooldown)
{
return;
}
lastClicked = Time.time;
timesClicked = Mathf.Clamp(timesClicked, 0, 3);
timesClicked++;
Debug.Log(timesClicked);
}
void Attack()
{
if(timesClicked == 1)
{
characterAnimator.SetInteger("intAttackPhase", 1);
}
//////////////
if(timesClicked == 2)
{
characterAnimator.SetInteger("intAttackPhase", 2);
}
///////////////
if(timesClicked == 3)
{
characterAnimator.SetInteger("intAttackPhase", 3);
}
/////////////////
if(timesClicked == 4)
{
characterAnimator.SetInteger("intAttackPhase", 4);
}
}
void ResetCombo()
{
characterAnimator.SetInteger("intAttackPhase", 0);
timesClicked = 0;
lastClicked = 0;
Debug.Log("Returned From ResetCombo");
}
}