private void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray inputRay = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(inputRay, out hit, Mathf.Infinity)) { CharacterSelector character = hit.collider.GetComponentInParent <CharacterSelector>(); if (character != null) { if (mSelectedCharacter != null) { mSelectedCharacter.Deselect(); } mSelectedCharacter = character; if (mSelectedCharacter != null) { SoundManager.Instance.PlayMenuConfirmSFX(); GlobalData.sSelectedCharacter = mSelectedCharacter.mCharacter; mSelectedCharacter.Select(); UpdateDisplay(); mStartButton.SetActive(true); } } } } }
public override void PerformAction <T>(T triggerInstance) { CharacterMenuManager menu = GetComponent <CharacterMenuManager>(); CharacterSelector selector = menu.Selector as CharacterSelector; bool wasSelected = selector.Deselect(); if (wasSelected) { menu.Deselect(); OnActionPerformed(); } else { base.PerformAction <T>(triggerInstance); } }