Example #1
0
        private void SetUItextMultiplayer()
        {
            if (GameManager.localPlayer == null)
            {
                return;
            }

            if (playerAmmo == 0)
            {
                if (GameManager.opponentPlayer == null)
                {
                    topUItext.text = UIText.SinglePlayerTopText(
                        ammo: AppConstants.UnlimitedAmmoSymbol,
                        lives: GameManager.localPlayer.GetComponent <Health>().currentLives
                        );
                }
                else
                {
                    topUItext.text = UIText.MultiPlayerTopText(
                        ammo: AppConstants.UnlimitedAmmoSymbol,
                        lives: GameManager.localPlayer.GetComponent <Health>().currentLives,
                        enemyLives: GameManager.opponentPlayer.GetComponent <Health>().currentLives
                        );
                }
            }
            else
            {
                if (GameManager.opponentPlayer == null)
                {
                    topUItext.text = UIText.SinglePlayerTopText(
                        ammo: Convert.ToString(GameManager.localPlayer.GetComponent <Ammo>().currentAmmo),
                        lives: GameManager.localPlayer.GetComponent <Health>().currentLives
                        );
                }
                else
                {
                    topUItext.text = UIText.MultiPlayerTopText(
                        ammo: Convert.ToString(GameManager.localPlayer.GetComponent <Ammo>().currentAmmo),
                        lives: GameManager.localPlayer.GetComponent <Health>().currentLives,
                        enemyLives: GameManager.opponentPlayer.GetComponent <Health>().currentLives
                        );
                }
            }

            if (GameManager.opponentPlayer != null)
            {
                gameManager.RpcSetClientUIText(GameManager.opponentPlayer.GetComponent <Ammo>().currentAmmo, GameManager.localPlayer.GetComponent <Health>().currentLives, GameManager.opponentPlayer.GetComponent <Health>().currentLives);
            }
        }