Example #1
0
    public void NotifyPlayer(GameObject recipient)
    {
        //Validate data and make sure it is being pulled from Server List (Fixes Host problems)
        StorageSlots slotsData = new StorageSlots();

        foreach (InventorySlot slot in storageSlots.inventorySlots)
        {
            slotsData.inventorySlots.Add(InventoryManager.GetSlotFromUUID(slot.UUID, true));
        }

        StorageObjectSyncMessage.Send(recipient, gameObject, JsonUtility.ToJson(slotsData));
    }
    /// <param name="recipient">Client GO</param>
    /// <param name="slot"></param>
    /// <param name="objectForSlot">Pass null to clear slot</param>
    /// <param name="forced">
    ///     Used for client simulation, use false if client's slot is already updated by prediction
    ///     (to avoid updating it twice)
    /// </param>
    /// <returns></returns>
    public static StorageObjectSyncMessage Send(GameObject recipient, GameObject storageObj, string data)
    {
        StorageObjectSyncMessage msg = new StorageObjectSyncMessage
        {
            Recipient  = recipient.GetComponent <NetworkIdentity>().netId,
            StorageObj = storageObj.GetComponent <NetworkIdentity>().netId,
            Data       = data
        };

        msg.SendTo(recipient);
        return(msg);
    }
Example #3
0
 public void NotifyPlayer(GameObject recipient)
 {
     StorageObjectSyncMessage.Send(recipient, gameObject, JsonUtility.ToJson(storageSlots));
 }