public static InputCommands SetScrapingType(InputCommands inputCommands) { var commands = inputCommands; var data = inputCommands.Data; if (data == "1") { commands.SourceType = WebsiteSourceType.Olx; } if (data == "2") { commands.SourceType = WebsiteSourceType.Ozone; } if (data == "3") { commands.SourceType = WebsiteSourceType.Technomarket; } if (data == "4") { commands.SourceType = WebsiteSourceType.Technopolis; } return(commands); }
public async void Send() { await PerformNetworkOperation(async() => { var queryString = String.Empty; foreach (var param in InputCommandParameters) { if (!String.IsNullOrEmpty(queryString)) { queryString += "&"; } queryString += param.ToQueryStringPair(); } var client = new HttpClient(); var endPoint = _inputCommandEndPoints.Where(inp => inp.InputCommand.Key == SelectedInputCommand.Key).FirstOrDefault(); if (endPoint != null) { var uri = String.IsNullOrEmpty(queryString) ? endPoint.EndPoint : $"{endPoint.EndPoint}?{queryString}"; var result = await client.GetAsync(uri); if (!result.IsSuccessStatusCode) { await Popups.ShowAsync(result.ReasonPhrase + $" ({result.StatusCode})"); } } }); SelectedInputCommand = InputCommands.FirstOrDefault(); DeviceStatusVisible = true; InputCommandVisible = false; }
public override bool ConditionMatched(InputCommands inputCommands) { bool changedPosition = inputCommands.mouse.IsAvailable && inputCommands.mouse.Position != lastPosition && lastPosition != UnusedPosition; lastPosition = inputCommands.mouse.Position; return changedPosition; }
public void Validate(ValidationResult result) { if (Timers == null) { Timers = new List <Timer>(); } if (Inputs.Select(param => param.Key).Distinct().Count() != Inputs.Count()) { result.AddUserError("Duplicate Keys found on Inputs."); } if (Attributes.Select(param => param.Key).Distinct().Count() != Attributes.Count()) { result.AddUserError("Duplicate Keys found on Attributes."); } if (InputCommands.Select(param => param.Key).Distinct().Count() != InputCommands.Count()) { result.AddUserError("Duplicate Keys found on Input Commands."); } if (StateMachines.Select(param => param.Key).Distinct().Count() != StateMachines.Count()) { result.AddUserError("Duplicate Keys found on State Machines."); } if (OutputCommands.Select(param => param.Key).Distinct().Count() != OutputCommands.Count()) { result.AddUserError("Duplicate Keys found on Output Commands."); } if (Timers.Select(param => param.Key).Distinct().Count() != Timers.Count()) { result.AddUserError("Duplicate Keys found on Timers."); } foreach (var input in Inputs) { input.Validate(this, result); } foreach (var attribute in Attributes) { attribute.Validate(this, result); } foreach (var inputCommand in InputCommands) { inputCommand.Validate(this, result); } foreach (var stateMachine in StateMachines) { stateMachine.Validate(this, result); } foreach (var outputCommand in OutputCommands) { outputCommand.Validate(this, result); } foreach (var timer in Timers) { timer.Validate(this, result); } }
public void StartCore(string filePath, Corel.Interop.VGCore.Application corelApp) { if (corelApp != null) { InCorel = true; CorelAutomation = new CorelAutomation(corelApp, this); this.app = corelApp; corelApp.OnApplicationEvent += CorelApp_OnApplicationEvent; } FileInfo file = null; try { FileInfo fileOri = new FileInfo(filePath); Title = filePath; try { if (!Directory.Exists(workerFolder)) { Directory.CreateDirectory(workerFolder); } } catch (IOException ioE) { if (ErrorFound != null) { ErrorFound("Erro - " + ioE.Message); } return; } string newPath = workerFolder + "\\" + fileOri.Name; if (File.Exists(newPath)) { File.Delete(newPath); } file = fileOri.CopyTo(newPath); } catch (IOException ioErro) { if (ErrorFound != null) { ErrorFound("Erro - " + ioErro.Message); } return; } inputCommands = new InputCommands(this); commands = (typeof(InputCommands)).GetMethods(BindingFlags.Public | BindingFlags.Instance); xmlDecoder = new XMLDecoder(); xmlDecoder.LoadFinish += XmlDecoder_LoadFinish; Thread thread = new Thread(new ParameterizedThreadStart(LoadFile)); thread.IsBackground = true; thread.Start(file); }
protected T FirstFromEndAttackInput(int totalInputs) { for (int i = totalInputs - 1; i >= 0; i--) { if (InputCommands.IsAttackCommand(latestInputs[i].InputCommand)) { return(latestInputs[i]); } } return(null); }
private void OnReceivedPantsStatus(InputCommands status) { switch (status) { case InputCommands.DeviceConnected: PantsState = DeviceState.Initializing; break; case InputCommands.DeviceDisconnected: PantsState = DeviceState.Disconnected; break; case InputCommands.CalibrationStarted: PantsState = DeviceState.Calibrating; break; case InputCommands.CalibrationFinished: Disconnect(); break; case InputCommands.ResetOrientation: ResetFullBodyBaseOrientation(); break; case InputCommands.ErrorCalibrationFailed: PantsState = DeviceState.Connected; RaisePantsErrorEvent(DeviceError.CalibrationFailed); Debug.LogError(name + ": Device 'Pants' failed to calibrate!"); break; case InputCommands.ErrorNoCalibration: PantsState = DeviceState.Connected; RaisePantsErrorEvent(DeviceError.NoCalibration); Debug.LogError(name + ": Device 'Pants' isn't calibrated. Please calibrate."); break; case InputCommands.ErrorNoShirtPants: PantsState = DeviceState.Connected; RaisePantsErrorEvent(DeviceError.UnknownDevice); Debug.LogError(name + ": Attempted to connect unknown device. Defaulting to 'Shirt'. Please fix this with the firmware update tools."); break; } }
public void BeginWaitForInput() { var commandMapper = new CommandMapper(); InputCommands commands = null; var consoleMessages = new ConsoleMesseges(); IWebsiteSourceAdapter scraperSource = null; IEnumerable <ScrapingResults> results = null; consoleMessages.DisplayHelp(); while (true) { Console.Write("> "); try { string input = Console.ReadLine(); commands = InputParser.ParseInputCommands(input); InputParser.ValidateInput(commands); if (commands.Action is "mount" && commands.Data is not null) { commands = InputParser.SetScrapingType(commands); scraperSource = commandMapper.MapScrapeToSource(commands); } else if (commands.Action is "begin" && commands.Data is "now") { if (scraperSource is not null) { Print <ScrapingResults> .Info("Be patient data is being loaded..."); results = scraperSource.InitiateScraping(); Print <ScrapingResults> .Table(results); Print <ScrapingResults> .Success("Data loaded"); Console.WriteLine(); } else { throw new Exception("First mount a scraper"); } }
public LabelsEditorControl() { InitializeComponent(); InputCommands.Stub(this); _flipper = new Flipper(TimeSpan.FromMilliseconds(400), CheckExistingLabel); // If labels are updated from elsewhere in the message we are currently viewing // (and we are not the one causing the updated), rebuild the labels subscription = EventBroker.Subscribe(AppEvents.MessageLabelsUpdated, (Message message) => Thread.CurrentThread.ExecuteOnUIThread(delegate { if (message == Message && !Editor.IsFocused) { Reset(); } })); }
public void AccumulateInputsToBePlayedOnServerFromClient(InputCommands inputCommands) { if (inputCommands.sequenceNumber > playerSequenceNumberProcessed) { InputCommands dataPackage; if (inputUpdatesFromClientToServerDic.TryGetValue(inputCommands.sequenceNumber, out dataPackage)) { //Debug.Log("<color=orange>dataPackage already exists for sequence no. </color>" + dataPackage.sequenceNumber); } else { //Debug.Log("<color=green>Added successfully to processing buffer dic </color>" + inputCommands.sequenceNumber+" processed sequence number: "+playerSequenceNumberProcessed); inputUpdatesFromClientToServerDic.Add(inputCommands.sequenceNumber, inputCommands); } } else { //Debug.Log("<color=red>Already processed this sequence no </color>" + playerSequenceNumberProcessed); } }
public IWebsiteSourceAdapter MapScrapeToSource(InputCommands inputCommands) { IWebsiteSourceAdapter websiteSourceAdapter; Print <ScrapingResults> .Info($"Setting source for scraping"); if (inputCommands.SourceType == WebsiteSourceType.Olx) { Print <ScrapingResults> .Success($"Source set to {inputCommands.SourceType.ToString()} waiting for command [begin] [scrape]"); websiteSourceAdapter = new OlxWebsiteSourceAdapter(); return(websiteSourceAdapter); } if (inputCommands.SourceType == WebsiteSourceType.Ozone) { Print <ScrapingResults> .Success($"Source set to {inputCommands.SourceType.ToString()} waiting for command [begin] [scrape]"); websiteSourceAdapter = new OzoneWebsiteSourceAdapter(); return(websiteSourceAdapter); } if (inputCommands.SourceType == WebsiteSourceType.Technomarket) { Print <ScrapingResults> .Success($"Source set to {inputCommands.SourceType.ToString()} waiting for command [begin] [scrape]"); websiteSourceAdapter = new TechnomarketWebsiteSourceAdapter(); return(websiteSourceAdapter); } if (inputCommands.SourceType == WebsiteSourceType.Technopolis) { Print <ScrapingResults> .Success($"Source set to {inputCommands.SourceType.ToString()} waiting for command [begin] [scrape]"); websiteSourceAdapter = new TechnopolisWebisteSourceAdapter(); return(websiteSourceAdapter); } return(null); }
private static InputCommands SplitCommands(string input) { try { var inputArray = input.Split(); var action = inputArray[0].ToLower(); var data = inputArray[1].ToLower(); var commands = new InputCommands() { Action = action, Data = data }; return(commands); } catch { throw new Exception("input not in right format should be - [action] [data]"); } }
private void InputCommand_Changed(InputCommands command) { switch (command) { case InputCommands.NextCommand: GotoNextPart(); break; case InputCommands.PreviousCommand: break; case InputCommands.DeleteCommand: break; case InputCommands.Backspace: ExecuteBackspace(); break; case InputCommands.SerializeCommand: SerializeEquations(); break; case InputCommands.DeserializeCommand: DeserializeEquation(); break; case InputCommands.MoveLeft: MoveCaretLeft(); break; case InputCommands.MoveRight: MoveCaretRight(); break; default: break; } }
public static void ValidateInput(InputCommands inputCommands) { var action = inputCommands.Action; var data = inputCommands.Data; if (string.IsNullOrEmpty(action)) { throw new Exception(typeof(InputCommands).GetProperties()[0].ToString()); } if (string.IsNullOrEmpty(data)) { throw new Exception(typeof(InputCommands).GetProperties()[1].ToString()); } if (string.IsNullOrWhiteSpace(action)) { throw new Exception(typeof(InputCommands).GetProperties()[0].ToString()); } if (string.IsNullOrWhiteSpace(data)) { throw new Exception(typeof(InputCommands).GetProperties()[1].ToString()); } }
public RecipientsEditorControl() { InitializeComponent(); InputCommands.Stub(this); mailbox = VirtualMailBox.VirtualMailBox.Current; recipients = new AdvancedObservableCollection <SourceAddress>(); wordFlipper = new Flipper(TimeSpan.FromMilliseconds(400), ProcessCurrentWord); autocompleteFlipper = new Flipper(TimeSpan.FromMilliseconds(500), SearchContacts); // Default the validation is enabled ValidationEnabled = true; DataContext = this; var channel = ChannelsManager.GetDefaultChannel(); if (channel != null) { TargetChannel = channel; } }
public void AddTouchCallback() { var input = new InputCommands(null, null, null, null); input.Add(touch => {}); Assert.AreEqual(1, input.Count); }
public void CancelSend() { SelectedInputCommand = InputCommands.FirstOrDefault(); DeviceStatusVisible = true; InputCommandVisible = false; }
private void FixedUpdate() { serverInstanceHero.ProcessAuthoratativeEvents(); for (int i = 0; i < (int)currentInputProcessingModeOnServer; i++) { CheckForPushRequestOnServer(playerSequenceNumberProcessed + 1); CheckForPlaceBoulderRequestOnServer(playerSequenceNumberProcessed + 1); CheckForRemovingBoulderRequestOnServer(playerSequenceNumberProcessed + 1); CheckForPetrificationRequestOnPlayer(playerSequenceNumberProcessed + 1); InputCommands inputPackageCorrespondingToSeq; if (inputUpdatesFromClientToServerDic.TryGetValue(playerSequenceNumberProcessed + 1, out inputPackageCorrespondingToSeq)) { inputUpdatesFromClientToServerDic.Remove(inputPackageCorrespondingToSeq.sequenceNumber); latestPlayerInputPackage = inputPackageCorrespondingToSeq; playerSequenceNumberProcessed = inputPackageCorrespondingToSeq.sequenceNumber; serverInstanceHero.ProcessMovementInputs(inputPackageCorrespondingToSeq.commands , inputPackageCorrespondingToSeq.previousCommands); serverInstanceHero.ProcessEventsInputs(inputPackageCorrespondingToSeq.commands, inputPackageCorrespondingToSeq.previousCommands); serverInstanceHero.ProcessAnimationsInputs(inputPackageCorrespondingToSeq.commands, inputPackageCorrespondingToSeq.previousCommands); serverInstanceHero.ProcessInputMovementsControl(); serverInstanceHero.ProcessInputEventControl(); serverInstanceHero.ProcessInputAnimationControl(); //Debug.Log(serverInstanceHero.movePoint.position + "Block pos "+serverInstanceHero.GetBlockPosition()+"<color=yellow>Processing seqence no </color>" + inputPackageCorrespondingToSeq.sequenceNumber + "<color=green>position </color>" + serverInstanceHero.actorTransform.position + "<color=green>inputs </color>" + inputPackageCorrespondingToSeq.commands[0] + inputPackageCorrespondingToSeq.commands[1] + inputPackageCorrespondingToSeq.commands[2] + inputPackageCorrespondingToSeq.commands[3]+" Previous Commands "+ inputPackageCorrespondingToSeq.previousCommands[0] + inputPackageCorrespondingToSeq.previousCommands[1] + inputPackageCorrespondingToSeq.previousCommands[2] + inputPackageCorrespondingToSeq.previousCommands[3]); } else { if (latestPlayerInputPackage.sequenceNumber != 0) { //Debug.LogError("Could not find any inputToProcess for seq: " + (sequenceNumberProcessed + 1)); playerSequenceNumberProcessed = playerSequenceNumberProcessed + 1; serverInstanceHero.ProcessMovementInputs(latestPlayerInputPackage.commands , latestPlayerInputPackage.previousCommands); serverInstanceHero.ProcessEventsInputs(latestPlayerInputPackage.commands, latestPlayerInputPackage.previousCommands); serverInstanceHero.ProcessAnimationsInputs(latestPlayerInputPackage.commands, latestPlayerInputPackage.previousCommands); serverInstanceHero.ProcessInputMovementsControl(); serverInstanceHero.ProcessInputEventControl(); serverInstanceHero.ProcessInputAnimationControl(); } } } serverLocalSequenceNumber++; //////Debug.Log("<color=blue>inputsequence </color>"+ playerMovingCommandSequenceNumber + "<color=blue>inputs </color> "+ inputs[0]+" "+inputs[1]+" "+inputs[2]+" "+inputs[3]); PlayerAuthoratativeStates playerAuthoratativeStates = new PlayerAuthoratativeStates(serverInstanceHero.isPetrified, serverInstanceHero.isPushed); PositionUpdates positionUpdates = new PositionUpdates(serverInstanceHero.actorTransform.position, serverInstanceHero.currentMovePointCellPosition, serverInstanceHero.previousMovePointCellPosition); PlayerEvents playerEvents = new PlayerEvents(serverInstanceHero.isFiringPrimaryProjectile); PlayerAnimationEvents playerAnimationEvents = new PlayerAnimationEvents(serverInstanceHero.primaryMoveUseAnimationAction.isBeingUsed, serverInstanceHero.isPlacingBoulderAnimationPlayed); PlayerStateUpdates playerStateUpdates = new PlayerStateUpdates(serverLocalSequenceNumber, playerSequenceNumberProcessed, playerAuthoratativeStates, positionUpdates, playerEvents, playerAnimationEvents); PlayerStateServerUpdates playerStateServerUpdates = new PlayerStateServerUpdates(id, playerStateUpdates); //Debug.LogError("Server sequence number : "+ serverLocalSequenceNumber+" player sequence number processeed: "+ playerSequenceNumberProcessed+" player position : "+serverInstanceHero.actorTransform.position); playerStateListOnServer.Add(playerStateServerUpdates); if (playerStateListOnServer.Count >= snapShotsInOnePacket) { if (previousPlayerUpdatedStatePacks.Count > packetHistorySize) { previousPlayerUpdatedStatePacks.RemoveAt(0); } ServerSend.PlayerStateSend(playerStateListOnServer, previousPlayerUpdatedStatePacks); previousPlayerUpdatedStatePacks.Add(new PreviousPlayerUpdatedStatePacks(playerStateListOnServer.ToArray())); playerStateListOnServer.Clear(); //Debug.Log("<color=red>--------------------------------------------------------------------</color>"); } UpdateClientInputsProcessMode(); snapShotBufferSize = GetTheLastestSequenceNoInDic() - playerSequenceNumberProcessed; //Debug.Log("<color=cyan>Dic Count </color>"+inputUpdatesFromClientToServerDic.Count); }
public abstract bool ConditionMatched(InputCommands inputCommands);
public static async void ExecuteAction(InputCommands command) { await ConnectionManager.ExecuteRPCRequest("Input." + command.ToString()); }
public static async Task ExecuteAction(InputCommands command) { await ConnectionManager.ExecuteRPCRequest("Input." + command.ToString()); }
// Compare command against read input public bool GetInput(InputCommands inputToCheck) { InputCommands scancode = InputCommands.INPUT_NONE; // Put in checks for all applicable keys here. if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W)) { if (debugMode) { Debug.Log("Moving up."); } scancode = InputCommands.MOVE_JUMP; } if (Input.GetKeyDown(KeyCode.LeftArrow)) { if (debugMode) { Debug.Log("Moving left."); } scancode = InputCommands.MOVE_LEFT; } if (Input.GetKeyDown(KeyCode.RightArrow)) { if (debugMode) { Debug.Log("Moving right."); } scancode = InputCommands.MOVE_RIGHT; } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.DownArrow)) { if (debugMode) { Debug.Log("Shhh! Sneaking..."); } scancode = InputCommands.MODE_SNEAK; } if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { if (debugMode) { Debug.Log("Running!"); } scancode = InputCommands.MODE_RUN; } if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift) || Input.GetKeyUp(KeyCode.LeftControl) || Input.GetKeyUp(KeyCode.RightControl) || Input.GetKeyUp(KeyCode.DownArrow)) { if (debugMode) { Debug.Log("Walking."); } scancode = InputCommands.MODE_WALK; } if (Input.GetMouseButtonDown(0)) { if (debugMode) { Debug.Log("Firing."); } scancode = InputCommands.ACTION_FIRE; } // Gives us a readout on the inspector currentInput = scancode; // This compares the input against the command being checked if (scancode == inputToCheck) { return(true); } // Debug.Log ("Assigning None to input controller."); scancode = InputCommands.INPUT_NONE; return(false); }
private void Update() { input = GetKeyboardValue(Time.deltaTime); }
private void Update() { input = GetKeyboardValue(); }
public void Bind(Keys key, int playerId, InputCommands command) { bindings.Add(key, new InputBinding(playerId, command)); }
public InputBinding(int playerId, InputCommands command) { this.playerId = playerId; this.command = command; }
private void CheckKeyboard() { InputCommands command = Manager.GetUserCommand(); if (commandSystem.IsPlayerTurn) { switch (command) { case InputCommands.None: return; case InputCommands.UpLeft: Player.MovesCompleted += commandSystem.MovePlayer(Direction.UpLeft); break; case InputCommands.Up: Player.MovesCompleted += commandSystem.MovePlayer(Direction.Up); break; case InputCommands.UpRight: Player.MovesCompleted += commandSystem.MovePlayer(Direction.UpRight); break; case InputCommands.Left: Player.MovesCompleted += commandSystem.MovePlayer(Direction.Left); break; case InputCommands.Right: Player.MovesCompleted += commandSystem.MovePlayer(Direction.Right); break; case InputCommands.DownLeft: Player.MovesCompleted += commandSystem.MovePlayer(Direction.DownLeft); break; case InputCommands.Down: Player.MovesCompleted += commandSystem.MovePlayer(Direction.Down); break; case InputCommands.DownRight: Player.MovesCompleted += commandSystem.MovePlayer(Direction.DownRight); break; case InputCommands.Wait: World.UpdatePlayerFieldOfView(Player); Player.MovesCompleted = Player.Moves; break; case InputCommands.Stairs: ConfirmStairs(); break; case InputCommands.CloseGame: SceneManager.LoadScene("MenuScene"); break; default: break; } if (Player.MovesCompleted >= Player.Moves) { renderRequired = true; commandSystem.EndPlayerTurn(); } else { renderRequired = true; } } else { commandSystem.ActivateMonsters(); renderRequired = true; } }
private void CheckKeyboard() { bool didPlayerAct = false; InputCommands command = rootConsole.GetUserCommand(); if (commandSystem.IsPlayerTurn) { switch (command) { case InputCommands.UpLeft: didPlayerAct = commandSystem.MovePlayer(Direction.UpLeft); break; case InputCommands.Up: didPlayerAct = commandSystem.MovePlayer(Direction.Up); break; case InputCommands.UpRight: didPlayerAct = commandSystem.MovePlayer(Direction.UpRight); break; case InputCommands.Left: didPlayerAct = commandSystem.MovePlayer(Direction.Left); break; case InputCommands.Right: didPlayerAct = commandSystem.MovePlayer(Direction.Right); break; case InputCommands.DownLeft: didPlayerAct = commandSystem.MovePlayer(Direction.DownLeft); break; case InputCommands.Down: didPlayerAct = commandSystem.MovePlayer(Direction.Down); break; case InputCommands.DownRight: didPlayerAct = commandSystem.MovePlayer(Direction.DownRight); break; case InputCommands.StairsDown: if (World.CanMoveDownToNextLevel()) { MoveMapLevelDown(); didPlayerAct = true; } break; case InputCommands.CloseGame: rootConsole.CloseApplication(); break; default: break; } if (didPlayerAct) { renderRequired = true; commandSystem.EndPlayerTurn(); } } else { commandSystem.ActivateMonsters(); renderRequired = true; } }
private void CheckKeyboard() { bool didPlayerAct = false; InputCommands command = rootConsole.GetUserCommand(); if (commandSystem.IsPlayerTurn) { if (command.ToString() != "None") { Debug.Log("KeyInput: '" + command.ToString() + "'"); } switch (command) { case InputCommands.UpLeft: didPlayerAct = commandSystem.MovePlayer(Direction.UpLeft); break; case InputCommands.Up: didPlayerAct = commandSystem.MovePlayer(Direction.Up); break; case InputCommands.UpRight: didPlayerAct = commandSystem.MovePlayer(Direction.UpRight); break; case InputCommands.Left: didPlayerAct = commandSystem.MovePlayer(Direction.Left); break; case InputCommands.Wait: didPlayerAct = true; break; case InputCommands.Right: didPlayerAct = commandSystem.MovePlayer(Direction.Right); break; case InputCommands.DownLeft: didPlayerAct = commandSystem.MovePlayer(Direction.DownLeft); break; case InputCommands.Down: didPlayerAct = commandSystem.MovePlayer(Direction.Down); break; case InputCommands.DownRight: didPlayerAct = commandSystem.MovePlayer(Direction.DownRight); break; case InputCommands.Inventory: UIController.ToggleInventoryVisibility(); didPlayerAct = true; break; case InputCommands.StairsDown: if (World.CanMoveDownToNextLevel()) { MoveMapLevelDown(); didPlayerAct = true; } break; case InputCommands.CloseGame: rootConsole.CloseApplication(); break; default: break; } if (didPlayerAct) { renderRequired = true; commandSystem.EndPlayerTurn(); } } else { commandSystem.ActivateMonsters(); renderRequired = true; } }
private async void fire(InputCommands command) { while (isHolding) { await Input.ExecuteAction(command); await Task.Delay(250); } }
private InputCommands GetKeyboardValue(float time) { elapsedTime += time; if (elapsedTime < delay) { return(InputCommands.None); } InputCommands command = InputCommands.None; if (Input.GetKey(KeyCode.Keypad1) || Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.Y)) { command = InputCommands.UpLeft; } else if (Input.GetKey(KeyCode.Keypad2) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.K)) { command = InputCommands.Up; } else if (Input.GetKey(KeyCode.Keypad3) || Input.GetKey(KeyCode.E) || Input.GetKey(KeyCode.U)) { command = InputCommands.UpRight; } else if (Input.GetKey(KeyCode.Keypad4) || Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.H)) { command = InputCommands.Left; } else if (Input.GetKey(KeyCode.Keypad6) || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.L)) { command = InputCommands.Right; } else if (Input.GetKey(KeyCode.Keypad7) || Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.B)) { command = InputCommands.DownLeft; } else if (Input.GetKey(KeyCode.Keypad8) || Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.J) || Input.GetKey(KeyCode.X)) { command = InputCommands.Down; } else if (Input.GetKey(KeyCode.Keypad9) || Input.GetKey(KeyCode.C) || Input.GetKey(KeyCode.N)) { command = InputCommands.DownRight; } else if (Input.GetKey(KeyCode.Keypad5) || Input.GetKey(KeyCode.Space)) { command = InputCommands.Wait; } else if (Input.GetKey(KeyCode.Period) || Input.GetKey(KeyCode.Comma) || Input.GetKey(KeyCode.Return)) { command = InputCommands.Stairs; } else if (Input.GetKey(KeyCode.Escape)) { command = InputCommands.CloseGame; } if (command != InputCommands.None) { elapsedTime = 0; } return(command); }