Example #1
0
    public int CreatePlayer(Vector3 position, bool fakePlayer = false)
    {
        int          _playerId    = playerId.GetNext();
        var          player       = UnityEngine.Object.Instantiate <GameObject>(playerPrefab, position, Quaternion.identity);
        ServerPlayer serverPlayer = player.GetComponent <ServerPlayer>();

        if (!GameConfig.showServerPlayers)
        {
            Utils.ChangeObjectOpacity(serverPlayer.transform, 0);
        }

        serverPlayer.Initialize(fakePlayer);
        serverPlayer.name     = _playerId.ToString();
        serverPlayer.PlayerId = _playerId;

        players.Add(_playerId, serverPlayer);

        return(_playerId);
    }