Ejemplo n.º 1
0
    public override void OnParentChanging(BaseEntity oldParent, BaseEntity newParent)
    {
        base.OnParentChanging(oldParent, newParent);
        currentCassettePlayer?.OnCassetteRemoved(this);
        currentCassettePlayer = null;
        ICassettePlayer cassettePlayer;

        if (newParent != null && (cassettePlayer = newParent as ICassettePlayer) != null)
        {
            Invoke(DelayedCassetteInserted, 0.1f);
            currentCassettePlayer = cassettePlayer;
        }
    }
Ejemplo n.º 2
0
    public override void Load(LoadInfo info)
    {
        base.Load(info);
        if (info.msg.cassette == null)
        {
            return;
        }
        uint audioId = AudioId;

        AudioId          = info.msg.cassette.audioId;
        CreatorSteamId   = info.msg.cassette.creatorSteamId;
        preloadedAudioId = info.msg.cassette.preloadAudioId;
        if (base.isServer && info.msg.cassette.holder != 0)
        {
            BaseNetworkable baseNetworkable = BaseNetworkable.serverEntities.Find(info.msg.cassette.holder);
            ICassettePlayer cassettePlayer;
            if (baseNetworkable != null && (cassettePlayer = baseNetworkable as ICassettePlayer) != null)
            {
                currentCassettePlayer = cassettePlayer;
            }
        }
    }