private void MoveHighlight(Vector2 dir) { Vector2 newSelection = currentSelection + dir; if (actions.ContainsKey(newSelection)) { actions [currentSelection].SetHighlight(false); CombatActionController newAction = actions [newSelection]; newAction.SetHighlight(true); currentAction = newAction.action; currentSelection = newSelection; soundManager.PlayMenuItemSwitch(); } }
public void DisplaySelector() { if (soundManager == null) { soundManager = FindObjectOfType(typeof(SoundManager)) as SoundManager; } soundManager.PlayMenuOpen(); // first empty the dictionary, and fill it up with the currently available actions actions = new Dictionary <Vector2, CombatActionController> (); if (sheet.CanAttack()) { actions.Add(new Vector2(0f, 1f), attack); attack.SetAvailable(true); } else { attack.SetAvailable(false); } if (sheet.CanFullDefense()) { actions.Add(new Vector2(-1f, 1f), fullDefense); fullDefense.SetAvailable(true); } else { fullDefense.SetAvailable(false); } if (sheet.CanCastSpell()) { actions.Add(new Vector2(1f, 0f), castSpell); castSpell.SetAvailable(true); } else { castSpell.SetAvailable(false); } if (sheet.CanUseItem()) { actions.Add(new Vector2(0f, -1f), useItem); useItem.SetAvailable(true); } else { useItem.SetAvailable(false); } actions.Add(new Vector2(0f, 0f), cancel); cancel.SetHighlight(true); actions.Add(new Vector2(-1f, 0f), endTurn); endTurn.SetHighlight(false); currentSelection = new Vector2(0f, 0f); currentAction = Helpers.CombatAction.Cancel; // set self to active ignoreFirstClick = true; gameObject.SetActive(true); actionIconHolder.SetActive(true); }