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); } } } } }
private void HandleCellClicked(int cellId) { if (!_unitSelector.IsSelectable) { return; } if (_unit.CurrentCell.Id != cellId) { if (_isSelected && _playerTurnState == TurnTypes.PlayerTurnStates.Action) { UnitMovement.MoveTo(cellId); return; } return; } if (!_isSelected && _playerTurnState == TurnTypes.PlayerTurnStates.Action) { return; } _isSelected = _unitSelector.Select(); _spriteController.SetIsSelectable(!_isSelected); }
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); } } } } }