예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public TimeWarpUserState StartRest(DateTime time)
 {
     _timeWarpUserState = new TimeWarpUserState(Account, TimeWarpState.Resting, time, TimeSpan.Zero, 0.0);
     return(_timeWarpUserState);
 }
예제 #4
0
 public TimeWarpUser(TimeWarpUserState state, ITimeWarpStateCalculator timeWarpStateCalculator)
 {
     Account = state.Account;
     _timeWarpStateCalculator = timeWarpStateCalculator;
     _timeWarpUserState       = state;
 }