public override Task OnRefreshState() { RaceStateCollection RSC = RaceClient.Instance.States; commonState = RSC.GetState <CommonState>(); creatorState = RSC.GetState <CreatorState>(); creatorState.PlaceCheckpoint.Observe( (state) => { checkpointState = state == true ? 1u : 0u; OnCheckpointStateChange(); } ); return(Wait(100)); }
public RaceClient() { Debug.WriteLine($"[{GetHashCode()}] Race Client has started"); Instance = this; Logger = new Logger( (message) => Debug.WriteLine(message), ChatHelper.SendMessage ); States = new RaceStateCollection(); States.SetState(new CommonState()); States.SetState(new CreatorState()); States.SetState(new DevToolboxState()); Commands = new RaceCommandCollection(Logger, (name, callback, restricted) => { RegisterCommand(name, callback, restricted); } ); new CreatorCommands(); new DevToolboxCommands(); Events = new RaceEventCollection( EventHandlers.Add, TriggerEvent, TriggerServerEvent ); new NotificationEvents(); new RaceEvents(); Workers = new RaceWorkerCollection( (task) => Tick += task, (time) => Delay(time) ); Workers.PushWorker(new CommonWorker()); Workers.PushWorker(new DevToolboxWorker()); Workers.PushWorker(new CreatorWorker()); }