Browse Source

Merge branch 'master' of https://bitbucket.org/JoshuaReason/major-project-a

# Conflicts:
#	Assets/Prefabs/Map Sections/Start 4-player.prefab
master
s3607057 (Angus Niven) 4 years ago
parent
commit
98e81ec3be
35 changed files with 434 additions and 273 deletions
  1. +1
    -1
      Assets/Data/Inventory/BaseInventory.asset
  2. +3
    -0
      Assets/Data/Logic Blocks/Diagonal L.asset
  3. +0
    -0
      Assets/Data/Logic Blocks/Diagonal L.asset.meta
  4. +0
    -3
      Assets/Data/Logic Blocks/Diagonal Left.asset
  5. +3
    -0
      Assets/Data/Logic Blocks/Diagonal R.asset
  6. +0
    -0
      Assets/Data/Logic Blocks/Diagonal R.asset.meta
  7. +0
    -3
      Assets/Data/Logic Blocks/Diagonal Right.asset
  8. +0
    -3
      Assets/Data/Logic Blocks/For x2.asset
  9. +0
    -3
      Assets/Data/Logic Blocks/For x3.asset
  10. +0
    -8
      Assets/Data/Logic Blocks/For x3.asset.meta
  11. +3
    -0
      Assets/Data/Logic Blocks/Rotate L.asset
  12. +0
    -0
      Assets/Data/Logic Blocks/Rotate L.asset.meta
  13. +0
    -3
      Assets/Data/Logic Blocks/Rotate Left.asset
  14. +3
    -0
      Assets/Data/Logic Blocks/Rotate R.asset
  15. +1
    -1
      Assets/Data/Logic Blocks/Rotate R.asset.meta
  16. +0
    -3
      Assets/Data/Logic Blocks/Rotate Right.asset
  17. +0
    -8
      Assets/Data/Logic Blocks/Rotate Right.asset.meta
  18. +32
    -0
      Assets/Prefabs/GameManager.prefab
  19. +214
    -8
      Assets/Prefabs/Traps/CrushingBoulder.prefab
  20. +26
    -25
      Assets/Prefabs/Traps/InGroundTrap.prefab
  21. +7
    -2
      Assets/Prefabs/Traps/ShootingCannon + Block.prefab
  22. +2
    -2
      Assets/Scenes/Levels/RaceTrack Beta.unity
  23. +2
    -2
      Assets/Scenes/Menus/Lobby.unity
  24. +1
    -1
      Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs
  25. +1
    -1
      Assets/Scripts/LevelBlocks/Water.cs
  26. +10
    -2
      Assets/Scripts/Managers/GameManager.cs
  27. +22
    -23
      Assets/Scripts/Map Generation/MapManager.cs
  28. +1
    -1
      Assets/Scripts/Networking/Server/ServerObject.cs
  29. +1
    -1
      Assets/Scripts/Traps/ConveyorBelt.cs
  30. +17
    -18
      Assets/Scripts/Traps/CrushingBoulder.cs
  31. +12
    -13
      Assets/Scripts/Traps/CubeWithCrystals.cs
  32. +9
    -3
      Assets/Scripts/Traps/InGroundTrap.cs
  33. +14
    -9
      Assets/Scripts/Traps/ShootingCannon.cs
  34. +1
    -1
      Assets/Scripts/UI/Lobby/LobbyUIController.cs
  35. +48
    -125
      Assets/Scripts/blockSpawn.cs

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fb7987d63a59b05fb303834051f410599c5ebebb77dd2c8047b930403e9aac3f
oid sha256:ffe4ea933ab9da92364324d81c2749faee272a1748758219ee2fa21b503e5044
size 1059

+ 3
- 0
Assets/Data/Logic Blocks/Diagonal L.asset View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ab0be1c04b5733f302cf6294b114f646c748d72a57b95620f0e4476e557d576
size 871

Assets/Data/Logic Blocks/Diagonal Left.asset.meta → Assets/Data/Logic Blocks/Diagonal L.asset.meta View File


+ 0
- 3
Assets/Data/Logic Blocks/Diagonal Left.asset View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f00c98133cb05b40b3c72c41c5452d27952c118a795de5260f8dcad6fff2bd3
size 874

+ 3
- 0
Assets/Data/Logic Blocks/Diagonal R.asset View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:648c6ffd9ee4e98f5e736340c5636353e3f8329bf8f5663f785aa8124ed741a9
size 871

Assets/Data/Logic Blocks/Diagonal Right.asset.meta → Assets/Data/Logic Blocks/Diagonal R.asset.meta View File


+ 0
- 3
Assets/Data/Logic Blocks/Diagonal Right.asset View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:237c1f27581952747a883ad421b895ac34a794eff2abb2749fb2c4ff4052bb2a
size 875

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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:393d8fb1306335f183f74173908fb0c1e76fe2bf1979a837f371a508947102a1
size 550

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

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

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

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

+ 3
- 0
Assets/Data/Logic Blocks/Rotate L.asset View File

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

Assets/Data/Logic Blocks/Rotate Left.asset.meta → Assets/Data/Logic Blocks/Rotate L.asset.meta View File


+ 0
- 3
Assets/Data/Logic Blocks/Rotate Left.asset View File

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

+ 3
- 0
Assets/Data/Logic Blocks/Rotate R.asset View File

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

Assets/Data/Logic Blocks/For x2.asset.meta → Assets/Data/Logic Blocks/Rotate R.asset.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e11629d4fbb1e8246b7d4f003800bfa0
guid: 41f4cb946475b2849a802a8297d81e25
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

+ 0
- 3
Assets/Data/Logic Blocks/Rotate Right.asset View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b32afa87515fe3c4e3257ab206e53acc8d6233357467015b73535f27b56e2d3
size 652

+ 0
- 8
Assets/Data/Logic Blocks/Rotate Right.asset.meta View File

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

+ 32
- 0
Assets/Prefabs/GameManager.prefab View File

@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 1698745550996942701}
- component: {fileID: 1698745550996942698}
- component: {fileID: 3584776407301914954}
m_Layer: 0
m_Name: GameManager
m_TagString: Untagged
@ -49,3 +50,34 @@ MonoBehaviour:
type: 3}
server: {fileID: 11400000, guid: aba6c842adfc9904dba334cb48257361, type: 2}
ClientList: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2}
spawnBlock: {fileID: 3584776407301914954}
--- !u!114 &3584776407301914954
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1698745550996942700}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4bedcf540a02cd34886a443a80463285, type: 3}
m_Name:
m_EditorClassIdentifier:
spawnLogicList:
- element: {fileID: 11400000, guid: 752565cc5a95020498b9ed396343f3c0, type: 2}
Count: 1
minCount: 0
isInfinit: 0
- element: {fileID: 11400000, guid: efab8a199b362cb42b3e0bce70dd05f4, type: 2}
Count: 1
minCount: 0
isInfinit: 0
- element: {fileID: 11400000, guid: 8f19e10be0ee35345a97f600791a8747, type: 2}
Count: 1
minCount: 0
isInfinit: 0
- element: {fileID: 11400000, guid: b5887451436a375419e538ef3706ecf9, type: 2}
Count: 1
minCount: 0
isInfinit: 0
clientDataList: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2}

+ 214
- 8
Assets/Prefabs/Traps/CrushingBoulder.prefab View File

@ -237,6 +237,7 @@ Transform:
m_Children:
- {fileID: 6741087515541790872}
- {fileID: 6745622315908332759}
- {fileID: 7212950232714103513}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -252,25 +253,143 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 87ae70f1ec0c67743923bd4a83ee85d8, type: 3}
m_Name:
m_EditorClassIdentifier:
triggeranimate: 0
triggeranimate1: 0
VisualOffset: {x: 0, y: 0, z: 0}
is_Walkable: 0
isWater: 0
isPit: 0
isSpawnable: 0
SpawnDirection: 2
countdowntimer: 3
counter: {fileID: 6745622315908332755}
--- !u!1001 &6745622316608603784
--- !u!1001 &1839697205776302118
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 6745622317302131140}
m_TransformParent: {fileID: 7212950232714103513}
m_Modifications:
- target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3}
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_Name
value: Rock_2 (2)
value: Cube_GroundU
objectReference: {fileID: 0}
- target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3}
propertyPath: m_StaticEditorFlags
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!1001 &2825495671297622863
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 7212950232714103513}
m_Modifications:
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_Name
value: Cube_GroundL
objectReference: {fileID: 0}
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.y
value: -2
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!1001 &6745622316608603784
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 6745622317302131140}
m_Modifications:
- target: {fileID: 4614242176542224, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -323,6 +442,14 @@ PrefabInstance:
propertyPath: m_LocalScale.z
value: 1.2289
objectReference: {fileID: 0}
- target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3}
propertyPath: m_Name
value: Rock_2 (2)
objectReference: {fileID: 0}
- target: {fileID: 1252527896654764, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d2a34a5082f5c524b845ab11a78a7214, type: 3}
--- !u!4 &6741087515541790872 stripped
@ -331,3 +458,82 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 6745622316608603784}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &7212084370745998701
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 6745622317302131140}
m_Modifications:
- target: {fileID: 1141756196039588, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_Name
value: Cube_GroundWGrass (11)
objectReference: {fileID: 0}
- target: {fileID: 1141756196039588, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_TagString
value: Coloured
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalPosition.y
value: -2
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalRotation.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
--- !u!4 &7212950232714103513 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4490970058520500, guid: d7698c69246c64044ab2a94628bf0291,
type: 3}
m_PrefabInstance: {fileID: 7212084370745998701}
m_PrefabAsset: {fileID: 0}

+ 26
- 25
Assets/Prefabs/Traps/InGroundTrap.prefab View File

@ -32,7 +32,7 @@ Transform:
- {fileID: 3280778023726093299}
- {fileID: 3280778022459986741}
- {fileID: 3280778023471378434}
- {fileID: 1068379521905336273}
- {fileID: 59766719020348958}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -48,78 +48,79 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a1b0e7f03e96f154cb9c6ecd542406b7, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1063799847781320221
VisualOffset: {x: 0, y: 0, z: 0}
is_Walkable: 1
isWater: 0
isPit: 1
isSpawnable: 0
SpawnDirection: 2
--- !u!1001 &61813983148133772
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 3281312547625224782}
m_Modifications:
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 1745447707790088, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_Name
value: Cube_Pit
value: Cube_Lava
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalPosition.y
value: -0.84
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
- target: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6060536008043278799, guid: e5fac62723232674aa487c9073f1ca07,
type: 3}
propertyPath: is_Walkable
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6060536008043278799, guid: e5fac62723232674aa487c9073f1ca07,
- target: {fileID: 9117651094070773091, guid: 94b25f84ad255eb45ac650f2140605f6,
type: 3}
propertyPath: isPit
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!4 &1068379521905336273 stripped
m_SourcePrefab: {fileID: 100100000, guid: 94b25f84ad255eb45ac650f2140605f6, type: 3}
--- !u!4 &59766719020348958 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07,
m_CorrespondingSourceObject: {fileID: 4449718510517138, guid: 94b25f84ad255eb45ac650f2140605f6,
type: 3}
m_PrefabInstance: {fileID: 1063799847781320221}
m_PrefabInstance: {fileID: 61813983148133772}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3281312545920754357
PrefabInstance:

+ 7
- 2
Assets/Prefabs/Traps/ShootingCannon + Block.prefab View File

@ -24,7 +24,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6179448856766749154}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.5, y: -0.5, z: -0.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
@ -47,8 +47,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 44366bd8a25270844bdd9a5db9f2b0e0, type: 3}
m_Name:
m_EditorClassIdentifier:
VisualOffset: {x: 0, y: 0, z: 0}
is_Walkable: 0
isWater: 0
isPit: 0
isSpawnable: 0
SpawnDirection: 2
shootingRight: 1
triggeranimate: 0
shootingObject: {fileID: 3506936643819969965, guid: e8cf547bc36bd094f860f652fbe08047,
type: 3}
spawnLocation: {fileID: 6183695074135418386}

+ 2
- 2
Assets/Scenes/Levels/RaceTrack Beta.unity View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d5b17b077ec5bf78c41162b5e3c5024b0c8c06fc191232c67d00d4ec4a1de61f
size 30956
oid sha256:8be6d12cb624b41bbec4263d925f0ff9c62f13f2a60df314dae7bfa3c3132aeb
size 33586

+ 2
- 2
Assets/Scenes/Menus/Lobby.unity View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d468b9a3a6350ef29c53054b57586286bf9187c8023a26dc2b1add45b8465c0
size 46620
oid sha256:6f20ea3050a82f28cd55b2c1ff133057d302ec2ecec14f3f0b59477598461b08
size 45816

+ 1
- 1
Assets/Scripts/GameMode/ColorGameMode/RacetrackGameMode.cs View File

@ -197,7 +197,7 @@ public class RacetrackGameMode : GameMode
{
character.stuck = true;
}
Debug.Log("inWater = " + character.inWater + ", inPit = " + character.inPit + ", stuck = " + character.stuck);
//Debug.Log("inWater = " + character.inWater + ", inPit = " + character.inPit + ", stuck = " + character.stuck);
}
protected override void OnPlayerKilled(Character character, ClientData client)

+ 1
- 1
Assets/Scripts/LevelBlocks/Water.cs View File

@ -51,7 +51,7 @@ public class Water : ActiveBlock
public override IEnumerator OnRoundEnd(PlayerData[] allPlayers)
{
Debug.Log("reseting water");
//Debug.Log("reseting water");
if (trappedCharacter != null)
{

+ 10
- 2
Assets/Scripts/Managers/GameManager.cs View File

@ -29,6 +29,8 @@ public class GameManager : MonoBehaviour
[SerializeField]
private ClientList ClientList;
public blockSpawn spawnBlock;
#endregion Inspector Field
#region Private Variables
@ -52,6 +54,7 @@ public class GameManager : MonoBehaviour
private void Start()
{
spawnBlock = gameObject.GetComponent<blockSpawn>();
//Start Game
StartCoroutine(GameRoutine());
@ -84,6 +87,9 @@ public class GameManager : MonoBehaviour
//Allows game mode to instantiate anything it might need;
gameMode.PreGameStart();
//gets list of items to check spawn locations
spawnBlock.wakeup();
//Spawn Characters and tell let the GameMode do anything with the characters it might want
SpawnCharacters();
playerDataAsArray.ForEach(p => p.client.SendLives());
@ -98,7 +104,7 @@ public class GameManager : MonoBehaviour
//I hate having to do this
EnvironmentBlocks = FindObjectsOfType<ActiveBlock>();
Debug.Log("Active blocks found: " + EnvironmentBlocks.Length);
//Debug.Log("Active blocks found: " + EnvironmentBlocks.Length);
//Routine for players movement
yield return StartCoroutine(RoundRoutine()); //it's pretty long so it gets it's own coroutine;
@ -167,6 +173,8 @@ public class GameManager : MonoBehaviour
removePlayer(player);
}
}
//spawn collectible logic blocks
spawnBlock.Spawn();
//Reset some player Data
@ -246,7 +254,7 @@ public class GameManager : MonoBehaviour
int blockIndex = 0;
foreach (Block block in SpawnBlocks)
{
Debug.Log("Block #" + blockIndex++ + " (" + block.transform.position.x + ", " + block.transform.position.y + ", " + block.transform.position.z + ")");
//Debug.Log("Block #" + blockIndex++ + " (" + block.transform.position.x + ", " + block.transform.position.y + ", " + block.transform.position.z + ")");
}
//int spawnIndex = 0;

+ 22
- 23
Assets/Scripts/Map Generation/MapManager.cs View File

@ -55,11 +55,11 @@ public class MapManager : ScriptableObject
}
}
Debug.Log("sections.Count = " + sections.Count);
//Debug.Log("sections.Count = " + sections.Count);
foreach (MapSection section in sections)
{
Debug.Log("Possible section: " + section.name);
//Debug.Log("Possible section: " + section.name);
}
initialPlayerCount = clients.ConnectedClients.Count;
@ -182,14 +182,14 @@ public class MapManager : ScriptableObject
foreach (MapSection section in validSections)
{
Debug.Log("Valid section: " + section.name);
//Debug.Log("Valid section: " + section.name);
}/**/
Debug.Log("Choosing section");
//Debug.Log("Choosing section");
MapSection nextSection = validSections[(int)Random.Range(0.0f, (float)validSections.Count)];
Debug.Log("Chosen section: " + nextSection.name);
//Debug.Log("Chosen section: " + nextSection.name);
addSection(nextSection);
}
@ -221,29 +221,28 @@ public class MapManager : ScriptableObject
{
int connections = 0;
Debug.Log("Checking " + first.name + ", " + second.name);
//Debug.Log("Checking " + first.name + ", " + second.name);
//if (second.difficulty < diffMin || second.difficulty > diffMax)
if (second.difficultyMax < difficulty || second.difficultyMin > difficulty) //Check that we're in the right difficulty range for this section
{
Debug.Log("Difficulty = " + difficulty + ", max = " + second.difficultyMax + ", min = " + second.difficultyMin);
//Debug.Log("Difficulty = " + difficulty + ", max = " + second.difficultyMax + ", min = " + second.difficultyMin);
return false;
}
if (second.widthIn < widthMin || second.widthIn > widthMax) //And that it's in the right width range
{
Debug.Log("width = " + second.widthIn + ", max = " + widthMin + ", min = " + widthMax);
//Debug.Log("width = " + second.widthIn + ", max = " + widthMin + ", min = " + widthMax);
return false;
}
//Debug.Log("Checking sections: first = " + first.name + ", second = " + second.name);
////Debug.Log("Checking sections: first = " + first.name + ", second = " + second.name);
foreach (GameObject exit in first.exits)
{
foreach (GameObject entry in second.entrances)
{
Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
+ ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);/**/
//Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x+ ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);/**/
if (checkConnection(exit, entry))
{
connections++;
@ -251,15 +250,15 @@ public class MapManager : ScriptableObject
}
}
//Debug.Log("Connections = " + connections);
////Debug.Log("Connections = " + connections);
if (connections >= minConns)
{
//Debug.Log("Valid section!");
////Debug.Log("Valid section!");
}
else
{
//Debug.Log("Invalid section!");
////Debug.Log("Invalid section!");
}
return (connections >= minConns);
@ -267,12 +266,12 @@ public class MapManager : ScriptableObject
bool checkConnection(GameObject exit, GameObject entry)
{
/*Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
/*//Debug.Log("Checking connections: exit = " + exit.transform.localPosition.z + ", " + exit.transform.localPosition.x
+ ", entry = " + entry.transform.localPosition.z + ", " + entry.transform.localPosition.x);*/
//If the squares being checked don't line up, the connection is invalid
if (exit.transform.localPosition.z != entry.transform.localPosition.z)
{
//Debug.Log(exit.transform.localPosition.z + " != " + entry.transform.localPosition.z);
////Debug.Log(exit.transform.localPosition.z + " != " + entry.transform.localPosition.z);
return false;
}
@ -280,22 +279,22 @@ public class MapManager : ScriptableObject
//It's technically possible to cross two water blocks, but we don't count that
if (requiresJump(exit) && requiresJump(entry))
{
//Debug.Log("Invalid connection - both water");
////Debug.Log("Invalid connection - both water");
return false;
}
//Debug.Log("Exit.is_Walkable = " + exit.GetComponent<Block>().is_Walkable + ", Entry.is_Walkable = " + entry.GetComponent<Block>().is_Walkable);
////Debug.Log("Exit.is_Walkable = " + exit.GetComponent<Block>().is_Walkable + ", Entry.is_Walkable = " + entry.GetComponent<Block>().is_Walkable);
//Since we currently don't let people jump over walls, if either block is a wall, the connection is invalid
if (isWall(exit) || isWall(entry))
{
//Debug.Log("Invalid connection - not walkable");
////Debug.Log("Invalid connection - not walkable");
return false;
}
//Debug.Log("Exit.isWater = " + exit.GetComponent<Block>().isWater + ", Entry.isWater = " + entry.GetComponent<Block>().isWater);
////Debug.Log("Exit.isWater = " + exit.GetComponent<Block>().isWater + ", Entry.isWater = " + entry.GetComponent<Block>().isWater);
//Debug.Log("Valid connection!");
////Debug.Log("Valid connection!");
//If we've passed all these tests, the connection is valid!
return true;
@ -390,7 +389,7 @@ public class MapManager : ScriptableObject
{
if (clients.ConnectedClients.Count <= (float)(0.5f * initialPlayerCount))
{
Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count at half or below");
//Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count at half or below");
/*diffMin++;
diffMax++;*/
difficulty++;
@ -401,7 +400,7 @@ public class MapManager : ScriptableObject
if (clients.ConnectedClients.Count <= (float)(0.33f * initialPlayerCount))
{
Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count below 33%");
//Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count below 33%");
/*diffMin++;
diffMax += 2;*/
difficulty += 2;

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

@ -34,7 +34,7 @@ namespace Networking.Server {
{
LoginHandler.ConnectedClients = new List<ClientData>();
LoginHandler.DisconnectedClients = new List<ClientData>();
Debug.Log("Starting Server on " + port);
//Debug.Log("Starting Server on " + port);
server = new NetworkServerSimple();
server.useWebSockets = useWebSockets;

+ 1
- 1
Assets/Scripts/Traps/ConveyorBelt.cs View File

@ -20,7 +20,7 @@ public class ConveyorBelt : ActiveBlock
{
if (CurrentPlayer != null)
{
Debug.Log("currentPlayer: " + CurrentPlayer);
//Debug.Log("currentPlayer: " + CurrentPlayer);
yield return StartCoroutine(Action.Run(CurrentPlayer, 1,true));
}

+ 17
- 18
Assets/Scripts/Traps/CrushingBoulder.cs View File

@ -3,14 +3,16 @@ using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class CrushingBoulder : MonoBehaviour
public class CrushingBoulder : ActiveBlock
{
public bool triggeranimate;
public bool triggeranimate1;
public int countdowntimer;
public TextMeshPro counter;
int countdown;
public override int GetInitative()
{
return 3;
}
private void Start()
{
countdown = countdowntimer;
@ -19,6 +21,18 @@ public class CrushingBoulder : MonoBehaviour
{
counter.text = countdown.ToString();
}
public override IEnumerator OnEnvironmentTurn(PlayerData[] allPlayers)
{
countdown--;
if (countdown == 0)
{
StartCoroutine(FallRaiseCoroutine(-2.0f));
yield return new WaitForSeconds(5);
StartCoroutine(FallRaiseCoroutine(2.0f));
countdown = countdowntimer;
}
isFinished = true;
}
IEnumerator FallRaiseCoroutine(float dropDistance)
{
@ -34,19 +48,4 @@ public class CrushingBoulder : MonoBehaviour
}
transform.position = endPosition;
}
public void Animate()
{
countdown--;
if (countdown == 0)
{
StartCoroutine(FallRaiseCoroutine(-2.0f));
countdown = countdowntimer;
returnToPosition();
}
}
public void returnToPosition()
{
StartCoroutine(FallRaiseCoroutine(2.0f));
}
}

+ 12
- 13
Assets/Scripts/Traps/CubeWithCrystals.cs View File

@ -2,15 +2,22 @@
using System.Collections.Generic;
using UnityEngine;
public class CubeWithCrystals : MonoBehaviour
public class CubeWithCrystals : ActiveBlock
{
public GameObject crystals;
public bool triggeranimate;
public bool triggeranimate1;
private void Update()
public override int GetInitative()
{
return 3;
}
public override IEnumerator OnRoundEnd(PlayerData[] allPlayers)
{
StartCoroutine(GrowCoroutine());
yield return new WaitForSeconds(5);
StartCoroutine(ShrinkCoroutine());
isFinished = true;
//yield break;
}
IEnumerator GrowCoroutine()
@ -27,6 +34,7 @@ public class CubeWithCrystals : MonoBehaviour
}
crystals.transform.position = endPosition;
}
IEnumerator ShrinkCoroutine()
{
float elapsedTime = 0;
@ -41,13 +49,4 @@ public class CubeWithCrystals : MonoBehaviour
}
crystals.transform.position = endPosition;
}
public void Animate()
{
StartCoroutine(GrowCoroutine());
}
public void returnToPosition()
{
StartCoroutine(ShrinkCoroutine());
}
}

+ 9
- 3
Assets/Scripts/Traps/InGroundTrap.cs View File

@ -2,10 +2,16 @@
using System.Collections.Generic;
using UnityEngine;
public class InGroundTrap : MonoBehaviour
public class InGroundTrap : ActiveBlock
{
public void Animate()
public override int GetInitative()
{
Debug.Log("trap");
return 1;
}
public override IEnumerator OnRoundEnd(PlayerData[] allPlayers)
{
isFinished = true;
yield break;
}
}

+ 14
- 9
Assets/Scripts/Traps/ShootingCannon.cs View File

@ -4,16 +4,21 @@ using TMPro;
using UnityEngine;
public class ShootingCannon : MonoBehaviour
public class ShootingCannon : ActiveBlock
{
public bool shootingRight;
public bool triggeranimate;
public GameObject shootingObject;
public Transform spawnLocation;
public TextMeshPro counter;
public int countdowntimer;
int countdown;
public override int GetInitative()
{
//order
return 4;
}
private void Start()
{
countdown = countdowntimer;
@ -23,20 +28,20 @@ public class ShootingCannon : MonoBehaviour
counter.text = countdown.ToString();
}
public void Animate()
public override IEnumerator OnEnvironmentTurn(PlayerData[] allPlayers)
{
countdown--;
if (countdown == 0){
if (countdown == 0)
{
GameObject shot = Instantiate(shootingObject, spawnLocation.position, Quaternion.identity);
if (shootingRight == true)
{
if (shootingRight == true){
shot.GetComponent<Rigidbody>().AddForce(shot.transform.forward * -500);
}
else
{
}else{
shot.GetComponent<Rigidbody>().AddForce(shot.transform.forward * 500);
}
countdown = countdowntimer;
}
isFinished = true;
yield break;
}
}

+ 1
- 1
Assets/Scripts/UI/Lobby/LobbyUIController.cs View File

@ -42,7 +42,7 @@ public class LobbyUIController : MonoBehaviour
private void DisplayClients(List<ClientData> data)
{
Debug.Log("Updating Connected Clients");
//Debug.Log("Updating Connected Clients");
foreach (Transform child in Content)
if (child.gameObject != ClientTag)
Destroy(child.gameObject);

+ 48
- 125
Assets/Scripts/blockSpawn.cs View File

@ -7,47 +7,68 @@ public class blockSpawn : MonoBehaviour
{
[SerializeField]
public Inventory.Data[] spawnLogicList;
public List<ClientData> ConnectedClients;
List<ClientData> ConnectedClients;
public ClientList clientDataList;
public Block[] SpawnBlocks;
public List<Vector3> spawnedLocations;
int scoreDifference = 0;
float average = 0;
List<Vector3> spawnedLocations;
int min_z = -2, max_z = 2;
Vector3 spawnposition = new Vector3(0, 0, 0);
void Awake()
{
ConnectedClients = clientDataList.ConnectedClients;
SpawnBlocks = FindObjectsOfType<Block>().Where(p => p.is_Walkable).ToArray();
ConnectedClients = clientDataList.ConnectedClients;
spawnedLocations = new List<Vector3>();
}
public void wakeup()
{
SpawnBlocks = FindObjectsOfType<Block>().Where(p => p.is_Walkable).ToArray();
}
public void Spawn()
{
getPlayerScores();
getPlayerLocations(ConnectedClients.ToArray(), 0.75f);
//second spawning block only if needed
/* if (scoreDifference > average)
/*
Get all player locations, get leader(biggest x position value) and min value
+2 to each value, set as min and man in random.range()
add locations to a list to ensure no duplicates
check not over pit or hole
*/
ConnectedClients.Sort((b, a) => a.playerCharacter.transform.position.x.CompareTo(b.playerCharacter.transform.position.x));
int min_x = (int)ConnectedClients[ConnectedClients.Count - 1].playerCharacter.transform.position.x + 2;
int max_x = (int)ConnectedClients[0].playerCharacter.transform.position.x + 2;
for(int i = 0; i < 2; i++)
{
List<ClientData> lessClients = new List<ClientData>(ConnectedClients);
lessClients.RemoveAt(lessClients.Count - 1);
getPlayerLocations(lessClients.ToArray(), 0.6f);
}*/
spawnposition = new Vector3(Random.Range(min_x, max_x), -0.5f, Random.Range(min_z, max_z));
checkLocation(spawnposition);
}
}
private void getPlayerScores()
private void checkLocation(Vector3 spawnposition)
{
ConnectedClients.Sort((b, a) => a.Lives.CompareTo(b.Lives));
int totalScores = 0;
scoreDifference = ConnectedClients[0].Lives + ConnectedClients[ConnectedClients.Count-1].Lives;
//Debug.Log("score difference " + scoreDifference);
for(int i = 0; i < ConnectedClients.Count; i++)
bool duplicate = checkDuplicatePosition(spawnposition);
if (duplicate == false)
{
bool valid = checkValid(spawnposition);
if (valid == true)
{
spawnBlock(spawnposition);
}
else
{
//Block clostest = Utility.minBy(SpawnBlocks, p => Vector3.Distance(p.transform.position, spawnposition));
//checkLocation(new Vector3(spawnposition.x, spawnposition.y + 1.5f, spawnposition.z));
Debug.Log("Fail one");
}
}
else
{
totalScores += ConnectedClients[i].Lives;
//this needs to be changed
//Block clostest = Utility.minBy(SpawnBlocks, p => Vector3.Distance(p.transform.position, spawnposition));
//checkLocation(new Vector3(spawnposition.x, spawnposition.y + 1.5f, spawnposition.z));
Debug.Log("Fail two");
}
average = totalScores / ConnectedClients.Count;
//Debug.Log("score average " + average);
}
private bool checkDuplicatePosition(Vector3 spawnposition)
@ -67,6 +88,7 @@ public class blockSpawn : MonoBehaviour
private bool checkValid(Vector3 spawnposition)
{
//is over a walkable block
for (int i = 0; i < SpawnBlocks.Length; i++)
{
if (SpawnBlocks[i].position.x == spawnposition.x && SpawnBlocks[i].position.z == spawnposition.z)
@ -81,6 +103,7 @@ public class blockSpawn : MonoBehaviour
{
GameObject prefab = Resources.Load("Logic Block") as GameObject;
GameObject block = Instantiate(prefab);
spawnposition.y += 1.5f;
int number = (int)Random.Range(1.0f, spawnLogicList.Length);
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.element = spawnLogicList[number].element;
@ -89,104 +112,4 @@ public class blockSpawn : MonoBehaviour
Debug.Log("Instantiated new logic block: " + spawnLogicList[number].element + " at position: " + block.transform.position);
spawnedLocations.Add(spawnposition);
}
private void checkLocation(Vector3 spawnposition)
{
bool duplicate = false;
if (duplicate == false)
{
bool valid = checkValid(spawnposition);
if (valid == true)
{
spawnBlock(spawnposition);
}
else
{
Block clostest = Utility.minBy(SpawnBlocks, p => Vector3.Distance(p.transform.position, spawnposition));
checkLocation(new Vector3(clostest.position.x, clostest.position.y + 1.5f, clostest.position.z));
}
}
else
{
//this needs to be changed
Block clostest = Utility.minBy(SpawnBlocks, p => Vector3.Distance(p.transform.position, spawnposition));
checkLocation(new Vector3(clostest.position.x, clostest.position.y + 1.5f, clostest.position.z));
}
}
private void getPlayerLocations(ClientData[] clients, float weightMultiplier)
{
float[] weightings = new float[clients.Length];
if(clients.Length > 1)
{
Vector3 spawnposition = new Vector3(0, 0, 0);
for (int i = 0; i < clients.Length; i++)
{
spawnposition += clients[i].playerCharacter.CurrentBlock.VisualPosition;
//Debug.Log("currentBlock.VisualPosition " + clients[i].playerCharacter.CurrentBlock.VisualPosition);
}
spawnposition *= (1.0f / clients.Length);
//Debug.Log("spawnposition " + spawnposition);
Vector3[] direction = new Vector3[clients.Length];
for (int i = 0; i < clients.Length; i++)
{
direction[i] = (spawnposition - clients[i].playerCharacter.CurrentBlock.VisualPosition);
//Debug.Log("direction " + i + " " + direction[i]);
}
//weighting calculations
float[] difAvg = new float[clients.Length];
for (int i = 0; i < clients.Length; i++)
{
difAvg[i] = clients[i].Lives - average;
}
float[] ratio = new float[clients.Length];
//Debug.Log("difAvg[0] " + difAvg[0]);
if (difAvg[0] == 0)
{
for (int i = 0; i < clients.Length; i++)
{
weightings[i] = 0.5f * weightMultiplier;
//Debug.Log("weightings " + i + " " + weightings[i]);
}
}
else
{
for (int i = 0; i < clients.Length; i++)
{
ratio[i] = difAvg[i] / difAvg[0];
ratio[i] /= 2.0f;
ratio[i] += 0.5f;
weightings[i] = ratio[i] * weightMultiplier;
weightings[i] = Mathf.Clamp(weightings[i], 0, 1);
//Debug.Log("weightings " + i + " " + weightings[i]);
}
}
//multiply weightings by the direction
//take average point and add directions
for (int i = 0; i < clients.Length; i++)
{
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);
}
else
{
Vector2 playerOne = new Vector2(clients[0].playerCharacter.CurrentBlock.VisualPosition.x, clients[0].playerCharacter.CurrentBlock.VisualPosition.z);
int xVal = (int)Random.Range(-3.0f, 3.0f) + (int)playerOne.x;
int zVal = (int)Random.Range(-3.0f, 3.0f) + (int)playerOne.y;
checkLocation(new Vector3(xVal, 1.0f, zVal));
}
}
}

Loading…
Cancel
Save