/// <summary> /// Coroutine that checks if the orb is active or not, and changes the weapon depending on this /// </summary> /// <param name="hOrb"></param> /// <returns></returns> IEnumerator CoroutineChangeWeaponViaORb(M_GravityOrb hOrb) { if (bSwitchWeaponWhenAttraction) { ChangeWeapon(true, 1); } Debug.LogWarning("Penser à résoudre le bug de timing de la gravity orb"); yield return(new WaitForSecondsRealtime((hOrb.fTimeBeforeHold + hOrb.fLockTime) * 2.2f)); if (bSwitchWeaponWhenAttraction) { ChangeWeapon(true, 0); } if (bSwitchWeaponWhenZeroG) { ChangeWeapon(true, 1); } yield return(new WaitForSecondsRealtime(hOrb.tFloatTime)); if (bSwitchWeaponWhenZeroG) { ChangeWeapon(true, 0); } yield break; }
/// <summary> /// Starts the coroutine that manages the weapon switch by looking at the GravityOrb /// </summary> /// <param name="hOrb"></param> public void InitCoroutineChangeWeaponViaORb(M_GravityOrb hOrb) { StartCoroutine(CoroutineChangeWeaponViaORb(hOrb)); }