Пример #1
0
 void Awake()
 {
     m_CurrentHealth = m_MaximumHealth;
     TargetPlayer    = GameObject.FindGameObjectWithTag("Player").transform.GetComponent <TanksNetworkPlayer>();
     entityAnimator  = GetComponent <Animator>();
     enemyAudio      = GetComponent <AudioSource>();
 }
Пример #2
0
        //Start shooting range
        private void StartGame(TanksNetworkPlayer player)
        {
            NetworkManager netManager = NetworkManager.s_Instance;

            netManager.playerJoined -= StartGame;
            netManager.ProgressToGameScene();
        }
Пример #3
0
 public void ShowTankSelectModal(TanksNetworkPlayer player)
 {
     if (m_CustomiseModal != null)
     {
         m_CustomiseModal.Open(player);
     }
 }
Пример #4
0
 /// <summary>
 ///   If a player leaves, update the id mapping
 /// </summary>
 /// <param name="player"></param>
 public void RemoveNetworkPlayer(TankNt.NetworkPlayer player)
 {
     Debug.LogWarningFormat("Player left and removed:{0}", player);
     if (NetworkToAgoraIDMap.ContainsKey(player))
     {
         NetworkToAgoraIDMap.Remove(player);
     }
 }
Пример #5
0
 public void AddNetworkPlayer(TankNt.NetworkPlayer player)
 {
     Debug.LogFormat("Player joined----> {0}", player);
     if (player.isLocalPlayer)
     {
         Debug.Log("List: Player ignore for being LocalPlayer:" + player);
     }
     else
     {
         m_NetworkPlayers.Add(player);
     }
 }
Пример #6
0
    /// <summary>
    ///   Gets the Agora Id for a network player
    /// </summary>
    /// <param name="player"></param>
    /// <returns></returns>
    public uint GetAgoraID(TankNt.NetworkPlayer player)
    {
        if (NetworkToAgoraIDMap.Count == 0)
        {
            Bind();
        }

        if (NetworkToAgoraIDMap.ContainsKey(player))
        {
            return(NetworkToAgoraIDMap[player]);
        }

        return(0);
    }
Пример #7
0
        public void Init(TanksNetworkPlayer netPlayer)
        {
            Debug.LogFormat("Initializing lobby player - Ready {0}", netPlayer.ready);
            this.m_NetPlayer = netPlayer;
            if (netPlayer != null)
            {
                netPlayer.syncVarsChanged += OnNetworkPlayerSyncvarChanged;
            }

            m_NetManager = TanksNetworkManager.s_Instance;
            if (m_NetManager != null)
            {
                m_NetManager.playerJoined += PlayerJoined;
                m_NetManager.playerLeft   += PlayerLeft;
            }

            m_ReadyLabel.gameObject.SetActive(false);
            m_WaitingLabel.gameObject.SetActive(false);
            m_ReadyButton.gameObject.SetActive(true);
            m_ReadyButton.interactable = m_NetManager.hasSufficientPlayers;

            if (m_NetManager.gameType == NetworkGameType.Singleplayer)
            {
                return;
            }

            MainMenuUI mainMenu = MainMenuUI.s_Instance;

            mainMenu.playerList.AddPlayer(this);
            mainMenu.playerList.DisplayDirectServerWarning(netPlayer.isServer && m_NetManager.matchMaker == null);

            if (netPlayer.hasAuthority)
            {
                SetupLocalPlayer();
            }
            else
            {
                SetupRemotePlayer();
            }

            UpdateValues();
        }
Пример #8
0
        /// <summary>
        /// Exits the game.
        /// </summary>
        /// <param name="returnPage">Return page.</param>
        public void ExitGame(MenuPage returnPage)
        {
            for (int i = 0; i < s_Tanks.Count; i++)
            {
                TankManager tank = s_Tanks[i];
                if (tank != null)
                {
                    Debug.Log("Destroying tank!!!");
                    TanksNetworkPlayer player = tank.player;
                    if (player != null)
                    {
                        player.tank = null;
                    }

                    NetworkServer.Destroy(s_Tanks[i].gameObject);
                }
            }

            s_Tanks.Clear();
            m_NetManager.ReturnToMenu(returnPage);
        }
Пример #9
0
 private void OnNetworkPlayerSyncvarChanged(TanksNetworkPlayer player)
 {
     // Update everything
     UpdateValues();
 }
Пример #10
0
 protected virtual void PlayerLeft(TanksNetworkPlayer player)
 {
     RefreshJoinButton();
 }
Пример #11
0
 //Log player leaving for tracing
 protected virtual void PlayerLeft(TanksNetworkPlayer player)
 {
     Debug.LogFormat("Player left {0}", player.name);
 }
Пример #12
0
 //Log player joining for tracing
 protected virtual void PlayerJoined(TanksNetworkPlayer player)
 {
     Debug.LogFormat("Player joined {0}", player.name);
 }
Пример #13
0
 //Log player leaving for tracing
 protected virtual void PlayerLeft(TanksNetworkPlayer player)
 {
     //Debug.LogFormat("Player left: {0}", player);
     //AgoraPlayerController.instance.RemoveNetworkPlayer(player);
 }
Пример #14
0
 //Log player joining for tracing
 protected virtual void PlayerJoined(TanksNetworkPlayer player)
 {
     // Debug.LogFormat("Player joined----> {0}", player);
     // AgoraPlayerController.instance.AddNetworkPlayer(player);
 }