public void SetNextGun(WeaponList nextWeapon_) { // Don't continue if a gun is not already ready if (currentWeaponState != CurrentWeaponState.WeaponInUse) { print("RETURN - Not 'WeaponInUse': " + currentWeaponState.ToString()); return; } // Don't run if they're the same weapon already if (nextWeapon_ == CurrentWeapon) { print("RETURN - Same Weapon': " + nextWeapon_.ToString()); return; } // Tell current weapon to change state to 'Disable' if (CurrentWeapon == WeaponList.Shotgun) { shotgun.WeaponState = WeaponState.Disable; } else if (CurrentWeapon == WeaponList.StaticGun) { staticGun.WeaponState = WeaponState.Disable; } // Set Current Weapon PrevWeapon = CurrentWeapon; CurrentWeapon = nextWeapon_; // Set CurrentWeaponState to 'waiting currentWeaponState = CurrentWeaponState.WeaponInUse; }
private void Update() { // Current Weapon Listener if (currentWeaponState == CurrentWeaponState.ResponseReceived) { // Activate next weapon if (CurrentWeapon == WeaponList.Shotgun) { shotgun.WeaponState = WeaponState.Enable; } else if (CurrentWeapon == WeaponList.StaticGun) { staticGun.WeaponState = WeaponState.Enable; } currentWeaponState = CurrentWeaponState.WeaponInUse; } // Show Weapon Icons ShowWeaponIconAlpha(WeaponHUDState); // Weapon HUD Wheel if (WeaponHUDState) { #region Set HUD Alpha // If HUD is less than 1.0f, increase if (HUDBackgroundAlpha < 1.0f) { // Temporary float so we're not changing the object a bunch float temp_ = HUDBackgroundAlpha; // Fade in HUD temp_ += Time.deltaTime * 10f; // Cap if (temp_ > 1.0f) { temp_ = 1.0f; } // Assign HUDBackgroundAlpha = temp_; } #endregion } else { if (HUDBackgroundAlpha > 0f) { // Temporary float so we're not changing the object a bunch float temp_ = HUDBackgroundAlpha; // Fade out HUD temp_ -= Time.deltaTime * 10f; // Cap if (temp_ < 0f) { temp_ = 0f; } // Assign HUDBackgroundAlpha = temp_; } } }
public void ReadyForNextWeapon() { currentWeaponState = CurrentWeaponState.ResponseReceived; }