$begingroup$

I would like the assault transfer to chill down after 3 clicks, after which re-enable after time has handed.

I bought the three clicks cooldown, however I am unable to wrap my head on the opposite half.

utilizing System.Collections.Generic;
utilizing UnityEngine;

public class ASDF : MonoBehaviour
{
    [SerializeField] non-public float attackCooldown;
    non-public float nextAttackTime;
    non-public Animator anim;
    int counter;
    non-public float cooldown = 1f;
    non-public float lastAttackedAt = -9999f;
    int delayBeforeCooldownStart;
    // Begin is known as earlier than the primary body replace
    void Begin()
    {
        anim = GetComponentInChildren<Animator>();
    }

    // Replace is known as as soon as per body
    void Replace()
    {
        if (Enter.GetKeyDown(KeyCode.Mouse0) && (Time.time > nextAttackTime))
        {
            Assault();
            Debug.Log("get hit");

            counter = counter + 1;
            Debug.Log(counter);           
        }

        if (counter >= 3)
        {
            nextAttackTime = Time.time + attackCooldown;
            counter = 0;
        }
    }

    non-public void Assault()
    {
        anim.SetTrigger("Attack1");
    }

    non-public void timer()
    {
        anim.SetBool("reset", false);
    }
}

//if (Time.time > lastAttackTime + delayBeforeCooldownStart)
// nextAttackTime = Time.time + attackCooldown;

zeus christ is a brand new contributor to this website. Take care in asking for clarification, commenting, and answering.
Take a look at our Code of Conduct.

$endgroup$

1

You will need to log in to reply this query.

Browse different questions tagged .