Пример #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (_player == null)
     {
         _player       = collision.transform.GetComponent <Player>();
         _inputHandler = collision.transform.GetComponent <InputHandler>();
         _miniGame.OnMiniGameStarted += OnMiniGameStarted;
         if (_miniGame.GetType() == typeof(PongMiniGame))
         {
             _playerIndex = ((PongMiniGame)_miniGame).AddPlayer(_player, (name == "RPosition"));
             Debug.Log(name + " " + _playerIndex);
         }
         else
         {
             _miniGame.AddPlayer(_player);
         }
         if (_miniGame.PlayerNumSatisfied())
         {
             _miniGame.StartGame();
         }
     }
 }