Пример #1
0
    public void SetPlayerToSide()
    {
        for (int i = 0; i < PhotonNetwork.PlayerList.Length; i++)
        {
            _emblems[i].GetData().Owner = PhotonNetwork.PlayerList[i];
        }

        _initializeTanks.Publish();
    }
Пример #2
0
        public override void OnJoinedRoom()
        {
            if (AutoSpawnObjects && !PhotonNetwork.LocalPlayer.HasRejoined)
            {
                SpawnObject(PhotonNetwork.CurrentRoom.PlayerCount - 1);

                JoinedRoom.Publish();
            }
        }
Пример #3
0
    public override void OnUpdate(float deltaTime)
    {
        var healths = filter.Select <HealthComponent>();

        for (int i = 0; i < filter.Length; i++)
        {
            if (healths.GetComponent(i).UnitType == InstantiateTanks.MyType)
            {
                LoseGameEvent.Publish();
            }
            else
            {
                WinGameEvent.Publish();
            }

            filter.GetEntity(i).RemoveComponent <DeadComponent>();
        }
    }
        private IEnumerator WaitPlayer()
        {
            WaitForSeconds waitForSeconds = new WaitForSeconds(1);
            int            i = 0;

            while (PhotonNetwork.CurrentRoom == null)
            {
                yield return(waitForSeconds);
            }

            while (PhotonNetwork.CurrentRoom.PlayerCount < MinimalPlayerCount)
            {
                StartGameView.UpdateSearchingText();

                yield return(waitForSeconds);
            }

            var parameters = new LoadSceneParameters(LoadSceneMode.Additive);

            var operation = SceneManager.LoadSceneAsync(SCENE_NAME, parameters);

            while (operation.isDone)
            {
                StartGameView.UpdateSearchingText();
                yield return(waitForSeconds);
            }

            StartGameView.DisableView();

            for (i = countNumber; i > 0; i--)
            {
                StartGameView.SetTimerText(i.ToString());

                yield return(waitForSeconds);
            }

            StartGameView.SetTimerText(string.Empty);

            StartGameEvent.Publish();
        }
Пример #5
0
 public void OnClick( )
 {
     globalEvent.Publish( );
 }
Пример #6
0
 private void OnCountdownTimerHasExpired()
 {
     _gameStart.Publish();
 }
Пример #7
0
 public override void OnPlayerLeftRoom(Player otherPlayer)
 {
     base.OnPlayerLeftRoom(otherPlayer);
     DisconnectEvent.Publish();
 }