Commit 26514b9b authored by Freddy's avatar Freddy
Browse files

Some little fixes

parent 58e29d09
...@@ -82,8 +82,8 @@ Material: ...@@ -82,8 +82,8 @@ Material:
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 0.6745098, g: 0.83137256, b: 0.9490196, a: 1} - _Color1: {r: 0.9254902, g: 0.92941177, b: 0.6509804, a: 1}
- _Color2: {r: 0.60784316, g: 0.8156863, b: 0.7294118, a: 1} - _Color2: {r: 0.60784316, g: 0.8156863, b: 0.7294118, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _ReplaceColor: {r: 1, g: 0, b: 1, a: 1} - _ReplaceColor: {r: 1, g: 0, b: 1, a: 1}
- _Screen: {r: 275.19684, g: 1306.671, b: 0, a: 0} - _Screen: {r: 277.39355, g: 1282.4668, b: 0, a: 0}
...@@ -5014,16 +5014,41 @@ PrefabInstance: ...@@ -5014,16 +5014,41 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 1084743508520952771, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1383212121944532800, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3}
propertyPath: slideAnimation
value:
objectReference: {fileID: 1232869726}
- target: {fileID: 4832069680716590380, guid: e86738adc72125e40bc2e4b5f1439932, - target: {fileID: 4832069680716590380, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3} type: 3}
propertyPath: ps propertyPath: ps
value: value:
objectReference: {fileID: 92916890} objectReference: {fileID: 92916890}
- target: {fileID: 5716535208521528588, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8408283408899880007, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8775728585122198005, guid: e86738adc72125e40bc2e4b5f1439932, - target: {fileID: 8775728585122198005, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3} type: 3}
propertyPath: m_Camera propertyPath: m_Camera
value: value:
objectReference: {fileID: 519420031} objectReference: {fileID: 519420031}
- target: {fileID: 8775728585202340320, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8775728586902712361, guid: e86738adc72125e40bc2e4b5f1439932, - target: {fileID: 8775728586902712361, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
...@@ -5577,6 +5602,18 @@ Transform: ...@@ -5577,6 +5602,18 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1232869726 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 4304730650516509807, guid: e86738adc72125e40bc2e4b5f1439932,
type: 3}
m_PrefabInstance: {fileID: 108340264}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bc2c6f00db1994043bb85d4236905972, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1314631443 --- !u!1 &1314631443
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -5,15 +5,30 @@ using UnityEngine; ...@@ -5,15 +5,30 @@ using UnityEngine;
public class CurrentItems : MonoBehaviour public class CurrentItems : MonoBehaviour
{ {
public delegate void PanelEvent();
public static PanelEvent ItemsChanged;
public static CurrentItems Instance { get; private set; } public static CurrentItems Instance { get; private set; }
public SlideAnimation slideAnimation;
public ItemHolder[] holders; public ItemHolder[] holders;
public bool IsFull { get; private set; } public bool IsFull { get; private set; }
public bool IsEmpty { get; private set; }
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
ItemsChanged += Open;
}
private void Open()
{
CheckIsFull();
if (IsEmpty)
slideAnimation.Close();
else
slideAnimation.Open();
} }
public void AddItem(ShopItem item) public void AddItem(ShopItem item)
...@@ -21,8 +36,6 @@ public class CurrentItems : MonoBehaviour ...@@ -21,8 +36,6 @@ public class CurrentItems : MonoBehaviour
if (IsFull) if (IsFull)
return; return;
Debug.Log("Test");
foreach (var holder in holders) foreach (var holder in holders)
{ {
if (holder.item == item) if (holder.item == item)
...@@ -43,6 +56,16 @@ public class CurrentItems : MonoBehaviour ...@@ -43,6 +56,16 @@ public class CurrentItems : MonoBehaviour
private void CheckIsFull() private void CheckIsFull()
{ {
IsEmpty = true;
foreach (var holder in holders)
{
if (!holder.Empty)
{
IsEmpty = false;
break;
}
}
foreach (var holder in holders) foreach (var holder in holders)
{ {
if (holder.Empty) if (holder.Empty)
......
...@@ -24,6 +24,8 @@ public class ItemHolder : MonoBehaviour ...@@ -24,6 +24,8 @@ public class ItemHolder : MonoBehaviour
icon.sprite = item.icon; icon.sprite = item.icon;
icon.gameObject.SetActive(true); icon.gameObject.SetActive(true);
objectReference = BodyPartScript.Instance.PlaceItem(item); objectReference = BodyPartScript.Instance.PlaceItem(item);
CurrentItems.ItemsChanged.Invoke();
} }
public void RemoveItem() public void RemoveItem()
...@@ -34,5 +36,7 @@ public class ItemHolder : MonoBehaviour ...@@ -34,5 +36,7 @@ public class ItemHolder : MonoBehaviour
icon.sprite = null; icon.sprite = null;
icon.gameObject.SetActive(false); icon.gameObject.SetActive(false);
Destroy(objectReference); Destroy(objectReference);
CurrentItems.ItemsChanged.Invoke();
} }
} }
...@@ -27,7 +27,7 @@ public class SlideAnimation : MonoBehaviour ...@@ -27,7 +27,7 @@ public class SlideAnimation : MonoBehaviour
public void Trigger() public void Trigger()
{ {
if (open) Open(); if (!open) Open();
else Close(); else Close();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment