using UnityEngine;
using System.Collections;

public class SwordAtack : MonoBehaviour {
    
    public float AttackRate;
    //private float nextAttackTime = 0f;
    private float lastFireTime = -1f;


    void Update()
    {
        if (Input.GetButtonDown("Trigger1"))
        {
            StartCoroutine(FireMagic());
        }
    }

    IEnumerator FireMagic()
    {
        if (Time.time > lastFireTime + 1 / AttackRate)
        {
            //anim atack

            lastFireTime = Time.time;
        }

        yield return null;
    }
}
