void FixedUpdate() { // Increments Timer for Reload if (reloadTimer > 0.0f) { reloadTimer -= Time.deltaTime; } // Input for Firing your Weapon if (Input.GetKeyDown(KeyCode.Mouse0) && reloadTimer <= 0.0f) { // Fires a different weapon based on your active weapon if (activeWeapon == "pistol") { if (bullets > 0) // Checks if you have bullets to fire { audio.playClip(0); // Pistol Fire sound effect reloadTimer = .25f; // Sets a short reload timer bullets -= 1; // Increments Bullet Counter ray.HitScanFire(); // Animation? } } else if (activeWeapon == "shotgun") { if (shells > 0) { audio.playClip(1); // Shotgun Fire sound effect reloadTimer = 0.8f; // Sets a reload timer shells -= 1; // Increments Bullet Counter // Animation } } } // Inputs to Change Weapons if (Input.GetKeyDown(KeyCode.Alpha1)) { UI.ActiveWeapon(0); // changes visual for active weapon audio.playClip(4); activeWeapon = "pistol"; // Animation } if (Input.GetKeyDown(KeyCode.Alpha2) && hasShotgun) { UI.ActiveWeapon(1); // changes visual for active weapon audio.playClip(5); activeWeapon = "shotgun"; // Animation } /* APPLIES MOVEMENT */ // thisRigidBody.velocity = inputVelocity * velocityModifier; /* UPDATES UI */ UI.PlayerUpdateUI(activeWeapon, bullets, bulletsMax, shells, shellsMax, health, healthMax, armor, ArmorMax); /*ANIMATION FOR HEAD BOBBING*/ // head_bobbing.speed = fpForwardBackward; }