Created resources folder + more work on inventory
This commit is contained in:
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.
10
MoCha/Assets/Resources.meta
Normal file
10
MoCha/Assets/Resources.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 00e35244fddf9aa4fa427e547aec158d
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1524683565
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Resources/circle_eye.prefab
Normal file
BIN
MoCha/Assets/Resources/circle_eye.prefab
Normal file
Binary file not shown.
10
MoCha/Assets/Resources/circle_eye.prefab.meta
Normal file
10
MoCha/Assets/Resources/circle_eye.prefab.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 49942256293e57045bbb9b1a407a1667
|
||||||
|
timeCreated: 1524683726
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Resources/circle_head.prefab
Normal file
BIN
MoCha/Assets/Resources/circle_head.prefab
Normal file
Binary file not shown.
10
MoCha/Assets/Resources/circle_head.prefab.meta
Normal file
10
MoCha/Assets/Resources/circle_head.prefab.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 645789e883e1d3c40aabb865a433d896
|
||||||
|
timeCreated: 1524683718
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Resources/crazy_hair.prefab
Normal file
BIN
MoCha/Assets/Resources/crazy_hair.prefab
Normal file
Binary file not shown.
10
MoCha/Assets/Resources/crazy_hair.prefab.meta
Normal file
10
MoCha/Assets/Resources/crazy_hair.prefab.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6bca5c058cbd15c41815ef2924191049
|
||||||
|
timeCreated: 1524683721
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Resources/crown.prefab
Normal file
BIN
MoCha/Assets/Resources/crown.prefab
Normal file
Binary file not shown.
10
MoCha/Assets/Resources/crown.prefab.meta
Normal file
10
MoCha/Assets/Resources/crown.prefab.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6d657f3d9cb80c94d86fed7d0acbcdd7
|
||||||
|
timeCreated: 1524683723
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Resources/gap_mouth.prefab
Normal file
BIN
MoCha/Assets/Resources/gap_mouth.prefab
Normal file
Binary file not shown.
10
MoCha/Assets/Resources/gap_mouth.prefab.meta
Normal file
10
MoCha/Assets/Resources/gap_mouth.prefab.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 07c92442f33cfbb448eff50b204aaefa
|
||||||
|
timeCreated: 1524683727
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Resources/pig_nose.prefab
Normal file
BIN
MoCha/Assets/Resources/pig_nose.prefab
Normal file
Binary file not shown.
10
MoCha/Assets/Resources/pig_nose.prefab.meta
Normal file
10
MoCha/Assets/Resources/pig_nose.prefab.meta
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5bb017abc66da2e4bb908eb3c97d29b4
|
||||||
|
timeCreated: 1524683729
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 100100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
|
@ -4,6 +4,7 @@ using UnityEngine.EventSystems;
|
||||||
public class DragAndDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
|
public class DragAndDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
|
||||||
{
|
{
|
||||||
public static GameObject DraggedInstance;
|
public static GameObject DraggedInstance;
|
||||||
|
public Inventory inventory;
|
||||||
|
|
||||||
Vector3 _startPosition;
|
Vector3 _startPosition;
|
||||||
Vector3 _offsetToMouse;
|
Vector3 _offsetToMouse;
|
||||||
|
@ -34,8 +35,11 @@ public class DragAndDrop : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
|
||||||
|
|
||||||
public void OnEndDrag (PointerEventData eventData)
|
public void OnEndDrag (PointerEventData eventData)
|
||||||
{
|
{
|
||||||
DraggedInstance = null;
|
|
||||||
_offsetToMouse = Vector3.zero;
|
_offsetToMouse = Vector3.zero;
|
||||||
|
//Debug.Log (Input.mousePosition.y);
|
||||||
|
if (Input.mousePosition.y < 75)
|
||||||
|
DraggedInstance.SetActive (false);
|
||||||
|
DraggedInstance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -8,6 +8,18 @@ public class Inventory : MonoBehaviour
|
||||||
public Image[] itemImages = new Image[numItemSlots];
|
public Image[] itemImages = new Image[numItemSlots];
|
||||||
public Item[] items = new Item[numItemSlots];
|
public Item[] items = new Item[numItemSlots];
|
||||||
public const int numItemSlots = 25;
|
public const int numItemSlots = 25;
|
||||||
|
|
||||||
|
private static bool created = false;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (!created)
|
||||||
|
{
|
||||||
|
DontDestroyOnLoad(this.gameObject);
|
||||||
|
created = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddItem(Item itemToAdd)
|
public void AddItem(Item itemToAdd)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < items.Length; i++)
|
for (int i = 0; i < items.Length; i++)
|
||||||
|
@ -21,8 +33,11 @@ public class Inventory : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveItem (Item itemToRemove)
|
public void RemoveItem (Item itemToRemove)
|
||||||
{
|
{
|
||||||
|
GameObject instance = (GameObject)Instantiate(Resources.Load(itemToRemove.name));
|
||||||
|
|
||||||
for (int i = 0; i < items.Length; i++)
|
for (int i = 0; i < items.Length; i++)
|
||||||
{
|
{
|
||||||
if (items[i] == itemToRemove)
|
if (items[i] == itemToRemove)
|
||||||
|
|
|
@ -4,4 +4,6 @@
|
||||||
public class Item : ScriptableObject {
|
public class Item : ScriptableObject {
|
||||||
|
|
||||||
public Sprite sprite;
|
public Sprite sprite;
|
||||||
|
|
||||||
|
public string name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
m_EditorVersion: 2017.2.1f1
|
m_EditorVersion: 2017.3.1f1
|
||||||
|
|
Reference in a new issue