From 6a49087a02106b0736224ee4327d5613d8063cc6 Mon Sep 17 00:00:00 2001 From: JoshuaReason Date: Thu, 30 May 2019 17:37:45 +1000 Subject: [PATCH] Fixed some stuff + did a build --- Assets/Data/Inventory/BaseInventory.asset | 4 +-- Assets/Data/Logic Blocks/For x3.asset | 3 ++ Assets/Data/Logic Blocks/For x3.asset.meta | 8 +++++ Assets/Scenes/ColourCollide_Smaller.unity | 14 ++++----- Assets/Scripts/Inventory.cs | 30 ++++++++++++------- .../Scripts/Networking/Server/ClientList.cs | 3 +- Assets/Scripts/blockSpawn.cs | 2 ++ ProjectSettings/EditorBuildSettings.asset | 2 +- 8 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 Assets/Data/Logic Blocks/For x3.asset create mode 100644 Assets/Data/Logic Blocks/For x3.asset.meta diff --git a/Assets/Data/Inventory/BaseInventory.asset b/Assets/Data/Inventory/BaseInventory.asset index 9ff8253..7ebe9bc 100644 --- a/Assets/Data/Inventory/BaseInventory.asset +++ b/Assets/Data/Inventory/BaseInventory.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc2df0d3b6567d4e6c80879edaa512a1b93ac778c0c4755d946260db33a5553a -size 1312 +oid sha256:49cb56ea6ed3000bd95ae7c98fafcafe331c9466f2cc447162727559c85ac6ef +size 932 diff --git a/Assets/Data/Logic Blocks/For x3.asset b/Assets/Data/Logic Blocks/For x3.asset new file mode 100644 index 0000000..46c400d --- /dev/null +++ b/Assets/Data/Logic Blocks/For x3.asset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9582bbfac99debbc49e0a67fd4d9ca5252d6c8311d8348724aac41f13a7ba5ea +size 572 diff --git a/Assets/Data/Logic Blocks/For x3.asset.meta b/Assets/Data/Logic Blocks/For x3.asset.meta new file mode 100644 index 0000000..8c34b9c --- /dev/null +++ b/Assets/Data/Logic Blocks/For x3.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57d435792b9c3504caa273c796738050 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/ColourCollide_Smaller.unity b/Assets/Scenes/ColourCollide_Smaller.unity index 75743a5..a8da334 100644 --- a/Assets/Scenes/ColourCollide_Smaller.unity +++ b/Assets/Scenes/ColourCollide_Smaller.unity @@ -4372,20 +4372,20 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: spawnLogicList: - - element: {fileID: 11400000, guid: 8f19e10be0ee35345a97f600791a8747, type: 2} - Count: 1 - isInfinit: 0 - element: {fileID: 11400000, guid: b5887451436a375419e538ef3706ecf9, type: 2} - Count: 1 + Count: 2 isInfinit: 0 - element: {fileID: 11400000, guid: ba4f7785390953441913d0e6f419d9b7, type: 2} - Count: 1 + Count: 2 isInfinit: 0 - element: {fileID: 11400000, guid: 0086f005a63e8404aaee25e4ae4734d7, type: 2} - Count: 1 + Count: 2 isInfinit: 0 - element: {fileID: 11400000, guid: e11629d4fbb1e8246b7d4f003800bfa0, type: 2} - Count: 1 + Count: 2 + isInfinit: 0 + - element: {fileID: 11400000, guid: 57d435792b9c3504caa273c796738050, type: 2} + Count: 2 isInfinit: 0 ConnectedClients: [] clientDataList: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2} diff --git a/Assets/Scripts/Inventory.cs b/Assets/Scripts/Inventory.cs index e0942bc..a07fe56 100644 --- a/Assets/Scripts/Inventory.cs +++ b/Assets/Scripts/Inventory.cs @@ -16,15 +16,17 @@ public class Inventory : ScriptableObject public System.Action OnItemsUpdated; - public void Add(LogicBlock element,int count = 1, bool isInfinit = false) + public void Add(LogicBlock element, int count = 1, bool isInfinit = false) { - Data data = new Data { + Data data = new Data + { element = element, Count = count, - isInfinit = isInfinit }; + isInfinit = isInfinit + }; - Add(data); + Add(data); } public void Add(Data data) @@ -43,26 +45,30 @@ public class Inventory : ScriptableObject OnItemsUpdated?.Invoke(); } - public void Remove(LogicBlock element) { + public void Remove(LogicBlock element) + { if (!_bagItems.Exists(p => p.element.isSameType(element))) { return; } - + Data data = _bagItems.First(p => p.element.isSameType(element)); if (!data.isInfinit) { - data.Count--; + if (data.Count > data.minCount) + data.Count--; + + if (data.Count <= 0) _bagItems.Remove(data); } - + OnItemsUpdated?.Invoke(); } @@ -85,7 +91,7 @@ public class Inventory : ScriptableObject foreach (Data data in copy.BagItems) { - Data dataCopy = new Data(data.element,data.Count,data.isInfinit); + Data dataCopy = new Data(data.element, data.Count, data.isInfinit,data.minCount); retVal._bagItems.Add(dataCopy); } @@ -98,16 +104,18 @@ public class Inventory : ScriptableObject { public LogicBlock element; public int Count; + public int minCount; public bool isInfinit = false; public Data() { } - public Data(LogicBlock element, int Count, bool isInfinit) - { + public Data(LogicBlock element, int Count, bool isInfinit, int minCount = 0) + { this.element = element; this.Count = Count; this.isInfinit = isInfinit; + this.minCount = minCount; } } } diff --git a/Assets/Scripts/Networking/Server/ClientList.cs b/Assets/Scripts/Networking/Server/ClientList.cs index c1be9fe..a1c3f81 100644 --- a/Assets/Scripts/Networking/Server/ClientList.cs +++ b/Assets/Scripts/Networking/Server/ClientList.cs @@ -132,6 +132,7 @@ namespace Networking.Server newClient.conn.Send(LoginProtocols.LoginSuccess, new LoginProtocols.LoginMsg(newClient.Name, newClient.Color, newClient.characterAnimal)); OnClientsChange.Invoke(ConnectedClients); newClient.SendInventory(); + newClient.SendScore(); newClient.ChangeScene("WaitScene"); } @@ -174,7 +175,7 @@ namespace Networking.Server /// /// Clients number of collected items - for colelction level /// - public int SceneScore; + public int SceneScore = 0; /// /// Network connection ID diff --git a/Assets/Scripts/blockSpawn.cs b/Assets/Scripts/blockSpawn.cs index d87f351..5ad00a7 100644 --- a/Assets/Scripts/blockSpawn.cs +++ b/Assets/Scripts/blockSpawn.cs @@ -175,6 +175,8 @@ public class blockSpawn : MonoBehaviour spawnposition += (weightings[i] * direction[i]); Debug.Log("(weightings[i] * direction[i] " + (weightings[i] * direction[i])); } + + spawnposition += Vector3.one * 0.5f; Debug.Log("spawnposition " + spawnposition); //spawn first block checkLocation(spawnposition); diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 9b47a3a..79bdfb5 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de1dfe7ac3351ac8440f819f1ff6c8d128b2d829279c377e9da999802d4a5271 +oid sha256:83facaec21f56f9ba82563caa613e5860306f393d754a52a739691c58365b6f1 size 1650