void MakeMove(ComboKeys key) { madeMove = true; foreach (PlayerAction ac in repertoire.actions) { if (ac.HandleKey(key)) { PerformAction(ac); continue; } } }
public bool HandleKey(ComboKeys key) { if (comboKeys[consecutive] == key) { consecutive++; } else { consecutive = 0; } return(consecutive >= comboKeys.Count); }
public static KeyCode ToKeyCode(ComboKeys comboKeys) { Dictionary <ComboKeys, KeyCode> conversion = new Dictionary <ComboKeys, KeyCode>() { { ComboKeys.I, KeyCode.I }, { ComboKeys.J, KeyCode.J }, { ComboKeys.K, KeyCode.K }, { ComboKeys.L, KeyCode.L }, { ComboKeys.W, KeyCode.W }, { ComboKeys.A, KeyCode.A }, { ComboKeys.S, KeyCode.S }, { ComboKeys.D, KeyCode.D } }; return(conversion[comboKeys]); }
private void AddComboToQueue(ComboKeys comboType) { if (tooltipActive) { return; } comboHistroy.Enqueue(comboType); if (comboHistroy.Count > 10) { comboHistroy.Dequeue(); Destroy(targetUIPanel.GetChild(0).gameObject); } GameObject arrowPrefab = null; switch (comboType) { case ComboKeys.UP: arrowPrefab = upArrow; break; case ComboKeys.DOWN: arrowPrefab = downArrow; break; case ComboKeys.LEFT: arrowPrefab = leftArrow; break; case ComboKeys.RIGHT: arrowPrefab = rightArrow; break; } Instantiate(arrowPrefab, targetUIPanel); }