Created resources folder + more work on inventory

This commit is contained in:
darrelmarek 2018-04-25 22:33:46 -05:00
parent 9e5d3feec0
commit 97557bfb47
24 changed files with 93 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 00e35244fddf9aa4fa427e547aec158d
folderAsset: yes
timeCreated: 1524683565
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 49942256293e57045bbb9b1a407a1667
timeCreated: 1524683726
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 645789e883e1d3c40aabb865a433d896
timeCreated: 1524683718
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6bca5c058cbd15c41815ef2924191049
timeCreated: 1524683721
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6d657f3d9cb80c94d86fed7d0acbcdd7
timeCreated: 1524683723
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 07c92442f33cfbb448eff50b204aaefa
timeCreated: 1524683727
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5bb017abc66da2e4bb908eb3c97d29b4
timeCreated: 1524683729
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -4,6 +4,7 @@ using UnityEngine.EventSystems;
public class DragAndDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
public static GameObject DraggedInstance;
public Inventory inventory;
Vector3 _startPosition;
Vector3 _offsetToMouse;
@ -34,8 +35,11 @@ public class DragAndDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
public void OnEndDrag (PointerEventData eventData)
{
DraggedInstance = null;
_offsetToMouse = Vector3.zero;
//Debug.Log (Input.mousePosition.y);
if (Input.mousePosition.y < 75)
DraggedInstance.SetActive (false);
DraggedInstance = null;
}
#endregion

View file

@ -8,6 +8,18 @@ public class Inventory : MonoBehaviour
public Image[] itemImages = new Image[numItemSlots];
public Item[] items = new Item[numItemSlots];
public const int numItemSlots = 25;
private static bool created = false;
void Awake()
{
if (!created)
{
DontDestroyOnLoad(this.gameObject);
created = true;
}
}
public void AddItem(Item itemToAdd)
{
for (int i = 0; i < items.Length; i++)
@ -21,8 +33,11 @@ public class Inventory : MonoBehaviour
}
}
}
public void RemoveItem (Item itemToRemove)
{
GameObject instance = (GameObject)Instantiate(Resources.Load(itemToRemove.name));
for (int i = 0; i < items.Length; i++)
{
if (items[i] == itemToRemove)

View file

@ -4,4 +4,6 @@
public class Item : ScriptableObject {
public Sprite sprite;
public string name;
}

View file

@ -1 +1 @@
m_EditorVersion: 2017.2.1f1
m_EditorVersion: 2017.3.1f1