That is an attention-grabbing query I’ve, so I ask you to listen to me out. No, I am not simply going to ask “how do I do that” and hope somebody will give me code.
I have been programming for a very long time and am starting work on a side-project, a text-based recreation.
With out going into particulars, the sport wants instructions (a Console.ReadLine()
type of scenario) but additionally wants timer-based programs (say, as an example, lowering a variable vitality
each 10 seconds)
I’ve racked my mind about how you can accomplish this, however got here up empty handed.
My finest guess is utilizing asynchronous capabilities however I do not totally perceive these and so they do not appear to be they are going to accomplish what I am after.
TL;DR I would like to have the ability to use Console.ReadLine()
and likewise improve/lower a variable each n
milliseconds (even whereas ready for the console enter).
I feel threading is likely to be a strategy to do it, however that appears extreme for a [relatively] easy usecase.
Can anybody present perception about how you can accomplish this?
Thanks upfront.