Beispiel #1
0
        private void OnPlayerJoined(PlayerJoinedPacket packet)
        {
            Debug.Log($"[C] Player joined: {packet.UserName}");
            var remotePlayer = new RemotePlayer(_playerManager, packet.UserName, packet);
            var view         = RemotePlayerView.Create(_remotePlayerViewPrefab, remotePlayer);

            _playerManager.AddPlayer(remotePlayer, view);
        }
Beispiel #2
0
        public static RemotePlayerView Create(RemotePlayerView prefab, RemotePlayer player)
        {
            Quaternion rot = Quaternion.Euler(0f, player.Rotation, 0f);
            var        obj = Instantiate(prefab, player.Position, rot);

            obj._player = player;
            player.HealthChangeAction += obj.OnHealthChanged;
            return(obj);
        }
Beispiel #3
0
 public void AddPlayer(RemotePlayer player, RemotePlayerView view)
 {
     _players.Add(player.Id, new PlayerHandler(player, view));
 }