Browse Source

Fixed some stuff + did a build

master
JoshuaReason 5 years ago
parent
commit
6a49087a02
8 changed files with 44 additions and 22 deletions
  1. +2
    -2
      Assets/Data/Inventory/BaseInventory.asset
  2. +3
    -0
      Assets/Data/Logic Blocks/For x3.asset
  3. +8
    -0
      Assets/Data/Logic Blocks/For x3.asset.meta
  4. +7
    -7
      Assets/Scenes/ColourCollide_Smaller.unity
  5. +19
    -11
      Assets/Scripts/Inventory.cs
  6. +2
    -1
      Assets/Scripts/Networking/Server/ClientList.cs
  7. +2
    -0
      Assets/Scripts/blockSpawn.cs
  8. +1
    -1
      ProjectSettings/EditorBuildSettings.asset

+ 2
- 2
Assets/Data/Inventory/BaseInventory.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:dc2df0d3b6567d4e6c80879edaa512a1b93ac778c0c4755d946260db33a5553a
size 1312
oid sha256:49cb56ea6ed3000bd95ae7c98fafcafe331c9466f2cc447162727559c85ac6ef
size 932

+ 3
- 0
Assets/Data/Logic Blocks/For x3.asset View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9582bbfac99debbc49e0a67fd4d9ca5252d6c8311d8348724aac41f13a7ba5ea
size 572

+ 8
- 0
Assets/Data/Logic Blocks/For x3.asset.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 57d435792b9c3504caa273c796738050
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

+ 7
- 7
Assets/Scenes/ColourCollide_Smaller.unity View File

@ -4372,20 +4372,20 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
spawnLogicList: spawnLogicList:
- element: {fileID: 11400000, guid: 8f19e10be0ee35345a97f600791a8747, type: 2}
Count: 1
isInfinit: 0
- element: {fileID: 11400000, guid: b5887451436a375419e538ef3706ecf9, type: 2} - element: {fileID: 11400000, guid: b5887451436a375419e538ef3706ecf9, type: 2}
Count: 1
Count: 2
isInfinit: 0 isInfinit: 0
- element: {fileID: 11400000, guid: ba4f7785390953441913d0e6f419d9b7, type: 2} - element: {fileID: 11400000, guid: ba4f7785390953441913d0e6f419d9b7, type: 2}
Count: 1
Count: 2
isInfinit: 0 isInfinit: 0
- element: {fileID: 11400000, guid: 0086f005a63e8404aaee25e4ae4734d7, type: 2} - element: {fileID: 11400000, guid: 0086f005a63e8404aaee25e4ae4734d7, type: 2}
Count: 1
Count: 2
isInfinit: 0 isInfinit: 0
- element: {fileID: 11400000, guid: e11629d4fbb1e8246b7d4f003800bfa0, type: 2} - element: {fileID: 11400000, guid: e11629d4fbb1e8246b7d4f003800bfa0, type: 2}
Count: 1
Count: 2
isInfinit: 0
- element: {fileID: 11400000, guid: 57d435792b9c3504caa273c796738050, type: 2}
Count: 2
isInfinit: 0 isInfinit: 0
ConnectedClients: [] ConnectedClients: []
clientDataList: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2} clientDataList: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2}

+ 19
- 11
Assets/Scripts/Inventory.cs View File

@ -16,15 +16,17 @@ public class Inventory : ScriptableObject
public System.Action OnItemsUpdated; 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, element = element,
Count = count, Count = count,
isInfinit = isInfinit };
isInfinit = isInfinit
};
Add(data);
Add(data);
} }
public void Add(Data data) public void Add(Data data)
@ -43,26 +45,30 @@ public class Inventory : ScriptableObject
OnItemsUpdated?.Invoke(); OnItemsUpdated?.Invoke();
} }
public void Remove(LogicBlock element) {
public void Remove(LogicBlock element)
{
if (!_bagItems.Exists(p => p.element.isSameType(element))) if (!_bagItems.Exists(p => p.element.isSameType(element)))
{ {
return; return;
} }
Data data = _bagItems.First(p => p.element.isSameType(element)); Data data = _bagItems.First(p => p.element.isSameType(element));
if (!data.isInfinit) if (!data.isInfinit)
{ {
data.Count--;
if (data.Count > data.minCount)
data.Count--;
if (data.Count <= 0) if (data.Count <= 0)
_bagItems.Remove(data); _bagItems.Remove(data);
} }
OnItemsUpdated?.Invoke(); OnItemsUpdated?.Invoke();
} }
@ -85,7 +91,7 @@ public class Inventory : ScriptableObject
foreach (Data data in copy.BagItems) 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); retVal._bagItems.Add(dataCopy);
} }
@ -98,16 +104,18 @@ public class Inventory : ScriptableObject
{ {
public LogicBlock element; public LogicBlock element;
public int Count; public int Count;
public int minCount;
public bool isInfinit = false; public bool isInfinit = false;
public Data() { } 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.element = element;
this.Count = Count; this.Count = Count;
this.isInfinit = isInfinit; this.isInfinit = isInfinit;
this.minCount = minCount;
} }
} }
} }

+ 2
- 1
Assets/Scripts/Networking/Server/ClientList.cs View File

@ -132,6 +132,7 @@ namespace Networking.Server
newClient.conn.Send(LoginProtocols.LoginSuccess, new LoginProtocols.LoginMsg(newClient.Name, newClient.Color, newClient.characterAnimal)); newClient.conn.Send(LoginProtocols.LoginSuccess, new LoginProtocols.LoginMsg(newClient.Name, newClient.Color, newClient.characterAnimal));
OnClientsChange.Invoke(ConnectedClients); OnClientsChange.Invoke(ConnectedClients);
newClient.SendInventory(); newClient.SendInventory();
newClient.SendScore();
newClient.ChangeScene("WaitScene"); newClient.ChangeScene("WaitScene");
} }
@ -174,7 +175,7 @@ namespace Networking.Server
/// <summary> /// <summary>
/// Clients number of collected items - for colelction level /// Clients number of collected items - for colelction level
/// </summary> /// </summary>
public int SceneScore;
public int SceneScore = 0;
/// <summary> /// <summary>
/// Network connection ID /// Network connection ID

+ 2
- 0
Assets/Scripts/blockSpawn.cs View File

@ -175,6 +175,8 @@ public class blockSpawn : MonoBehaviour
spawnposition += (weightings[i] * direction[i]); spawnposition += (weightings[i] * direction[i]);
Debug.Log("(weightings[i] * direction[i] " + (weightings[i] * direction[i])); Debug.Log("(weightings[i] * direction[i] " + (weightings[i] * direction[i]));
} }
spawnposition += Vector3.one * 0.5f;
Debug.Log("spawnposition " + spawnposition); Debug.Log("spawnposition " + spawnposition);
//spawn first block //spawn first block
checkLocation(spawnposition); checkLocation(spawnposition);

+ 1
- 1
ProjectSettings/EditorBuildSettings.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:de1dfe7ac3351ac8440f819f1ff6c8d128b2d829279c377e9da999802d4a5271
oid sha256:83facaec21f56f9ba82563caa613e5860306f393d754a52a739691c58365b6f1
size 1650 size 1650

Loading…
Cancel
Save