Esempio n. 1
0
        public void OnPlayerLeft(Match m, UXVCore.Player p, int reason)
        {
            Debug.Log ("OnPlayerLeft");

            // Notify GameManager that the Opponent has left
            GameManager.Instance.OpponentLeft();
        }
Esempio n. 2
0
        public void OnReceivedData(Match m, UXVCore.Player sourcePlayer, string msg)
        {
            if (msg.StartsWith ("P ")) {
                string[] words = Utils.SplitStr (msg, 2);

                float xPos = (float)Convert.ToDouble (words [1]);

                nl.remotePaddleController.SetPaddlePosition (xPos);
            }
            else if(msg.StartsWith("H ")) {
                string[] words = Utils.SplitStr (msg, 2);

                float xPos = (float)Convert.ToDouble (words [1]);
                Debug.Log ("Parsed HIT position as " + xPos);

                HitInfo hitInfo = new HitInfo();
                hitInfo.paddleHitPosition = xPos;
                hitInfo.type = HitType.HIT;
                nl.remotePaddleController.SetPaddlePosition (xPos);
                nl.remotePaddleController.DisableUpdates();
                EventManager.Instance.SetOpponentHitInfo(hitInfo);
            }
            else if(msg.StartsWith("M ")) {
                string[] words = Utils.SplitStr (msg, 2);

                float xPos = (float)Convert.ToDouble (words [1]);
                Debug.Log ("Parsed MISS position as " + xPos);

                HitInfo hitInfo = new HitInfo();
                hitInfo.paddleHitPosition = xPos;
                hitInfo.type = HitType.MISS;
                nl.remotePaddleController.SetPaddlePosition (xPos);
                nl.remotePaddleController.DisableUpdates();
                EventManager.Instance.SetOpponentHitInfo(hitInfo);
            }
            else {
                Debug.Log ("Received unknown message: '" + msg + "'");
            }
        }
Esempio n. 3
0
 public void OnPlayerJoined(Match m, UXVCore.Player p)
 {
     Debug.Log ("OnPlayerJoined");
 }
Esempio n. 4
0
 public void SetCurrentMatch(UXVCore.Match m)
 {
     this.currentMatch = m;
 }