示例#1
0
 public GameContext(TimeContext timeContext)
 {
     StateService.Instance.SetStateTo <NotAGameState>(this);
     if (timeContext == null)
     {
         throw new ArgumentException("TimeContext could not be null");
     }
     this.TimeContext = timeContext;
     GameProperties   = timeContext.GameProperties;
 }
示例#2
0
 public void goNext(TimeContext context)
 {
     if (context.TimeCount != 0)
     {
         StateService.Instance.SetStateTo <TimeInProgressState>(context);
     }
     else
     {
         StateService.Instance.SetStateTo <TimeLimboState>(context);
     }
 }
示例#3
0
 public void goNext(TimeContext context)
 {
     disActivateSupervisors(context.GameProperties);
     TimeService.Instance.PauseTimer.CallAfter(() =>
     {
         context.CurrentTimeInc();
         if (context.CurrentTime <= context.TimeCount)
         {
             StateService.Instance.SetStateTo <TimeInProgressState>(context);
         }
         else
         {
             StateService.Instance.SetStateTo <TimeLimboState>(context);
         }
     });
     TimeService.Instance.PauseTimer.Start();
 }
示例#4
0
 public void goNext(TimeContext context)
 {
 }
示例#5
0
 public void goNext(TimeContext context)
 {
     activateSupervisors(context.GameProperties);
     TimeService.Instance.GameTimer.CallAfter(() => StateService.Instance.SetStateTo <TimeEndedState>(context));
     TimeService.Instance.GameTimer.Start();
 }
示例#6
0
        public void SetStateTo <S>(TimeContext context) where S : ITimeState
        {
            var state = State <S>();

            context.CurrentTimeState = state;
        }