Пример #1
0
 private void OnBallOut()
 {
     if (isHost)
     {
         FieldMediator.ResetState();
         _physicsController.LaunchBall();
         PhotonServerController.SendEvent(2, new Dictionary <byte, object>());
     }
 }
Пример #2
0
        public void OnInjected()
        {
            PhotonServerController.CreatedGame.AddListener(OnHost);
            PhotonServerController.JoinedGame.AddListener(OnClient);
            PhotonServerController.Disconnected.AddListener(OnDisconnected);
            PhotonServerController.ReceivedEvent.AddListener(OnEventReceived);

            PhotonServerController.FindGame();
        }
Пример #3
0
 private void OnUpdate(float obj)
 {
     if (isHost)
     {
         var dict = new Dictionary <byte, object>();
         dict.Add(0, (FieldMediator.Racket1.transform as RectTransform).anchoredPosition.x);
         dict.Add(1, FieldMediator.Ball.Rigidbody2D.position.x);
         dict.Add(2, FieldMediator.Ball.Rigidbody2D.position.y);
         dict.Add(3, FieldMediator.Ball.Rigidbody2D.velocity.x);
         dict.Add(4, FieldMediator.Ball.Rigidbody2D.velocity.y);
         PhotonServerController.SendEvent(1, dict);
     }
     else
     {
         var dict = new Dictionary <byte, object>();
         dict.Add(0, (FieldMediator.Racket2.transform as RectTransform).anchoredPosition.x);
         PhotonServerController.SendEvent(1, dict);
     }
 }
Пример #4
0
 private void OnDisconnected()
 {
     PhotonServerController.Disconnect();
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }