示例#1
0
        private void PlayerHealthUpdated(PhotonPlayer player, int newHealth)
        {
            if (newHealth > 0 || _gameEnded)
            {
                return;
            }

            // it would be cleaner to remove the callback from the event and not having the variable _gameEnded
            _gameEnded = true;
            if (player.photonView.IsMine)
            {
                _defeatScreen.ShowDefeat();
            }
            else
            {
                _defeatScreen.ShowVictory();
            }
        }