Example #1
0
        public Arena(PongServer server)
        {
            _server     = server;
            Id          = _nextId++;
            State.Value = ArenaState.NotRunning;

            // Some other data
            LeftPlayer.Paddle  = new Paddle(PaddleSide.Left);
            RightPlayer.Paddle = new Paddle(PaddleSide.Right);
        }
Example #2
0
 /**
  * This function sets the PongServer or PongClient script static reference
  * based on the role of this process.
  */
 public static void AnnounceRoleSelection(byte _ROLE_)
 {
     if (_ROLE_ == GeneralUtils.ROLE_SERVER)
     {
         m_pongServerScript = GameObject.Find("ScriptHub").GetComponent <PongServer>();
         GeneralUtils.m_pongServerScript   = m_pongServerScript;
         m_ballScript.ServerBallBehavior   = true;
         m_agentScript.ServerAgentBehavior = true;
         GameObject.Find("ScriptHub").AddComponent <StateDiagramGenerator>();
     }
     else if (_ROLE_ == GeneralUtils.ROLE_CLIENT)
     {
         m_pongClientScript = GameObject.Find("ScriptHub").GetComponent <PongClient>();
         GeneralUtils.m_pongClientScript   = m_pongClientScript;
         m_ballScript.ServerBallBehavior   = false;
         m_agentScript.ServerAgentBehavior = false;
     }
 }
Example #3
0
 public void UpdatePaddle(string roomId, bool isPlayer1, int paddleY)
 {
     PongServer.UpdatePaddle(roomId, isPlayer1, paddleY);
 }
Example #4
0
 public void ServeBall(string roomId, bool isPlayer1)
 {
     PongServer.ServeBall(roomId, isPlayer1);
 }
Example #5
0
 public void StartGame(string roomId)
 {
     PongServer.StartGame(roomId);
     Clients.Group(roomId).onGameStarted();
 }