You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
im trying to add a delay to an IEnumerator (not a IEnumerator btw) and im unable to add a delay to it ive tried many diffrent ways to do it. ive thought about using an transplier but i could find how i would add a delay and do what i need to do with it.
no where in the docs does it give an example of how to do it as a prefix only a post fix if you cant do it as a prefix like that i would suggest adding that to the docs as i couldnt find anywhere that said that.
privatestaticreadonlyWaitForSecondsDelay=new WaitForSeconds(delay);[HarmonyPrefix][HarmonyPatch(nameof(PlayerControllerB.PlayerJump))]privatestatic IEnumerator MyWrapper(PlayerControllerB__instance,IEnumerator__result){//Run prefix?yieldreturnDelay;InputActionJump= GetJump();if(Jump.IsInProgress()&& Jump.IsPressed())//performed == on button up{// Run original enumerator codewhile(__result.MoveNext()){yieldreturn __result.Current;}}else{
__instance.isCrouching =true;}// Run your postfix}[HarmonyPrefix][HarmonyPatch(nameof(PlayerControllerB.PlayerJump))]publicstatic IEnumerator _Prefix_PlayerJump(PlayerControllerB__instance,IEnumerator__results){yieldreturnDelay;InputActionJump= GetJump();if(!Jump.IsInProgress()||!Jump.IsPressed())//performed == on button up{
__instance.isCrouching =true;}yieldreturn__results;}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
im trying to add a delay to an IEnumerator (not a IEnumerator btw) and im unable to add a delay to it ive tried many diffrent ways to do it. ive thought about using an transplier but i could find how i would add a delay and do what i need to do with it.
no where in the docs does it give an example of how to do it as a prefix only a post fix if you cant do it as a prefix like that i would suggest adding that to the docs as i couldnt find anywhere that said that.
Beta Was this translation helpful? Give feedback.
All reactions