private TimeWarpUserState SaveNewState(Account account, DateTime time, TimeWarpState timeWarpState, int agentType)
        {
            var updatedState = new TimeWarpUserState(account, timeWarpState, time, TimeSpan.Zero, 0.0, agentType);

            _userStateRepository.Add(updatedState);
            return(updatedState);
        }
        public bool TryGetCurrentState(long accountId, DateTime time, out TimeWarpUserState timeWarpUserState)
        {
            var currentState = _userStateRepository.GetLatestStateByAccountId(accountId);

            if (currentState == null)
            {
                timeWarpUserState = null;
                return(false);
            }
            timeWarpUserState = _timeWarpStateCalculator.RecalculateTimeWarpState(currentState, time);
            return(true);
        }
Beispiel #3
0
 public TimeWarpUserState StartRest(DateTime time)
 {
     _timeWarpUserState = new TimeWarpUserState(Account, TimeWarpState.Resting, time, TimeSpan.Zero, 0.0);
     return(_timeWarpUserState);
 }
Beispiel #4
0
 public TimeWarpUser(TimeWarpUserState state, ITimeWarpStateCalculator timeWarpStateCalculator)
 {
     Account = state.Account;
     _timeWarpStateCalculator = timeWarpStateCalculator;
     _timeWarpUserState       = state;
 }