コード例 #1
0
    public void OnInventoryMoveServer(InventoryMove info)
    {
        // stop any observers (except for owner) from observing it if it's moved
        var fromRootPlayer = info.FromRootPlayer;

        if (fromRootPlayer != null)
        {
            itemStorage.ServerRemoveAllObserversExceptOwner();
        }

        // stop owner observing if it's dropped from the owner's storage
        var toRootPlayer = info.ToRootPlayer;

        // no need to do anything, hasn't moved into player inventory
        if (fromRootPlayer == toRootPlayer)
        {
            return;
        }

        // make sure it's closed and any children as well
        if (fromRootPlayer != null)
        {
            ObserveInteractableStorageMessage.Send(fromRootPlayer.gameObject, this, false);
        }
    }