比如 fps游戏, 在装弹时,按开火键无效。 我现在的代码: using UnityEngine; using System.Collections; public class m9_Am : MonoBehaviour {
public float range=10.0f;
public float firRate=2.0f; public float force=10.0f; public float damage=10.0f; public int bulletsPerclip=7; public float clips=10; public float recloadTime=1;//shang2 dan4 shi2 jian1
int bulletsLeft=0;//can2 dan4 shu4
private float nextFireTime=1f; private int m_LastFrameShot=-1; void Start () {
bulletsLeft = bulletsPerclip;
}
void LateUpdate()
{ if (Input.GetKeyDown(KeyCode.R)) { animation.Play ("Reload"); StartCoroutine (Reload());
}
if (Input.GetKeyDown(KeyCode.E)) {}
if (Input.GetKey (KeyCode.W)) { if(Input.GetKey(KeyCode.LeftShift)) {}