Exemplo n.º 1
0
        protected void Item3DSetUp(string assemblyName, ItemType type, string spriteName, bool isTreasureRoomItem = false)
        {
            m_AssemblyName       = assemblyName;
            m_ItemType           = type;
            m_IsTreasureRoomItem = isTreasureRoomItem;

            //if the item being spawned is a treasure room item then we want to make sure that it cannot be influenced as a rigidbody
            //and then also make sure that the object's collider is that of a trigger so that the player can interact with it
            if (m_IsTreasureRoomItem)
            {
                rigidbody.isKinematic = true;
                rigidbody.useGravity  = false;
                BoxCollider collider = GetComponent <BoxCollider>();
                collider.isTrigger = true;
                collider.size     *= 3.3f;
            }

            m_JournalSprite = Resources.Load <Sprite>(spriteName);

            //this section sets up all the mesh renderer data so that the proper mesh will be spawned
            {
                MeshFilter   filter   = GetComponent <MeshFilter>();
                MeshRenderer renderer = GetComponent <MeshRenderer>();

                GameObject itemsMesh = ((GameObject)Resources.Load("Items/Meshes/Tablet" + (assemblyName.Replace("TheNegative.Items.", ""))));
                if (itemsMesh != null)
                {
                    filter.mesh       = itemsMesh.GetComponent <MeshFilter>().sharedMesh;
                    renderer.material = itemsMesh.GetComponent <MeshRenderer>().sharedMaterial;
                }
            }


            if (m_ItemType == ItemType.PickUp)
            {
                CanPlayerObtainItem = ItemManager.Instance.PickUpItemsInGame[assemblyName].CanObtainItem;
            }
            else
            {
                CanPlayerObtainItem = ItemManager.Instance.ItemsInGame[assemblyName].CanObtainItem;
            }
        }
Exemplo n.º 2
0
        public void ItemSetUp(ItemType type, string assemblyName, string nameAndDirectory)
        {
            if (m_Renderer != null)
            {
                m_Sprite          = Resources.Load <Sprite>(nameAndDirectory);
                m_Renderer.sprite = m_Sprite;
            }

            m_Type          = type;
            m_AssemblyName  = assemblyName;
            gameObject.name = assemblyName;

            if (type != ItemType.PickUp)
            {
                CanPlayerObtainItem = ItemManager.Instance.ItemsInGame[assemblyName].CanObtainItem;
            }
            else
            {
                CanPlayerObtainItem = ItemManager.Instance.PickUpItemsInGame[assemblyName].CanObtainItem;
            }
        }
Exemplo n.º 3
0
 public void RPCGetItemDelegate()
 {
     CanPlayerObtainItem = ((AbstractItem)ItemManager.Instance.GetObjectFromName(m_AssemblyName)).CanObtainItem;
 }