Пример #1
0
    void ClickSquare()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                _audioManager.PlayClickSlot();

                SlotController __slot = hit.transform.gameObject.GetComponent <SlotController>();

                _boardController.Board[__slot.xPos, __slot.yPos] = _currentPlayer;

                __slot.SetSymbolToSlot(_currentPlayer);

                SwitchPlayer();

                if (_cpuPlaying)
                {
                    _cpuTurn   = true;
                    _notPlayed = true;
                }
            }
        }
    }
Пример #2
0
    void PlaysRandom()
    {
        int __randomIndex = UnityEngine.Random.Range(0, _boardController.SlotControllers.Length);

        while (_boardController.SlotControllers[__randomIndex].selected)
        {
            __randomIndex = UnityEngine.Random.Range(0, _boardController.SlotControllers.Length);
        }

        SlotController __slot = _boardController.SlotControllers[__randomIndex];

        _boardController.Board[__slot.xPos, __slot.yPos] = _currentPlayer;

        __slot.SetSymbolToSlot(_currentPlayer);
    }