I am making a short game where the player character is able to pick up a powerup which then allows projectile attacks to happen. I’m quite a noob with coding, and I’m trying this in C#
By default the PC can do melee attacks, but I am trying to figure out how to specify ‘if character is holding a gun, they can now shoot bullets’. I have the actual animation and controls prepared, but I know I’m missing something to check if the PC is holding the gun. Here is my code so far (I’m removing the code for other controls from this part):
void Update () {
if (Input.GetButtonDown ("Fire1")) {
animator.SetTrigger ("Punch");
}
if (Input.GetButtonDown ("Fire2"))
{
animator.SetTrigger ("Shooting1Hand"); // plays shoot animation when spell button is pressed
}
}
Any help would be much appreciated!