Good day.
I’m making a FPS game so I’m trying to make fireMode for weapons (semi, burst, auto)
And I want to change my fireMode each time I press Input.GetKeyDown(KeyCode.V)
here is what I have
public class shoot : MonoBehaviour {
// a lot of variables
//fire mode
public enum FireMode
{
semi,
burst,
auto
}
public FireMode fireMode;
void Update(){
switch (fireMode) {
case FireMode.semi:
if (Input.GetMouseButtonDown (0)) {
ProjectileCount = 1;
TryFire ();
}
break;
case FireMode.burst:
if (Input.GetMouseButtonDown (0)) {
ProjectileCount = 3;
TryFire ();
}
break;
case FireMode.auto:
if (Input.GetMouseButton (0)) {
ProjectileCount = 1;
TryFire ();
}
break;
}
}
It is working fine when I set FireMode in Editor
But I don’t know how to make it change in runtime when pressing a key.
thanks