playMaker

Author Topic: Get Time Info--Saving Time In Current State additively?  (Read 1668 times)

OnyxRook

  • Playmaker Newbie
  • *
  • Posts: 7
Get Time Info--Saving Time In Current State additively?
« on: April 25, 2015, 04:17:42 AM »
Hey guys,

Got a bit of a stubborn challenge I'm trying to work though!

Core feature: Record the total time a player is standing still throughout the game.

I've got this most of the way figured out. I've got my 'moving' and 'not moving' states working wonderfully, and I discovered Get Time Info, which does 90% of what I need. It has a Get Info of 'Time In Current State', which records how long the state is active (clearly), but it resets whenever I exit the state (well--it resets when I re-enter the state. On exit it saves the float value).

Can anyone think of a way to get this working additively? So rather than resetting the float every time the state is re-entered, it sort of...picks up where it left off? Like pausing a stopwatch rather than clearing it.

Thoughts much appreciated!  ;D

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: Get Time Info--Saving Time In Current State additively?
« Reply #1 on: April 25, 2015, 06:45:34 PM »
As soon as you leave the "not moving" state, you can have an extra state add your time info value to another float variable that keeps track of the total accumulated time. That way, when you re-enter the "not moving" state (and the Get Info resets and start timing from scratch), you will still have the total time in the other float - and so on.

/Bad
The Force is with you, young Playmaker – but you are not a C# senpai yet.