shoot und reload auf knöpfe vom InputManager angepasst
This commit is contained in:
@@ -11,6 +11,8 @@ public class WeaponScript : MonoBehaviour
|
||||
public DataBullet dataBullet;
|
||||
public UI_Manager uI_Manager;
|
||||
|
||||
private InputManagerScript inputManagerScript;
|
||||
|
||||
private int ammo;
|
||||
private bool isReloading = false;
|
||||
private float time = 0;
|
||||
@@ -21,7 +23,7 @@ public class WeaponScript : MonoBehaviour
|
||||
public float schussInterval;
|
||||
private float delay = 0;
|
||||
public void checkReload(){
|
||||
if(ammo == 0){
|
||||
if(ammo == 0 || Input.GetKeyDown(inputManagerScript.getReload())){
|
||||
isReloading = true;
|
||||
}
|
||||
if(isReloading){
|
||||
@@ -35,8 +37,8 @@ public class WeaponScript : MonoBehaviour
|
||||
}
|
||||
}
|
||||
public void shoot(){
|
||||
if(ammo != 0 && delayOver){
|
||||
if(Input.GetKeyDown(KeyCode.Mouse0)){
|
||||
if(!isReloading && delayOver){
|
||||
if(Input.GetKeyDown(inputManagerScript.getShoot())){
|
||||
muzzle.gameObject.SetActive(true);
|
||||
//muzzle.Play();
|
||||
Instantiate(bullet,spawnpoint.transform.position,spawnpoint.transform.rotation);
|
||||
@@ -61,6 +63,7 @@ public class WeaponScript : MonoBehaviour
|
||||
muzzle = GetComponentInChildren<ParticleSystem>();
|
||||
spawnpoint = GameObject.Find("Player/PlayerView/BulletSpawnpoint");
|
||||
uI_Manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<UI_Manager>();
|
||||
inputManagerScript = GameObject.Find("InputManager").GetComponent<InputManagerScript>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
Reference in New Issue
Block a user