Exemplo n.º 1
0
        //Hand item sprites after picking up an item (server)
        public void SetHandItem(string slotName, GameObject obj)
        {
            ItemAttributes att = obj.GetComponent <ItemAttributes>();

            EquipmentPool.AddGameObject(gameObject, obj);
            SetHandItemSprite(slotName, att);
            RpcSendMessage(slotName, obj);
        }
Exemplo n.º 2
0
        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;
            }
        }