private IEnumerator BulletCamAdditionalBullets(Enemy sender) { yield return(new WaitForSeconds(2.0f)); canShootAdditionalBullet = false; base.OnBulletCamEnd(sender); CurrentSniperPanel.SetActive(true); OnReload(); ViewingScope = false; sldZoom.value = sldZoom.maxValue; }
/// <summary> /// Called when the action camera vfx are completed. /// Here, we reset the ui panel, as well as resume reload checks /// </summary> protected override void OnActionCamEnd() { base.OnActionCamEnd(); if (waitingForEndOfActionCam) { if (ViewingScope) { CurrentSniperPanel.SetActive(true); } IsUserControllable = true; waitingForEndOfActionCam = false; PreReloadActions(); } }
private IEnumerator ReloadDelay() { float yieldTime = isFocusing ? 1f : .5f; if (ViewingScope) { Recoil(yieldTime, InitialRecoilSpeed); } yield return(new WaitForSeconds(yieldTime)); //See the shot first //This fixes the bullet cam transition. CurrentSniperPanel.SetActive(true); if (ViewingScope) { ViewingScope = false; isFocusingEnding = true; } IsFiring = false; isReloading = true; yield return(new WaitForSeconds(ReloadTime)); isFocusingEnding = false; currentAmmo = AmmoPerClip; isReloading = false; if (wasInScopeBeforeReloading) { ViewingScope = true; //Extra delay for the transition yield return(new WaitForSeconds(0.5f)); } fireButton.interactable = true; sldZoom.interactable = true; //This is a hacky way to a fix a unity bug with this button. EventSystem.current.SetSelectedGameObject(fireButton.gameObject); EventSystem.current.SetSelectedGameObject(null); }
public override void OnFireBegin() { if (isReloading || isMiniReloading) { return; } base.OnFireBegin(); currentAmmo--; UpdateFireButtonGraphics(); //Regardless of scope mode, determine if we hit an enemy bool hitEnemy; if (ViewingScope) { hitEnemy = FireFromUIScopeWithBullet(); } else { hitEnemy = FireCenteredWithBullet(); } //If we did hit an enemy, hide the main ui panel if (hitEnemy) { if (ViewingScope) { CurrentSniperPanel.SetActive(false); } IsUserControllable = false; waitingForEndOfActionCam = true; return; } //Otherwise, perform typical reload checks PreReloadActions(); }