//Hand item sprites after picking up an item (server) public void SetHandItem(string eventName, GameObject obj) { ItemAttributes att = obj.GetComponent <ItemAttributes>(); EquipmentPool.AddGameObject(gameObject, obj); SetHandItemSprite(eventName, att); RpcSendMessage(eventName, obj); }
public override void OnStartServer() { InitEquipment(); EquipmentPool equipPool = FindObjectOfType <EquipmentPool>(); if (equipPool == null) { Instantiate(Resources.Load("EquipmentPool") as GameObject, Vector2.zero, Quaternion.identity); } base.OnStartServer(); }
private void SetItem(string eventName, GameObject prefab) { if (prefab == null) { return; } GameObject item = Instantiate(prefab, Vector2.zero, Quaternion.identity) as GameObject; NetworkServer.Spawn(item); ItemAttributes att = item.GetComponent <ItemAttributes>(); EquipmentPool.AddGameObject(gameObject, item); playerNetworkActions.TrySetItem(eventName, item); //Sync all clothing items across network using SyncListInt syncEquipSprites if (att.spriteType == UI.SpriteType.Clothing) { Epos enumA = (Epos)Enum.Parse(typeof(Epos), eventName); syncEquipSprites[(int)enumA] = att.clothingReference; } }