using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour.
{
public GameObject[] projectiles;
private float lastKeyPressTime = 0f;
public float keyPressDelay = 1f;
void Update()
{
if (Input.GetKeyDown(KeyCode.A) && Time.time - lastKeyPressTime >= keyPressDelay)
{
Instantiate(projectiles[0], transform.position, Quaternion.identity);
lastKeyPressTime = Time.time;
}
else if (Input.GetKeyDown(KeyCode.S) && Time.time - lastKeyPressTime >= keyPressDelay)
{
Instantiate(projectiles[1], transform.position, Quaternion.identity);
lastKeyPressTime = Time.time;
}
else if (Input.GetKeyDown(KeyCode.D) && Time.time - lastKeyPressTime >= keyPressDelay)
{
Instantiate(projectiles[2], transform.position, Quaternion.identity);
lastKeyPressTime = Time.time;
}
}
}