public void OnReceived(MatchStartMessage matchStartMessage)
    {
        var fix = matchStartMessage.Fix.Value;

        if (clientState == ClientState.WaitingForOpponent)
        {
            for (UInt8 playerIndex = 0; playerIndex < 2 * teamSize; playerIndex++)
            {
                if (playerIndex != playerNumber)
                {
                    if (playerConnectingIcons[playerIndex].gameObject.activeSelf)
                    {
                        playerConnectingIcons[playerIndex].gameObject.SetActive(false);
                        playerDisconnectedIcons[playerIndex].gameObject.SetActive(true);
                    }
                }
            }
        }

        if (fix.SecondsToWait == 0)
        {
            ingameMusic.Play();
            clientState      = ClientState.Running;
            messageText.text = "";
            controlProgressions[0].GetComponent <ControlProgression>().enabled = true;
            controlProgressions[1].GetComponent <ControlProgression>().enabled = true;
            normalProjectileAmmoText.GetComponent <Ammo>().enabled             = true;
            bouncingProjectileAmmoText.GetComponent <Ammo>().enabled           = true;
        }
        else
        {
            clientState = ClientState.Countdown;
            StartCoroutine(Countdown(Convert.ToInt16(fix.SecondsToWait)));
        }
    }
 public void OnReceived(MatchStartMessage matchStartMessage)
 {
     if (gameState == GameState.InGame)
     {
         inGame.OnReceived(matchStartMessage);
     }
 }
        public virtual void OnMatchStart(string data)
        {
            if (NetworkInfos.IsServer)
            {
                return;
            }
            MatchStartMessage mmsg = JsonUtility.FromJson <MatchStartMessage> (data);

            OnMmMatchStart?.Invoke(mmsg.key, mmsg.map, mmsg.type);
        }
Ejemplo n.º 4
0
        private void OnMessageReceived(byte[] message)
        {
            MatchStartMessage receivedMessage = new MatchStartMessage(message);

            receivedMatchStartTimestamp = receivedMessage.MatchStartTimestamp;

            matchStateMachine.MatchStartTimestamp = receivedMessage.MatchStartTimestamp;

            ackMessageToSend = new MatchStartAckMessage(this.matchStateMachine.LocalPlayerId).GetBytes();
            DIContainer.Logger.Debug(string.Format("MatchStartMessage received. MatchStartTimestamp is: {0}", receivedMatchStartTimestamp));
        }
Ejemplo n.º 5
0
        public AbstractMessage Parse(string input)
        {
            Regex regex = new Regex(pattern);

            if (regex.IsMatch(input))
            {
                var message = new MatchStartMessage();
                var match   = regex.Match(input);
                message.Map = match.Groups["map"].Value;

                return(message);
            }
            return(null);
        }