From dbf9e14b0170b4cf6f5f1d3d968764ec5d57de97 Mon Sep 17 00:00:00 2001 From: JoshuaReason Date: Thu, 9 May 2019 14:43:46 +1000 Subject: [PATCH] Did some fixing for the inventory --- Assets/Prefabs/Character.prefab | 6 +- Assets/Prefabs/UI/Player Canvas.prefab | 20 ++++ Assets/Scenes/Client Scenes/ClientScene.unity | 93 +++++++------------ Assets/Scenes/ColourCollide_Smaller.unity | 19 +++- Assets/Scripts/Logic/Blocks/LogicBlock.cs | 10 +- Assets/Scripts/Logic/Blocks/Move.cs | 13 --- Assets/Scripts/LogicBlocks.meta | 8 ++ Assets/Scripts/Managers/GameManager.cs | 6 +- 8 files changed, 98 insertions(+), 77 deletions(-) create mode 100644 Assets/Scripts/LogicBlocks.meta diff --git a/Assets/Prefabs/Character.prefab b/Assets/Prefabs/Character.prefab index 3881782..fa86b7c 100644 --- a/Assets/Prefabs/Character.prefab +++ b/Assets/Prefabs/Character.prefab @@ -48,12 +48,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: nextScene: MainMenu - startingInventory: {fileID: 11400000, guid: 57948efb1cd9603419511d2dd2eabc3d, type: 2} - CurrentBlock: {fileID: 0} + _currentBlock: {fileID: 0} Ignore: serializedVersion: 2 m_Bits: 0 Inventory: {fileID: 11400000, guid: b6fa892e4c159bf46a2c4cda19627e97, type: 2} + CharacterModel: Bear --- !u!114 &2631002120179805110 MonoBehaviour: m_ObjectHideFlags: 0 @@ -99,7 +99,7 @@ MonoBehaviour: character: {fileID: 2862111851184665482} blockReader: LogicChain: [] - waitTime: 0.5 + waitTime: 1.5 --- !u!65 &4912471391544438089 BoxCollider: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/UI/Player Canvas.prefab b/Assets/Prefabs/UI/Player Canvas.prefab index 81746e5..b10060f 100644 --- a/Assets/Prefabs/UI/Player Canvas.prefab +++ b/Assets/Prefabs/UI/Player Canvas.prefab @@ -774,6 +774,7 @@ GameObject: - component: {fileID: 5195354182462625305} - component: {fileID: 5195354182462625302} - component: {fileID: 5195354182462625303} + - component: {fileID: 1240851277759925011} m_Layer: 5 m_Name: Player Canvas m_TagString: Untagged @@ -864,6 +865,25 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 307 +--- !u!114 &1240851277759925011 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5195354182462625300} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 65239890e888fd246a0b0985573deed6, type: 3} + m_Name: + m_EditorClassIdentifier: + Inventory: {fileID: 5195354183134146528} + AnimationSpeed: 0.5 + TrayUI: {fileID: 0} + Client: {fileID: 11400000, guid: 8dca4719b56d91143b236583a436c911, type: 2} + TimeText: {fileID: 0} + Title: {fileID: 2665231842396078511} + TotalTime: 30 --- !u!1 &5195354182925078845 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Client Scenes/ClientScene.unity b/Assets/Scenes/Client Scenes/ClientScene.unity index 134dfba..c49a628 100644 --- a/Assets/Scenes/Client Scenes/ClientScene.unity +++ b/Assets/Scenes/Client Scenes/ClientScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641222, b: 0.57481694, a: 1} + m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -452,18 +452,6 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 5195354181466942481} m_PrefabAsset: {fileID: 0} ---- !u!114 &1804173232 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 5195354183134146528, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - type: 3} - m_PrefabInstance: {fileID: 5195354181466942481} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 36cc4df775c8e8b46a89972d8008d56d, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1902492079 GameObject: m_ObjectHideFlags: 0 @@ -537,11 +525,42 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1240851277759925011, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, + type: 3} + propertyPath: TrayUI + value: + objectReference: {fileID: 1324620581} + - target: {fileID: 1240851277759925011, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, + type: 3} + propertyPath: TimeText + value: + objectReference: {fileID: 1363815578} - target: {fileID: 5195354182462625300, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_Name value: Player Canvas objectReference: {fileID: 0} + - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -0.000015258307 + objectReference: {fileID: 0} + - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0.000007958263 + objectReference: {fileID: 0} + - target: {fileID: 5195354183134146528, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, + type: 3} + propertyPath: inventory + value: + objectReference: {fileID: 11400000, guid: 9f2bac6895147d444858493b9609d026, + type: 2} - target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_LocalPosition.x @@ -662,21 +681,6 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 85.99994 objectReference: {fileID: 0} - - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - type: 3} - propertyPath: m_AnchoredPosition.y - value: -0.000022888184 - objectReference: {fileID: 0} - - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - type: 3} - propertyPath: m_AnchoredPosition.x - value: -0.000052050564 - objectReference: {fileID: 0} - target: {fileID: 5195354183101525346, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_AspectRatio @@ -832,12 +836,6 @@ PrefabInstance: propertyPath: m_Color.a value: 1 objectReference: {fileID: 0} - - target: {fileID: 5195354183134146528, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - type: 3} - propertyPath: inventory - value: - objectReference: {fileID: 11400000, guid: 9f2bac6895147d444858493b9609d026, - type: 2} - target: {fileID: 2665231841929910951, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_Name @@ -917,40 +915,21 @@ PrefabInstance: - {fileID: 5195354182462625307, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} - {fileID: 5195354183157824118, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} ---- !u!1 &5195354181466942482 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 5195354182462625300, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, +--- !u!114 &5195354181466942483 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1240851277759925011, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} m_PrefabInstance: {fileID: 5195354181466942481} m_PrefabAsset: {fileID: 0} ---- !u!114 &5195354181466942483 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5195354181466942482} + m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 65239890e888fd246a0b0985573deed6, type: 3} m_Name: m_EditorClassIdentifier: - Inventory: {fileID: 1804173232} - AnimationSpeed: 0.5 - TrayUI: {fileID: 1324620581} - Client: {fileID: 11400000, guid: 8dca4719b56d91143b236583a436c911, type: 2} - TimeText: {fileID: 1363815578} - Title: {fileID: 5195354181466942485} - TotalTime: 30 --- !u!224 &5195354181466942484 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 2665231842684883354, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} m_PrefabInstance: {fileID: 5195354181466942481} m_PrefabAsset: {fileID: 0} ---- !u!224 &5195354181466942485 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 2665231842396078511, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - type: 3} - m_PrefabInstance: {fileID: 5195354181466942481} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scenes/ColourCollide_Smaller.unity b/Assets/Scenes/ColourCollide_Smaller.unity index d4c6ecb..b16b6e3 100644 --- a/Assets/Scenes/ColourCollide_Smaller.unity +++ b/Assets/Scenes/ColourCollide_Smaller.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641222, b: 0.57481694, a: 1} + m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -2633,6 +2633,16 @@ PrefabInstance: propertyPath: m_LocalScale.z value: 1 objectReference: {fileID: 0} + - target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291, + type: 3} + propertyPath: isSpawnable + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291, + type: 3} + propertyPath: SpawnDirection + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3} --- !u!4 &742803853 stripped @@ -3129,7 +3139,12 @@ PrefabInstance: - target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291, type: 3} propertyPath: isSpawnable - value: 0 + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291, + type: 3} + propertyPath: SpawnDirection + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3} diff --git a/Assets/Scripts/Logic/Blocks/LogicBlock.cs b/Assets/Scripts/Logic/Blocks/LogicBlock.cs index c68b0a7..b1e5d4d 100644 --- a/Assets/Scripts/Logic/Blocks/LogicBlock.cs +++ b/Assets/Scripts/Logic/Blocks/LogicBlock.cs @@ -32,6 +32,9 @@ public abstract class LogicBlock : ScriptableObject #region ReadOnly Variables public string DisplayName { get { return (string.IsNullOrEmpty(_DisplayName)) ? name : _DisplayName; } } + + [HideInInspector] + public bool hasBeenRemoved = false; #endregion #region private variables @@ -144,7 +147,12 @@ public abstract class LogicBlock : ScriptableObject LogicBlock otherLogic = other as LogicBlock; return !Object.ReferenceEquals(null, otherLogic) - && int.Equals(RepeatCount, otherLogic.RepeatCount); + && string.Equals(name, otherLogic.name); + } + + public override int GetHashCode() + { + return name.GetHashCode(); } public virtual void OnDoubleClick() diff --git a/Assets/Scripts/Logic/Blocks/Move.cs b/Assets/Scripts/Logic/Blocks/Move.cs index 7336aa5..496b7a2 100644 --- a/Assets/Scripts/Logic/Blocks/Move.cs +++ b/Assets/Scripts/Logic/Blocks/Move.cs @@ -69,19 +69,6 @@ public class Move : LogicBlock return retVal; } - public override bool Equals(object other) - { - if (Object.ReferenceEquals(null, other)) - return false; - - if (Object.ReferenceEquals(other.GetType(), other)) - return false; - - Move otherMove = other as Move; - - return base.Equals(other)&& Direction.Equals(direction, otherMove.direction); - } - #endregion Class Functions } diff --git a/Assets/Scripts/LogicBlocks.meta b/Assets/Scripts/LogicBlocks.meta new file mode 100644 index 0000000..98af9d1 --- /dev/null +++ b/Assets/Scripts/LogicBlocks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8936b441d7647f74884c94f97bfb8931 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 60ed755..40c1566 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -99,7 +99,11 @@ public class GameManager : MonoBehaviour { if (!player.waiting) { - //player.client.Inventory.Remove(player.blockReader.CurrentBlock); + if (!player.blockReader.CurrentBlock.hasBeenRemoved) + { + player.client.Inventory.Remove(player.blockReader.CurrentBlock); + player.blockReader.CurrentBlock.hasBeenRemoved = true; + } player.waiting = player.blockReader.Read(player.character, AnimationTime); } }