// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { } if (Time.time >= nextAttackTime) { if (Input.GetKeyDown(KeyCode.Mouse0) || Input.GetKeyDown(KeyCode.Space)) { player.Attack(ennemyLayers); nextAttackTime = Time.time + 1f / player.getAttackRate(); } else if (Input.GetKeyDown(KeyCode.Mouse1)) { player.Defense(ennemyLayers); } } }