예제 #1
0
        private void OnJoinAccept(JoinAcceptPacket packet)
        {
            Debug.Log("[C] Join accept. Received player id: " + packet.Id);
            _lastServerTick = packet.ServerTick;
            var clientPlayer = new ClientPlayer(this, _playerManager, _userName, packet.Id);
            var view         = ClientPlayerView.Create(_clientPlayerViewPrefab, clientPlayer);

            _playerManager.AddClientPlayer(clientPlayer, view);
        }
예제 #2
0
        public static ClientPlayerView Create(ClientPlayerView prefab, ClientPlayer player)
        {
            Quaternion rot = Quaternion.Euler(0f, player.Rotation, 0f);
            var        obj = Instantiate(prefab, player.Position, rot);

            obj._player                = player;
            obj._name.text             = player.Name;
            obj._mainCamera            = Camera.main;
            player.HealthChangeAction += obj.OnHealthChanged;
            return(obj);
        }
예제 #3
0
 public void AddClientPlayer(ClientPlayer player, ClientPlayerView view)
 {
     _clientPlayer = player;
     _players.Add(player.Id, new PlayerHandler(player, view));
 }