#Trigger Fear Coroutine
1 messages · Page 1 of 1 (latest)
Hello
chat is moving fast today
I don't actually use coroutines for anything yet, so I'm not sure I can help with that, but there are alternate solutions.
I'd like to hear your solution! :)
First off - I have some questions
let's say Player Sanity is 30 out of 100
or, enemy, was it
?
The player has a sanity meter yes
alright
so the player enters a trigger
a coroutine starts
it makes it so that every second your player was inside the trigger, it added +1 to currentSanity
Yes Thats what I would like but instead it adds 1 in a split second and gets to 100 under 1 second.
which is the error, yes
yes
gainFearFunction()
this one loops until i == maxSanity
adding 0.01 to currentSanity each time
which doesn't really make sense to me
so I will for now presume that function to be "wrong" and must be replaced
I'll write out an example I think will work
adding 0.01 was a test but I changed it back to adding 1.
thanks!
you're adding 1 x 100 times
that's why it goes up to that high
maybe just
yield return new WaitForSeconds(1);
vitalsController.currentSanity++;
yield return new WaitForSeconds(1);
try that
inside the for loop right?
no, where you recognize the top and bottom lines
it replaces the gainFeatFunction()
might need these as well
vitalsController.UpdateUI();
vitalsController.UpdatePPFX();
I putted it directly in the gainFear() Enmerator and it does add up 1 every 0.5 seconds now.
every half second?
I can see it counting but it does not count every second. I'll probaly have to play around with the WaitForSeconds