void DetectInput() { if (Weapon != null) { if (Input.GetKeyDown(KeyCode.Mouse0)) { Weapon.FireWeapon(); } if (Input.GetKeyUp(KeyCode.Mouse0)) { Weapon.CeaseFire(true); } float MouseWheel = Input.GetAxis("Mouse ScrollWheel"); if (MouseWheel > 0) { Weapon.SwitchWeapon(true); } if (MouseWheel < 0) { Weapon.SwitchWeapon(false); } if (Input.GetKeyDown(KeyCode.Q)) { Weapon.SetWeapon(0); } if (Input.GetKeyDown(KeyCode.E)) { Weapon.SetWeapon(1); } if (Input.GetKeyDown(KeyCode.F)) { Weapon.SetWeapon(2); } } if (Move != null) { if (Input.GetKeyDown(KeyCode.Mouse1)) { Move.LaunchPlayer(); } } }
public void AddWeaponToPlayer(GameObject Player) { WeaponComp WeaponComponent = Player.GetComponent <WeaponComp>(); if (WeaponComponent == null) { return; } WeaponComponent.AddWeapon(WeaponToAdd, this); if (switchToNewWeapon) { WeaponComponent.SwitchWeapon(true); } }