private void CheckNumber(string sender, int number)
    {
        if (number < 0 || number > 100)
        {
            /*Ignore*/
            return;
        }

        string message = null;

        if (number > _pickedNumber)
        {
            message = "Greater";
        }
        else if (number < _pickedNumber)
        {
            message = "Less";
        }
        else/*if(number == _pickedNumber)*/
        {
            message        = $"!WINNER! {sender} won the game! It is indeed {_pickedNumber}";
            _gameIsRunning = false;
        }

        Request_BroadcastMessage?.Invoke(_managerName, message);
    }
    void StartGame(string sender)
    {
        _gameIsRunning = true;
        _pickedNumber  = UnityEngine.Random.Range(0, 101);

        string message = $"!GAME! {sender} started a game! I picked a number in range 0-100, try to guess it";

        Request_BroadcastMessage?.Invoke(_managerName, message);
    }
Beispiel #3
0
 void CmdSendMessageToServer(string message)
 {
     Request_BroadcastMessage?.Invoke(this, message);
 }