Browse Source

Added music,

Added remaining icons,
Edited the icon for the game to rounded corners,
Code and debug cleaning,
Done client and server build pushed to teams
master
ClairePeta 5 years ago
parent
commit
b21ed9040f
98 changed files with 521 additions and 1123 deletions
  1. +8
    -0
      Assets/Audio.meta
  2. +3
    -0
      Assets/Audio/Happy Thoughts.mp3
  3. +22
    -0
      Assets/Audio/Happy Thoughts.mp3.meta
  4. +2
    -2
      Assets/Data/Logic Blocks/Hook Shot.asset
  5. +2
    -2
      Assets/Data/Logic Blocks/Hook.asset
  6. +2
    -2
      Assets/Data/Logic Blocks/Water Replace.asset
  7. +3
    -0
      Assets/Resources/Missile.png
  8. +143
    -0
      Assets/Resources/Missile.png.meta
  9. +3
    -0
      Assets/Resources/Replace.png
  10. +143
    -0
      Assets/Resources/Replace.png.meta
  11. +2
    -2
      Assets/Scenes/Client Scenes/MainMenu Client.unity
  12. +2
    -2
      Assets/Scenes/Levels/RaceTrack Beta.unity
  13. +2
    -2
      Assets/Scenes/Menus/MainMenu Server.unity
  14. +2
    -2
      Assets/Scenes/Menus/Winner.unity
  15. +1
    -3
      Assets/Scripts/Billboard.cs
  16. +0
    -2
      Assets/Scripts/BlockInput.cs
  17. +3
    -45
      Assets/Scripts/Character.cs
  18. +1
    -5
      Assets/Scripts/Collectables/Collectable.cs
  19. +1
    -10
      Assets/Scripts/Collectables/LogicCollectable.cs
  20. +1
    -7
      Assets/Scripts/Collectables/LogicCollectable_Multiplayer.cs
  21. +1
    -3
      Assets/Scripts/ColourCollide.cs
  22. +15
    -0
      Assets/Scripts/DontDestroy.cs
  23. +1
    -1
      Assets/Scripts/DontDestroy.cs.meta
  24. +1
    -4
      Assets/Scripts/EnableCameraDepthInForward.cs
  25. +3
    -41
      Assets/Scripts/GameMode/GameMode.cs
  26. +2
    -4
      Assets/Scripts/GameMode/GameModeEvents.cs
  27. +1
    -3
      Assets/Scripts/GameMode/GameModeReference.cs
  28. +0
    -18
      Assets/Scripts/GameMode/TestGameMode.cs
  29. +0
    -11
      Assets/Scripts/GameMode/TestGameMode.cs.meta
  30. +1
    -7
      Assets/Scripts/GlobalVariables.cs
  31. +1
    -7
      Assets/Scripts/InGameNotificaion.cs
  32. +0
    -15
      Assets/Scripts/Inventory.cs
  33. +2
    -8
      Assets/Scripts/KeyboardInput.cs
  34. +0
    -11
      Assets/Scripts/LevelBlocks/Air.cs
  35. +0
    -4
      Assets/Scripts/LevelBlocks/Block.cs
  36. +0
    -8
      Assets/Scripts/Logic/BlockReader.cs
  37. +0
    -17
      Assets/Scripts/Logic/Blocks/CombinedBlock.cs
  38. +1
    -6
      Assets/Scripts/Logic/Blocks/EditableBlock.cs
  39. +0
    -12
      Assets/Scripts/Logic/Blocks/HookShot.cs
  40. +1
    -27
      Assets/Scripts/Logic/Blocks/Jump.cs
  41. +0
    -20
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  42. +0
    -6
      Assets/Scripts/Logic/Blocks/Move.cs
  43. +0
    -5
      Assets/Scripts/Logic/Blocks/Replace.cs
  44. +0
    -8
      Assets/Scripts/Logic/Blocks/Rotate.cs
  45. +1
    -5
      Assets/Scripts/Logic/Blocks/Shoot.cs
  46. +1
    -5
      Assets/Scripts/MainMenuControllerClient.cs
  47. +3
    -46
      Assets/Scripts/MainMenuControllerServer.cs
  48. +9
    -54
      Assets/Scripts/Managers/GameManager.cs
  49. +0
    -189
      Assets/Scripts/Managers/GameManagerRacetrack.cs
  50. +0
    -11
      Assets/Scripts/Managers/GameManagerRacetrack.cs.meta
  51. +1
    -101
      Assets/Scripts/Map Generation/MapManager.cs
  52. +1
    -16
      Assets/Scripts/Map Generation/MapSection.cs
  53. +1
    -2
      Assets/Scripts/Map Generation/SectionList.cs
  54. +1
    -4
      Assets/Scripts/Map Generation/TestGenerator.cs
  55. +1
    -5
      Assets/Scripts/NetworkOutput.cs
  56. +2
    -15
      Assets/Scripts/Networking/Client/ClientLoginManager.cs
  57. +1
    -5
      Assets/Scripts/Networking/Client/ClientObject.cs
  58. +2
    -8
      Assets/Scripts/Networking/Client/ClientOutputManager.cs
  59. +1
    -11
      Assets/Scripts/Networking/Client/ConnectedClients.cs
  60. +2
    -12
      Assets/Scripts/Networking/Core/Protocols/LogicProtocols.cs
  61. +0
    -2
      Assets/Scripts/PortalSetup.cs
  62. +0
    -11
      Assets/Scripts/Projectiles/HomingMissile.cs
  63. +0
    -8
      Assets/Scripts/Projectiles/Hookshot.cs
  64. +0
    -1
      Assets/Scripts/Projectiles/Projectile.cs
  65. +0
    -4
      Assets/Scripts/Traps/ConveyorBelt.cs
  66. +4
    -7
      Assets/Scripts/Traps/CrushingBoulder.cs
  67. +0
    -2
      Assets/Scripts/Traps/CubeWithCrystals.cs
  68. +0
    -5
      Assets/Scripts/Traps/FloatingOnWater.cs
  69. +0
    -2
      Assets/Scripts/Traps/InGroundTrap.cs
  70. +0
    -11
      Assets/Scripts/Traps/ShootingCannon.cs
  71. +0
    -4
      Assets/Scripts/Tutorial/TutorialSetup.cs
  72. +1
    -18
      Assets/Scripts/UI/BagItem.cs
  73. +2
    -6
      Assets/Scripts/UI/ColourSquareCollection.cs
  74. +1
    -11
      Assets/Scripts/UI/ComplexLogicElementUI.cs
  75. +1
    -2
      Assets/Scripts/UI/Dragable.cs
  76. +1
    -11
      Assets/Scripts/UI/ILogicElementHolder.cs
  77. +1
    -5
      Assets/Scripts/UI/InventoryCatch.cs
  78. +1
    -6
      Assets/Scripts/UI/InventoryUI.cs
  79. +1
    -6
      Assets/Scripts/UI/LeadPlayerUI.cs
  80. +1
    -6
      Assets/Scripts/UI/LocalUIManager.cs
  81. +1
    -9
      Assets/Scripts/UI/LogicElementUI.cs
  82. +2
    -30
      Assets/Scripts/UI/LogicTrayUI.cs
  83. +0
    -10
      Assets/Scripts/UI/MoveAndFade.cs
  84. +1
    -4
      Assets/Scripts/UI/NetworkedUIManager.cs
  85. +0
    -7
      Assets/Scripts/UI/PlayerUIManager.cs
  86. +1
    -7
      Assets/Scripts/UI/PreFilledText.cs
  87. +0
    -2
      Assets/Scripts/UI/ScoreBoard.cs
  88. +0
    -3
      Assets/Scripts/UI/levelInfoDisplay.cs
  89. +2
    -14
      Assets/Scripts/animalSelection.cs
  90. +4
    -22
      Assets/Scripts/blockSpawn.cs
  91. +0
    -24
      Assets/Scripts/portalTesting.cs
  92. +2
    -2
      Assets/Scripts/videoToUI.cs
  93. +0
    -1
      Assets/Scripts/winnerscene.cs
  94. +2
    -2
      Assets/Textures/Icon.png
  95. +62
    -7
      Assets/Textures/Icon.png.meta
  96. +24
    -27
      Assets/Third Party Assets/KUBIKOS - World/Prefabs/Items/Canon.prefab
  97. +1
    -1
      ProjectSettings/ProjectSettings.asset
  98. +2
    -2
      ProjectSettings/TagManager.asset

+ 8
- 0
Assets/Audio.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 018b5887d0b4f634795e7c4a9f79c40e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 3
- 0
Assets/Audio/Happy Thoughts.mp3 View File

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

+ 22
- 0
Assets/Audio/Happy Thoughts.mp3.meta View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c894a32c809dded47a635c915577297a
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 2
Assets/Data/Logic Blocks/Hook Shot.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c821221422a38d2cdeb8bf229b81065c7ebc7101c7198520d2866415f42892a
size 623
oid sha256:219e0d780b88bba660e8576f4e8ae64c0882f7f27d88c1f2e6b9e95a60294f90
size 588

+ 2
- 2
Assets/Data/Logic Blocks/Hook.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7782be9b087d45f14f38d5d7bab500769c6e345b45bb495f1b4f3af6838055ef
size 672
oid sha256:72faf863a96070d2ff5149692d8cf47b6352fdb9773dc8151d79d89b39fb0698
size 656

+ 2
- 2
Assets/Data/Logic Blocks/Water Replace.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8799c4127f4890332495e4d608afd5a9a48395eb1ec7eb8e6116550bdd623c9e
size 642
oid sha256:8522acce79038ac633b105d376d5a3f7433cf3d56bc226c3e504eec523b7138c
size 649

+ 3
- 0
Assets/Resources/Missile.png View File

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

+ 143
- 0
Assets/Resources/Missile.png.meta View File

@ -0,0 +1,143 @@
fileFormatVersion: 2
guid: 26bf910be038bc04a87ba50e2966f38d
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: tvOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

+ 3
- 0
Assets/Resources/Replace.png View File

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

+ 143
- 0
Assets/Resources/Replace.png.meta View File

@ -0,0 +1,143 @@
fileFormatVersion: 2
guid: 30c1c3b607bf75f438e60e96398840cb
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: tvOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 2
Assets/Scenes/Client Scenes/MainMenu Client.unity View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1efeb21e80c06b65ed3b88d8e0f75c9a24ab60971eba16c95c57fb844b0562eb
size 99673
oid sha256:8dd3410c3c14fb74b702d98b057457e4d468192cb02848c7986ec5a19537416d
size 99672

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:14354be5b52a9bfeb748f01bc7aaa0d11fdcfc67482cac90cbb7e0e71ca36b7a
size 36108
oid sha256:5d55c679cbf4a61b8fd1bd247cca637c9a4f56d3105ba39284d86dd4e68002b8
size 40997

+ 2
- 2
Assets/Scenes/Menus/MainMenu Server.unity View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c26e2383f4f76a433c73ae1b881400009a001b342586e8bcabd8131da95a2dd
size 142632
oid sha256:81882783cf5a376883ed9ca4f106b45f430a5c9af5cefe8480283c39fe2b3c41
size 145896

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:509192f175edae28e8dea6073f0204a67f0f22712a003c0823d549f06cafe6db
size 311656
oid sha256:9091ff85723439bf82fd8a798d4d537c7fc86e6ca6b88865477d66c0820806ab
size 311665

+ 1
- 3
Assets/Scripts/Billboard.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class Billboard : MonoBehaviour
{

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

@ -4,7 +4,6 @@ using UnityEngine;
public class BlockInput : MonoBehaviour
{
public Character character;
public BlockReader blockReader;
public float waitTime;
@ -43,5 +42,4 @@ public class BlockInput : MonoBehaviour
}
FinishedReading();
}
}

+ 3
- 45
Assets/Scripts/Character.cs View File

@ -1,8 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using Networking.Server;
using TMPro;
@ -23,7 +20,7 @@ public class Character : MonoBehaviour
public bool stuck = false; //Am I still stuck?
public bool justMoved = false; //Was the logic block I just executed a move command?
public bool inPit = false;
Vector3 death = new Vector3(Mathf.Infinity, 0, 0);
Vector3 death = new Vector3(9999, 0, 0);
#region Inspector Fields
[SerializeField]
@ -59,7 +56,6 @@ public class Character : MonoBehaviour
#endregion Read Only
#region Unity Functions
private void Start()
{
spawn = GameObject.Find("GameManager").GetComponent<blockSpawn>();
@ -84,17 +80,12 @@ public class Character : MonoBehaviour
if(lives < 1)
{
this.transform.position = death;
//this.enabled = false;
//gameObject.SetActive(false);
}
GetComponentInChildren<TextMeshPro>().text = runOrder.ToString();
}
#endregion Unity Functions
#region Class Implementation
public void Initialise(Block startingBlock, Inventory inventory, string Character)
{
_currentBlock = startingBlock;
@ -141,8 +132,6 @@ public class Character : MonoBehaviour
StopAnimation(animation);
}
public IEnumerator RotateInDirection(Direction direction,float angles, Animation animation, float time)
{
System.Func<float, float> yFunction = null;
@ -151,15 +140,11 @@ public class Character : MonoBehaviour
StartAnimation(animation, time);
//Debug.Log("Rotating by: " + angles);
yield return StartCoroutine(Rotate(direction,angles, time * 0.8f, yFunction));
StopAnimation(animation);
}
public IEnumerator AnimateToPosition(Vector3 position, Animation animation, float time)
{
System.Func<float, float> yFunction = null;
@ -231,18 +216,11 @@ public class Character : MonoBehaviour
this._currentBlock = respawnPosition;
respawnPosition.CurrentPlayer = this;
this.stuck = false;
Debug.Log("Moved " + this.name + " to "
+ this.transform.position.x + ", "
+ this.transform.position.y + ", "
+ this.transform.position.z + ", "
+ ", respawnNeeded = " + respawnNeeded
+ ", stuck = " + this.stuck);
}
else
{
Debug.Log("Failed to find anywhere to put " + this.name);
//Debug.Log("Failed to find anywhere to put " + this.name);
}
}
/// <summary>
@ -270,35 +248,23 @@ public class Character : MonoBehaviour
}
average /= livePlayerCount;
float tosend = lives + (transform.position.x - average);
//Debug.Log(transform.position.x + " - " + average + " =" + (transform.position.x - average));
//Debug.Log("Value to send: " + tosend);
spawn.assignLogicBlock(collectable.gameObject, tosend);
collectable.OnCollect(this);
}
}
#endregion Class Implementation
#region Private Functions
private IEnumerator LerpToBlock(Vector3 target, float time, System.Func<float, float> heightOffset = null)
{
Vector3 _startPos = transform.position;
Vector3 _endPos = target;
Vector3 _newPos;
float elapsedTime = 0;
while (elapsedTime / time < 1)
{
_newPos = Vector3.Lerp(_startPos, _endPos, (elapsedTime / time));
if (heightOffset != null)
@ -320,7 +286,6 @@ public class Character : MonoBehaviour
private IEnumerator Rotate(Direction direction, float angles, float time, System.Func<float, float> heightOffset = null)
{
int RotationDir = 0;
switch (direction)
{
@ -337,10 +302,8 @@ public class Character : MonoBehaviour
RotationDir = 2;
break;
}
lastRotation = angles * RotationDir;
float elapsedTime = 0;
float anglePerSecond = (angles * RotationDir) / time;
Vector3 _startPos = transform.position;
@ -361,10 +324,5 @@ public class Character : MonoBehaviour
if (heightOffset != null)
transform.position = _startPos + Vector3.up * heightOffset(1);
}
#endregion Private Functions
}
}

+ 1
- 5
Assets/Scripts/Collectables/Collectable.cs View File

@ -1,10 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public abstract class Collectable : MonoBehaviour
{
public abstract void OnCollect(Character character);
}

+ 1
- 10
Assets/Scripts/Collectables/LogicCollectable.cs View File

@ -1,12 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine;
using TMPro;
public class LogicCollectable : Collectable
{
[SerializeField]
protected Inventory.Data Collectable;
@ -23,13 +19,8 @@ public class LogicCollectable : Collectable
if (BlockMenu != null)
{
BlockMenu.SetActive(true);
Debug.Log("You picked up the new coding block " + Collectable.element.DisplayName + "!");
popUpText.text = Collectable.element.DisplayName.ToUpper();
}
Destroy(gameObject);
}
}

+ 1
- 7
Assets/Scripts/Collectables/LogicCollectable_Multiplayer.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class LogicCollectable_Multiplayer : Collectable
{
@ -10,11 +8,7 @@ public class LogicCollectable_Multiplayer : Collectable
public override void OnCollect (Character character)
{
character.Inventory.Add(Collectable);
Destroy (gameObject);
//send the message to the mobile of what block it picked up
}
}

+ 1
- 3
Assets/Scripts/ColourCollide.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class ColourCollide : MonoBehaviour
{

+ 15
- 0
Assets/Scripts/DontDestroy.cs View File

@ -0,0 +1,15 @@
using UnityEngine;
public class DontDestroy : MonoBehaviour
{
void Awake()
{
GameObject[] objs = GameObject.FindGameObjectsWithTag("Music");
if (objs.Length > 1)
{
Destroy(this.gameObject);
}
DontDestroyOnLoad(this.gameObject);
}
}

Assets/Scripts/portalTesting.cs.meta → Assets/Scripts/DontDestroy.cs.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 51774b69ca73ce6469c6a1d83fbcc234
guid: 8e272bbeaf109774d85345290e8d4111
MonoImporter:
externalObjects: {}
serializedVersion: 2

+ 1
- 4
Assets/Scripts/EnableCameraDepthInForward.cs View File

@ -1,9 +1,6 @@
//
// Attach this script to your camera in order to use depth nodes in forward rendering
//
// Attach this script to your camera in order to use depth nodes in forward rendering
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Camera))]
public class EnableCameraDepthInForward : MonoBehaviour {

+ 3
- 41
Assets/Scripts/GameMode/GameMode.cs View File

@ -6,7 +6,6 @@ using Networking.Server;
public abstract class GameMode : ScriptableObject
{
[SerializeField]
[Tooltip("Scene to load which contains Gamemode UI")]
private string GameModeScene;
@ -67,7 +66,6 @@ public abstract class GameMode : ScriptableObject
/// <param name="currentBlock">Block which the character finished on</param>
protected virtual void OnPlayerMoved(Character character, ClientData client, Block currentBlock) { }
protected virtual void OnPlayerKilled(Character character, ClientData client) { }
/// <summary>
@ -100,8 +98,7 @@ public abstract class GameMode : ScriptableObject
/// <param name="allPlayers">All players in game</param>
/// <returns>returns true if victory condition has been met</returns>
public abstract bool isGameOver(PlayerData[] allPlayers);
public float GetRoundTime()
{
float retVal = gameTimes[0];
@ -187,40 +184,5 @@ public abstract class GameMode : ScriptableObject
OnGameOver(allPlayers);
OnGameOverEvent?.Invoke();
}
}
#endregion Public Functions
/* --- Calls we need ---
*
* PreGameSetup(); - //Called once before the game actually starts
* GameStart(PlayerData[] AllPlayers); //Called once after players have Spawned
*
* OnInputStart(PlayerData[] AllPlayers) //Called when players enter input mode
* OnRecievedPlayerInput(PlayerData Player) //Called when a specific player has sent their input
* OnInputEnd(PlayerData[] AllPlayers) //Called when player input mode has finished
*
* OnRoundStart(PlayerData[] AllPlayers) //Just before Players start moving
*
* ------- Start Round Loop -------
*
* OnPlayerMoved(PlayerData player) //Called after each player moves
* IsGameOver(PlayerData[] AllPlayers) //Called after each player moves
*
* AllPlayersMoved(PlayerData[] AllPlayers) //Called after all players have moved
* EnvironmentTurn() //Also called after all players have moved but should be kept specialised to environment stuff
* IsGameOver(PlayerData[] AllPlayers) //We need to check if the environment terminated the game
*
* --------- End Game Loop ---------
*
* OnRoundEnd(PlayerData[] AllPlayers) //Called after movements are made
* IsGameOver(PlayerData[] AllPlayers) //This needs to be checked again
*
* GameEnd(PlayerData[] AllPlayers)
*
*
*
*
*
*/
#endregion Public Functions
}

+ 2
- 4
Assets/Scripts/GameMode/GameModeEvents.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using UnityEngine.Events;
public class GameModeEvents : MonoBehaviour
@ -17,7 +15,6 @@ public class GameModeEvents : MonoBehaviour
public UnityEvent OnRoundEnd = new UnityEvent();
public UnityEvent OnGameOver = new UnityEvent();
private void OnEnable()
{
Reference.Value.GameStartEvent += GameStart;
@ -57,6 +54,7 @@ public class GameModeEvents : MonoBehaviour
{
OnRoundEnd.Invoke();
}
private void GameOver()
{
OnGameOver.Invoke();

+ 1
- 3
Assets/Scripts/GameMode/GameModeReference.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/GameMode Refence", order = 201)]
public class GameModeReference : ScriptableObject

+ 0
- 18
Assets/Scripts/GameMode/TestGameMode.cs View File

@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestGameMode : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

+ 0
- 11
Assets/Scripts/GameMode/TestGameMode.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: efa4d444fe1d14e4daf014fc89bfc971
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 7
Assets/Scripts/GlobalVariables.cs View File

@ -1,13 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class GlobalVariables
public static class GlobalVariables
{
public static bool soundVolume = true;
public static bool musicVolume = true;
public static bool playerMoves = true;
public static int difficulty = 1;
public static string winnername = "Claire";
public static string winneranimal = "Cat";
}

+ 1
- 7
Assets/Scripts/InGameNotificaion.cs View File

@ -1,27 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine;
public class InGameNotificaion : MonoBehaviour
{
public GameObject BlockMenu;
public GameObject WelcomeMenu;
//On Awake
private void Awake ()
{
WelcomeMenu.SetActive (true);
BlockMenu.SetActive (false);
}
//Welcome Menu Options
public void OnPlayClick ()
{
WelcomeMenu.SetActive (false);
}
//Block Menu Options
public void OnContinueClick ()
{
BlockMenu.SetActive (false);

+ 0
- 15
Assets/Scripts/Inventory.cs View File

@ -1,5 +1,4 @@
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -18,20 +17,17 @@ public class Inventory : ScriptableObject
public void Add(LogicBlock element, int count = 1, bool isInfinit = false)
{
Data data = new Data
{
element = element,
Count = count,
isInfinit = isInfinit
};
Add(data);
}
public void Add(Data data)
{
if (_bagItems.Exists(p => p.element.isSameType(data.element)))
{
Data bagData = BagItems.Find(p => p.element.isSameType(data.element));
@ -47,14 +43,10 @@ public class Inventory : ScriptableObject
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)
@ -62,13 +54,9 @@ public class Inventory : ScriptableObject
if (data.Count > data.minCount)
data.Count--;
if (data.Count <= 0)
_bagItems.Remove(data);
}
OnItemsUpdated?.Invoke();
}
@ -94,11 +82,9 @@ public class Inventory : ScriptableObject
Data dataCopy = new Data(data.element, data.Count, data.isInfinit,data.minCount);
retVal._bagItems.Add(dataCopy);
}
return retVal;
}
[System.Serializable]
public class Data
{
@ -107,7 +93,6 @@ public class Inventory : ScriptableObject
public int minCount;
public bool isInfinit = false;
public Data() { }
public Data(LogicBlock element, int Count, bool isInfinit, int minCount = 0)

+ 2
- 8
Assets/Scripts/KeyboardInput.cs View File

@ -1,13 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
/// <summary>
/// Debug class for controlling a character with keyboard input
/// </summary>
public class KeyboardInput : MonoBehaviour
{
#region Inspector Fields
[SerializeField]
[Tooltip("Character to move")]
@ -17,7 +14,6 @@ public class KeyboardInput : MonoBehaviour
#endregion Unity Functions
#region Unity Functions
// Update is called once per frame
void Update()
{
if (character == null)
@ -33,14 +29,12 @@ public class KeyboardInput : MonoBehaviour
}
if (Input.GetKeyDown(KeyCode.UpArrow))
{
float outTime;
Move move = (Move)ScriptableObject.CreateInstance(typeof(Move));
StartCoroutine(move.Run(character, characterSpeed));
Destroy(move);
}
if (Input.GetKeyDown(KeyCode.Space))
{
float outTime;
Jump jump = (Jump)ScriptableObject.CreateInstance(typeof(Jump));
StartCoroutine(jump.Run(character, characterSpeed));
Destroy(jump);
@ -55,4 +49,4 @@ public class KeyboardInput : MonoBehaviour
}
#endregion Unity Functions
}
}

+ 0
- 11
Assets/Scripts/LevelBlocks/Air.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Air : ActiveBlock
@ -23,14 +22,9 @@ public class Air : ActiveBlock
//Very hacky, but it solved a weird bug where falling off the left-hand-side of the track didn't kill you, it just got you stuck down there forever
//You have to leave the camera's sight in order to die from falling
yield return StartCoroutine(player.AnimateToPosition(transform.position + Vector3.down * fallingDistance,Character.Animation.Hit, fallingAnimationTime));
//yield return StartCoroutine(LerpScale(player.transform, Vector3.zero, fallingAnimationTime));
yield return StartCoroutine(player.AnimateToPosition(transform.position + Vector3.down * 100, Character.Animation.Hit, 0.01f));
//player.gameObject.SetActive(false);
Debug.Log("Set player scale to one");
player.transform.localScale = Vector3.one;
}
public override IEnumerator OnRoundEnd(PlayerData[] allPlayers)
@ -43,25 +37,20 @@ public class Air : ActiveBlock
if (DeleteCount == 0)
Destroy(gameObject);
}
yield break;
}
private IEnumerator LerpScale(Transform target, Vector3 endScale, float time)
{
Vector3 startScale = target.localScale;
float elapsedTime = 0;
while(elapsedTime < time)
{
target.localScale = Vector3.Slerp(startScale, endScale, (elapsedTime / time));
yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime;
}
target.localScale = endScale;
}
}

+ 0
- 4
Assets/Scripts/LevelBlocks/Block.cs View File

@ -261,12 +261,8 @@ public class Block : MonoBehaviour
return retVal;
GameObject airBlock = Resources.Load<GameObject>("Cube_Air");
Debug.Log(airBlock, airBlock);
GameObject newBlock = Instantiate(airBlock);
newBlock.name = "AIR_BLOCK";
Debug.Log(newBlock, newBlock);
newBlock.transform.position = position;
return newBlock.GetComponent<Air>();

+ 0
- 8
Assets/Scripts/Logic/BlockReader.cs View File

@ -8,7 +8,6 @@ using UnityEngine;
[System.Serializable]
public class BlockReader
{
#region Inspector Variables
[SerializeField]
[Tooltip("List of LogicBlocks which will affected this character")]
@ -35,7 +34,6 @@ public class BlockReader
/// Sum of size of all Blocks in the chain
/// </summary>
public int Length { get { int retVal = 0; LogicChain.ForEach(p => retVal += p.Size()); return retVal; } }
#endregion Read-only Variables
#region Private Variables
@ -82,11 +80,7 @@ public class BlockReader
{
currentBlockIndex++;
currentBlock.Reset();
}
//Should other readers wait for this one
//return (runAgainNot || !currentBlock.WaitUntilFinished);
}
/// <summary>
@ -132,7 +126,5 @@ public class BlockReader
if (OnUpdate != null)
OnUpdate.Invoke();
}
#endregion
}

+ 0
- 17
Assets/Scripts/Logic/Blocks/CombinedBlock.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Combined Block")]
@ -7,10 +6,6 @@ using UnityEngine;
public class CombinedBlock : LogicBlock
{
#region Inspector Variables
//[SerializeField]
//[Tooltip("Is this block editable")]
//public bool isEditable = false;
[SerializeField]
[Tooltip("Blocks this will run through")]
public BlockReader blockReader = new BlockReader();
@ -20,11 +15,6 @@ public class CombinedBlock : LogicBlock
public override bool WaitUntilFinished { get { if (blockReader != null && blockReader.CurrentBlock != null) return (blockReader.CurrentBlock.WaitUntilFinished || base.WaitUntilFinished); else return base.WaitUntilFinished; } }
#endregion
#region Private Variables
#endregion Private Variables
public override IEnumerator Run(Character player, float animationTime, bool useBlockDirection = false)
{
BlockLogic(player,animationTime);
@ -35,7 +25,6 @@ public class CombinedBlock : LogicBlock
{
yield return player.StartCoroutine(blockReader.Read(player, animationTime / SpeedMultiplier));
}
}
else
{
@ -54,7 +43,6 @@ public class CombinedBlock : LogicBlock
yield break;
}
/// <summary>
/// Returns the block that the character will endUp on after they use this logic element
/// </summary>
@ -75,8 +63,6 @@ public class CombinedBlock : LogicBlock
blockReader.Reset();
}
public override LogicBlock Clone()
{
CombinedBlock retVal = base.Clone() as CombinedBlock;
@ -88,8 +74,6 @@ public class CombinedBlock : LogicBlock
return retVal;
}
#region Serialisation Functions
public override void CopyToken(BlockToken token)
{
@ -115,7 +99,6 @@ public class CombinedBlock : LogicBlock
return retVal;
}
#endregion Serialisation Functions
}
[System.Serializable]

+ 1
- 6
Assets/Scripts/Logic/Blocks/EditableBlock.cs View File

@ -1,11 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Editable Block")]
public class EditableBlock : CombinedBlock
{
public override LogicBlock[] GetAllBlocks()
{
List<LogicBlock> retVal = new List<LogicBlock>();
@ -25,7 +23,4 @@ public class EditableBlock : CombinedBlock
return retVal;
}
}

+ 0
- 12
Assets/Scripts/Logic/Blocks/HookShot.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Pick Ups/HookShot Block")]
@ -44,25 +43,17 @@ public class HookShot : LogicBlock
{
return Block.GetOrCreateBlockAtPosition(position - Direction.ToVector(transform), 1, layerMask);
}
}
return retVal;
}
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
Block hitBlock = GetEndBlock(player.CurrentBlock, player.transform, ~player.Ignore);
//Debug.Log("hookshot: " + hitBlock.position, hitBlock.gameObject);
if (hitBlock == player.CurrentBlock)
yield break;
//Debug.Log("Instantiating shot");
GameObject shot = GameObject.CreatePrimitive(PrimitiveType.Sphere);
shot.transform.localScale = Vector3.one * 0.33f;
yield return player.StartCoroutine(lerpShot(shot.transform, player.transform.position, hitBlock.VisualPosition,ShotSpeed));
@ -81,7 +72,6 @@ public class HookShot : LogicBlock
private IEnumerator lerpShot(Transform target, Vector3 startPosition,Vector3 endPosition, float time)
{
float elapsedTime = 0;
while (elapsedTime < time)
@ -91,7 +81,6 @@ public class HookShot : LogicBlock
yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime;
}
target.position = endPosition;
}
@ -115,7 +104,6 @@ public class HookShot : LogicBlock
return retVal;
}
}
[System.Serializable]

+ 1
- 27
Assets/Scripts/Logic/Blocks/Jump.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
@ -9,7 +8,6 @@ using UnityEngine;
[System.Serializable]
public class Jump : LogicBlock
{
[SerializeField]
[Tooltip("Direction to Jump")]
protected Direction direction = Direction.Forward;
@ -23,15 +21,12 @@ public class Jump : LogicBlock
protected int Height = 1;
#region Class Functions
/// <summary>
/// Implementation of BlockLogic, moves the player forward
/// </summary>
/// <param name="player">Player to move</param>
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
//player.Jump(direction, animationTime);
player.justMoved = true;
Block endBlock = GetEndBlock(player.CurrentBlock, player.transform, ~player.Ignore);
@ -41,9 +36,7 @@ public class Jump : LogicBlock
endBlock.CurrentPlayer.StartAnimation(Character.Animation.Hit);
endBlock = GetEndBlock(endBlock, player.transform, ~player.Ignore);
}
yield return player.StartCoroutine(player.MoveToBlock(endBlock, Character.Animation.Jump, animationTime));
}
/// <summary>
@ -60,8 +53,6 @@ public class Jump : LogicBlock
else
return JumpLong(startBlock, transform, layerMask);
}
#endregion Class Functions
#region Helper Functions
@ -69,7 +60,6 @@ public class Jump : LogicBlock
{
//setting up variables
Vector3 position; // position wanted
Block hit; //output of block detection
Block retVal = StartBlock; //block we'll actually move to
//Check blocks in front until we hit an obstruction or went the distance
@ -82,16 +72,7 @@ public class Jump : LogicBlock
if (Block.isBlockAtPosition(position + Vector3.up, 1, layerMask))
break;
retVal = Block.GetOrCreateBlockAtPosition(position, 1, layerMask);
////If block at Position is walkable set it to last known position
//if (Block.isBlockAtPosition(position, 1, layerMask, out hit) && hit.isWalkable(layerMask))
// retVal = hit;
////else if block down one is walkable
//else if (Block.isBlockAtPosition(position + Vector3.down, 1, layerMask, out hit) && hit.isWalkable(layerMask))
// retVal = hit;
}
return retVal;
@ -119,15 +100,10 @@ public class Jump : LogicBlock
if (Block.isBlockAtPosition(position, 1, layerMask, out hit) && hit.isWalkable(layerMask))
retVal = hit;
}
return retVal;
}
#endregion Helper Functions
#region Serialisation functions
public override void CopyToken(BlockToken token)
{
@ -146,6 +122,4 @@ public class Jump : LogicBlock
return retVal;
}
#endregion Serialisation functions
}
}

+ 0
- 20
Assets/Scripts/Logic/Blocks/LogicBlock.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
@ -8,7 +7,6 @@ using UnityEngine;
[System.Serializable]
public abstract class LogicBlock : ScriptableObject
{
#region Inspector Fields
[SerializeField]
[Header("UI Settings")]
@ -31,7 +29,6 @@ public abstract class LogicBlock : ScriptableObject
[SerializeField]
[Tooltip("Speed this block will be played back at. (Default = 1)")]
protected float SpeedMultiplier = 1;
#endregion Inspector Fields
#region ReadOnly Variables
@ -44,12 +41,10 @@ public abstract class LogicBlock : ScriptableObject
#endregion
#region private variables
/// <summary>
/// Amount of times this block has run
/// </summary>
protected int RepeatCount = 0;
#endregion private variables
#region Class Functions
@ -60,9 +55,7 @@ public abstract class LogicBlock : ScriptableObject
/// <returns>returns true if block is finished</returns>
public virtual IEnumerator Run(Character player, float animationSpeed,bool useBlockDirection = false)
{
float TotalAnimationTime = animationSpeed / SpeedMultiplier;
if(GlobalVariables.playerMoves == true){
player.DisplayBlock(this);
@ -162,7 +155,6 @@ public abstract class LogicBlock : ScriptableObject
}
#endregion Serialisation Functions
public bool isSameType(object other)
{
if (Object.ReferenceEquals(null, other))
@ -188,27 +180,18 @@ public abstract class LogicBlock : ScriptableObject
{
return new LogicBlock[] { this };
}
#endregion Class Functions
}
[System.Serializable]
public class BlockToken
{
public System.Type blockType;
public Color Color;
public string _DisplayName;
public string ObjectName;
public bool WaitUntilFinished;
public int RepeatAmount;
public float SpeedMultiplier;
public BlockToken(LogicBlock block)
@ -218,11 +201,8 @@ public class BlockToken
public LogicBlock ToLogicBlock()
{
LogicBlock retVal = (LogicBlock)ScriptableObject.CreateInstance(blockType);
retVal.CopyToken(this);
return retVal;
}
}

+ 0
- 6
Assets/Scripts/Logic/Blocks/Move.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
@ -9,12 +8,10 @@ using UnityEngine;
[System.Serializable]
public class Move : LogicBlock
{
[SerializeField]
protected Direction direction = Direction.Forward;
#region Class Functions
/// <summary>
/// Implementation of BlockLogic, moves the player forward
/// </summary>
@ -28,7 +25,6 @@ public class Move : LogicBlock
endBlock = GetEndBlock(player.CurrentBlock, player.CurrentBlock.transform, ~player.Ignore);
else
endBlock = GetEndBlock(player.CurrentBlock, player.transform, ~player.Ignore);
yield return player.StartCoroutine(player.MoveToBlock(endBlock, Character.Animation.Walk, animationTime));
}
@ -41,7 +37,6 @@ public class Move : LogicBlock
/// <returns></returns>
public override Block GetEndBlock(Block startBlock,Transform tranform, LayerMask layerMask)
{
DebugExtensions.DrawCube(startBlock.position, Vector3.one / 2, Color.red, 3, false);
Vector3 wantedPosition = startBlock.position + direction.ToVector(tranform); // position wanted
@ -70,7 +65,6 @@ public class Move : LogicBlock
return retVal;
}
#endregion Class Functions
}

+ 0
- 5
Assets/Scripts/Logic/Blocks/Replace.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Pick Ups/Replace Block")]
@ -43,15 +42,11 @@ public class Replace : LogicBlock
return retVal;
}
}
[System.Serializable]
public class ReplaceToken : BlockToken
{
public string prefabName;
public ReplaceToken(LogicBlock block) : base(block) { }
}

+ 0
- 8
Assets/Scripts/Logic/Blocks/Rotate.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
@ -20,18 +19,13 @@ public class Rotate : LogicBlock
protected int Angle = 90;
#endregion Inspector Fields
#region Class Functions
/// <summary>
/// Rotates the player in the direction specified by this block
/// </summary>
/// <param name="player">Player to rotate</param>
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
//player.Rotate(direction, animationTime);
//Debug.Log("Rotating by: " + Angle);
yield return player.StartCoroutine(player.RotateInDirection(direction,Angle, Character.Animation.Jump, animationTime));
}
@ -63,10 +57,8 @@ public class Rotate : LogicBlock
retVal.direction = direction;
retVal.angle = Angle;
return retVal;
}
#endregion Class Functions
}

+ 1
- 5
Assets/Scripts/Logic/Blocks/Shoot.cs View File

@ -1,8 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Pick Ups/Shoot Block")]
[System.Serializable]
public class Shoot : LogicBlock
@ -22,7 +20,6 @@ public class Shoot : LogicBlock
return startBlock;
}
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
Projectile newProjectile = Instantiate(Projectile, player.transform.position, player.transform.rotation);
@ -58,7 +55,6 @@ public class Shoot : LogicBlock
return retVal;
}
}
[System.Serializable]
@ -68,4 +64,4 @@ public class ShotToken : BlockToken
public string prefabName;
public ShotToken(LogicBlock block) : base(block) { }
}
}

+ 1
- 5
Assets/Scripts/MainMenuControllerClient.cs View File

@ -1,7 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine;
public class MainMenuControllerClient : MonoBehaviour
{
@ -9,7 +6,6 @@ public class MainMenuControllerClient : MonoBehaviour
public GameObject HowToPlayMenu;
public GameObject HowToPlayMenu_inventory;
//On Awake
private void Awake ()
{
MainMenu.SetActive (true);

+ 3
- 46
Assets/Scripts/MainMenuControllerServer.cs View File

@ -7,13 +7,10 @@ public class MainMenuControllerServer : MonoBehaviour
public GameObject SettingsMenu;
public GameObject AboutMenu;
public GameObject CreditsMenu;
public Button SoundButton;
public Button MusicButton;
public Button DifficultyButton;
public Button playerMovesButton;
public AudioSource backgroundMusic;
//On Awake
private void Awake()
{
MainMenu.SetActive(true);
@ -22,7 +19,6 @@ public class MainMenuControllerServer : MonoBehaviour
CreditsMenu.SetActive(false);
}
//Main Menu Options
public void OnPlayClick()
{
UnityEngine.SceneManagement.SceneManager.LoadScene("Lobby");
@ -34,95 +30,56 @@ public class MainMenuControllerServer : MonoBehaviour
public void OnAboutClick()
{
//toggle which menu displays
MainMenu.SetActive(false);
AboutMenu.SetActive(true);
}
public void OnCreditClick()
{
//toggle which menu displays
MainMenu.SetActive(false);
CreditsMenu.SetActive(true);
}
public void OnSettingsClick()
{
//toggle which menu displays
MainMenu.SetActive(false);
SettingsMenu.SetActive(true);
}
//Settings Menu
public void OnBackSettingsClick ()
{
//Settings menu
SettingsMenu.SetActive (false);
MainMenu.SetActive (true);
}
public void OnBackAboutClick ()
{
//about menu
AboutMenu.SetActive (false);
MainMenu.SetActive (true);
}
public void OnBackCreditClick ()
{
//about menu
CreditsMenu.SetActive (false);
MainMenu.SetActive (true);
}
//Settings menu
public void OnMusicVolumeClick()
{
if (GlobalVariables.musicVolume == true)
{
//backgroundMusic.Stop();
backgroundMusic.Stop();
MusicButton.GetComponentInChildren<Text>().text = "Music Volume: OFF";
GlobalVariables.musicVolume = false;
}
else
{
//backgroundMusic.Play();
backgroundMusic.Play();
MusicButton.GetComponentInChildren<Text>().text = "Music Volume: ON";
GlobalVariables.musicVolume = true;
}
}
//Settings menu
public void OnSoundVolumeClick ()
{
if (GlobalVariables.soundVolume == true) {
SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: OFF";
GlobalVariables.soundVolume = false;
} else {
SoundButton.GetComponentInChildren<Text> ().text = "Sound Volume: ON";
GlobalVariables.soundVolume = true;
}
}
public void OnDifficultyClick()
{
if (GlobalVariables.difficulty == 1)
{
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: MEDIUM";
GlobalVariables.difficulty = 2;
}
else if (GlobalVariables.difficulty == 2)
{
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: HARD";
GlobalVariables.difficulty = 3;
}
else
{
DifficultyButton.GetComponentInChildren<Text>().text = "Difficulty: EASY";
GlobalVariables.difficulty = 1;
}
}
public void OnDisplayPlayerMoves()
{
if (GlobalVariables.playerMoves == true)

+ 9
- 54
Assets/Scripts/Managers/GameManager.cs View File

@ -7,7 +7,6 @@ using Networking.Server;
using Networking;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
#region Inspector Field
@ -17,7 +16,6 @@ public class GameManager : MonoBehaviour
[SerializeField]
private GameModeReference CurrentGameMode;
[Header("References")]
[SerializeField]
[Tooltip("Prefab of character for players to play")]
@ -30,7 +28,6 @@ public class GameManager : MonoBehaviour
private ClientList ClientList;
public blockSpawn spawnBlock;
#endregion Inspector Field
#region Private Variables
@ -51,19 +48,14 @@ public class GameManager : MonoBehaviour
#endregion Read Only
#region Unity Functions
private void Start()
{
spawnBlock = gameObject.GetComponent<blockSpawn>();
//Start Game
StartCoroutine(GameRoutine());
}
private void Update()
{
//This is required so that the server can continue to recieve client messages
//(it is a unity thing)
server.ServerUpdate();
}
@ -83,13 +75,9 @@ public class GameManager : MonoBehaviour
#region Class Functions
private IEnumerator GameRoutine()
{
//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());
@ -101,34 +89,32 @@ public class GameManager : MonoBehaviour
int playersalive_left = 0;
int spotinarray = 0;
int players = 0;
//check here if one player left
foreach(PlayerData data in playerDataAsArray)
foreach (PlayerData data in playerDataAsArray)
{
players++;
if (data.character.lives > 0)
if (data.client.Lives > 0)
{
playersalive_left++;
spotinarray = players;
}
}
/*if(playersalive_left == 1)
if(playersalive_left == 1)
{
GlobalVariables.winneranimal = playerDataAsArray[spotinarray].client.characterAnimal;
GlobalVariables.winnername = playerDataAsArray[spotinarray].client.Name;
GlobalVariables.winneranimal = playerDataAsArray[spotinarray-1].client.characterAnimal;
GlobalVariables.winnername = playerDataAsArray[spotinarray-1].client.Name;
SceneManager.LoadScene("Winner");
}*/
}
//wait until we have recieved all player input
yield return StartCoroutine(WaitForPlayerInput());
//I hate having to do this
EnvironmentBlocks = FindObjectsOfType<ActiveBlock>();
////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;
}
//Let the gamemode know that the game is over
gameMode.GameEnd(playerDataAsArray);
}
@ -144,12 +130,9 @@ public class GameManager : MonoBehaviour
//Tell the gamemode that we are starting a round
gameMode.RoundStart(playerDataAsArray);
//Loop until all players have finished moving
while (playerDataAsArray.Any(p => !p.blockReader.Finished))
{
//Loop through all players
foreach (PlayerData player in playerDataAsArray)
{
@ -177,8 +160,6 @@ public class GameManager : MonoBehaviour
gameMode.PlayerKilled(player);
}
//Let GameMode know that Round is Over
yield return StartCoroutine(EnvironmentEnd());
gameMode.RoundEnd(playerDataAsArray.ToArray());
@ -192,14 +173,12 @@ public class GameManager : MonoBehaviour
{
if (player.client.Lives == 0)
{
//Debug.Log("Remove: " + player.client.characterAnimal);
removePlayer(player);
}
}
//spawn collectible logic blocks
spawnBlock.Spawn();
//Reset some player Data
foreach (PlayerData player in playerDataAsArray)
{
@ -211,9 +190,9 @@ public class GameManager : MonoBehaviour
}
playerData = playerData.OrderBy(unit => unit.Value.character.CurrentBlock.transform.position.x).ToDictionary(unit => unit.Key, unit => unit.Value);
Dictionary<int,PlayerData> filteredPlayers = playerData.Where(p => !p.Value.isDead).ToDictionary(unit => unit.Key, unit => unit.Value);
//Dictionary<int,PlayerData> filteredPlayers = playerData.Where(p => !p.Value.isDead).ToDictionary(unit => unit.Key, unit => unit.Value);
int order = 1;
foreach (PlayerData data in filteredPlayers.Values)
foreach (PlayerData data in playerDataAsArray)
{
data.character.runOrder = order;
order++;
@ -230,7 +209,6 @@ public class GameManager : MonoBehaviour
{
if (player.client.Lives == 0)
{
//Debug.Log("Remove: " + player.client.characterAnimal);
removePlayer(player);
}
}
@ -277,13 +255,6 @@ public class GameManager : MonoBehaviour
data.client.Inventory.Remove(data.blockReader.CurrentBlock);
data.blockReader.CurrentBlock.hasBeenRemoved = true;
}
//Process the move
//blockFinished = data.blockReader.Read(data.character, AnimationTime, out waitTime);
//Wait for the animation to finish
//yield return new WaitForSeconds(waitTime);
yield return StartCoroutine(data.blockReader.Read(data.character, AnimationTime));
}
@ -292,24 +263,15 @@ public class GameManager : MonoBehaviour
playerData = new Dictionary<int, PlayerData>();
Block[] SpawnBlocks = FindObjectsOfType<Block>().Where(p => p.isSpawnable).ToArray();
int blockIndex = 0;
foreach (Block block in SpawnBlocks)
{
////Debug.Log("Block #" + blockIndex++ + " (" + block.transform.position.x + ", " + block.transform.position.y + ", " + block.transform.position.z + ")");
}
//int spawnIndex = 0;
//If we have an odd number of players, then we start at spawn point 0 (in the middle)
//If we have an even number, then we skip it
//int spawnIndex = ((ClientList.Count() + 1) % 2);
int spawnIndex = 0;
foreach (ClientData client in ClientList)
{
////Debug.Log("spawnIndex = " + spawnIndex);
Character newChar = Instantiate(characterPrefab);
//Block startingBlock = SpawnBlocks[(spawnIndex++ % ClientList.ConnectedClients.Count)];
Block startingBlock = SpawnBlocks[spawnIndex++];
newChar.Initialise(startingBlock, client.Inventory, client.characterAnimal);
newChar.transform.forward = startingBlock.SpawnDirection.ToVector();
@ -329,7 +291,6 @@ public class GameManager : MonoBehaviour
yield return new WaitUntil(() => InitiativeGroup.All(p => p.isFinished));
InitiativeGroup.ForEach(p => p.Reset());
}
}
private IEnumerator EnvironmentEnd()
@ -351,7 +312,6 @@ public class GameManager : MonoBehaviour
#endregion Class Functions
#region Networking Functions
/// <summary>
/// Registers functions which should deal with incoming messages from clients
/// </summary>
@ -374,20 +334,15 @@ public class GameManager : MonoBehaviour
/// <param name="msg">messages passed by server</param>
private void RecieveLogicList(NetworkMessage msg)
{
//try to read base message as a logic message
LogicProtocols.LogicMsg logicMsg;
if (!msg.TryRead(out logicMsg))
return;
////Debug that we have recieved it
////Debug.Log("Recieved function from " + ClientList[msg.conn.connectionId].Name);
//Update player Data with recieved list
playerData[msg.conn.Hash()].blockReader.LogicChain = new List<LogicBlock>(logicMsg.elements);
playerData[msg.conn.Hash()].recievedList = true;
}
#endregion Networking Functions
}

+ 0
- 189
Assets/Scripts/Managers/GameManagerRacetrack.cs View File

@ -1,189 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Server;
using Networking;
using UnityEngine.SceneManagement;
/*
public class GameManagerRacetrack : MonoBehaviour
{
#region Inspector Field
[Header("Settings")]
[SerializeField]
private float AnimationTime;
[SerializeField]
private GameModeReference CurrentGameMode;
[Header("References")]
[SerializeField]
[Tooltip("Prefab of character for players to play")]
private Character characterPrefab;
[SerializeField]
private ServerObject server;
[SerializeField]
private ClientList ClientList;
#endregion Inspector Field
#region Private Variables
private Dictionary<int, PlayerData> playerData;
private GameMode gamemode;
#endregion Private Variables
#region Read Only
private IEnumerable<PlayerData> playerArray { get { return playerData.Values; } }
#endregion Read Only
public GameObject levelInfo;
public blockSpawn bspawn;
public void Awake()
{
gamemode = CurrentGameMode.Value;
RegisterHandlers();
SpawnCharacters();
ClientList.ForEach(p => p.ChangeScene("ClientScene"));
}
private void Start()
{
StartCoroutine(displayforSeconds(levelInfo, 5.0f));
gamemode.GameStart(playerArray.ToArray());
StartRound();
}
private void Update()
{
server.ServerUpdate();
}
IEnumerator displayforSeconds(GameObject display, float time)
{
display.SetActive (true);
yield return new WaitForSeconds(time);
display.SetActive (false);
}
private void RecieveLogicList(NetworkMessage msg)
{
LogicProtocols.LogicMsg logicMsg;
if (!msg.TryRead(out logicMsg))
return;
Debug.Log("Recieved function from " + msg.conn.connectionId);
playerData[msg.conn.connectionId].blockReader.LogicChain = new List<LogicBlock>(logicMsg.elements);
playerData[msg.conn.connectionId].recievedList = true;
if (playerData.All(p => p.Value.recievedList))
DoRoundRoutine();
}
private void DoRoundRoutine()
{
Debug.Log("Starting Round");
StartCoroutine(RoundRoutine());
}
private void StartRound()
{
gamemode.RoundStart(playerArray.ToArray());
LogicProtocols.FloatMsg RoundTime = new LogicProtocols.FloatMsg( gamemode.GetRoundTime());
bspawn.Spawn();
playerArray.ForEach(p => p.client.conn.Send(LogicProtocols.SendRoundTime, RoundTime));
}
private IEnumerator RoundRoutine()
{
playerArray.ForEach(p => p.recievedList = false);
//Debug.Log("Doing Round Routine");
while (playerArray.Any(p => !p.blockReader.Finished))
{
//Debug.Log("One Move");
foreach (PlayerData player in playerArray)
StartCoroutine(RunOnce(player));
//wait until all players have finished
yield return new WaitUntil(() => playerArray.All(p => p.waiting));
gamemode.FinishedMove(playerArray.ToArray());
playerArray.ForEach(p => p.client.SendScore());
}
if (gamemode.isGameOver(playerArray.ToArray()))
{
Debug.Log("Game Over");
SceneManager.LoadScene("ScoreBoards");
}
gamemode.RoundEnd(playerArray.ToArray());
foreach (PlayerData player in playerArray)
{
player.blockReader.Reset();
player.waiting = false;
player.client.SendInventory();
player.client.ChangeScene("ClientScene");
}
//Debug.Log("Finished Moving");
StartRound();
}
private void SpawnCharacters()
{
playerData = new Dictionary<int, PlayerData>();
Block[] SpawnBlocks = FindObjectsOfType<Block>().Where(p => p.isSpawnable).ToArray();
int spawnIndex = 0;
foreach (ClientData client in ClientList)
{
Character newChar = Instantiate(characterPrefab);
Block startingBlock = SpawnBlocks[(spawnIndex++ % ClientList.ConnectedClients.Count)];
newChar.Initialise(startingBlock, client.Inventory, client.characterAnimal);
newChar.transform.forward = startingBlock.SpawnDirection.ToVector();
playerData.Add(client.ID, new PlayerData(newChar,client));
newChar.ClientLink = client;
client.playerCharacter = newChar;
}
}
private void RegisterHandlers()
{
server.server.RegisterHandler(LogicProtocols.SendLogicList, RecieveLogicList);
}
private IEnumerator RunOnce(PlayerData data)
{
data.waiting = false;
bool blockFinished = false;
float waitTime;
while (!blockFinished && !data.blockReader.Finished)
{
//Debug.Log(data.client + "Moving once");
if (data.blockReader.CurrentBlock != null && !data.blockReader.CurrentBlock.hasBeenRemoved)
{
data.client.Inventory.Remove(data.blockReader.CurrentBlock);
data.blockReader.CurrentBlock.hasBeenRemoved = true;
}
blockFinished = data.blockReader.Read(data.character, AnimationTime,out waitTime);
//Debug.Log("Waiting: " + waitTime);
yield return new WaitForSeconds(waitTime);
gamemode.PlayerMoved(data);
}
data.waiting = true;
}
}*/

+ 0
- 11
Assets/Scripts/Managers/GameManagerRacetrack.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 87e8efe34e51a8e439656a3512097f21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 101
Assets/Scripts/Map Generation/MapManager.cs View File

@ -1,10 +1,7 @@
using Networking.Client;
using Networking.Server;
using System.Collections;
using Networking.Server;
using System.Collections.Generic;
using UnityEngine;
//public class MapManager : MonoBehaviour
[CreateAssetMenu(menuName = "Major Project/Map Generation/Map Manager")]
public class MapManager : ScriptableObject
{
@ -31,13 +28,6 @@ public class MapManager : ScriptableObject
int diffCap = 5; //The highest the difficulty rating can go
int difficulty; //Current difficulty rating
/*int diffMin; //Minimum difficulty for a map section to be selected
int diffMax; //Maximum difficulty for a map section to be selected
int diffMinStart = 0; //Initial minimum difficulty for a map section to be selected
int diffMaxStart = 1; //Initial maximum difficulty for a map section to be selected
int diffMinMax = 4; //The highest diffMin can go - ensure that it doesn't go too high to have legal map sections
*/
int widthMin; //The minimum widthIn that we want for a new map section
int widthMax; //The maximum widthIn that we want for a new map section
int widthMinMin = 3; //The minimum to which widthMin can be reduced
@ -58,13 +48,6 @@ public class MapManager : ScriptableObject
}
}
//Debug.Log("sections.Count = " + sections.Count);
foreach (MapSection section in sections)
{
//Debug.Log("Possible section: " + section.name);
}
initialPlayerCount = clients.ConnectedClients.Count;
activeSections = new List<MapSection>();
@ -90,22 +73,8 @@ public class MapManager : ScriptableObject
widthMin = activeSections[0].widthOut - 2;
widthMax = activeSections[0].widthOut + 2;
difficulty = diffStart;
//Set the maximum possible diffMin value to 1 less than the highest difficulty on the section list
/*diffMinMax = 0;
foreach (MapSection section in sections)
{
if (section.difficulty > diffMinMax)
{
diffMinMax = section.difficulty;
}
}
diffMinMax--;*/
switch (initialPlayerCount)
{
case 2:
@ -157,7 +126,6 @@ public class MapManager : ScriptableObject
}
break;
}
checkForward();
}
@ -168,7 +136,6 @@ public class MapManager : ScriptableObject
updateCriteria(); //We update the section selection criteria for the current gamestate
Debug.Log("Sections length:" + sections.Count);
int count = -1;
foreach (MapSection section in sections)
@ -176,7 +143,6 @@ public class MapManager : ScriptableObject
count++;
if (section == null)
{
Debug.Log("Section is empty [" + count + "]");
continue;
}
@ -190,20 +156,8 @@ public class MapManager : ScriptableObject
}
}
}
//Having generated our list, we choose a random segment from it
foreach (MapSection section in validSections)
{
//Debug.Log("Valid section: " + section.name);
}/**/
//Debug.Log("Choosing section");
MapSection nextSection = validSections[(int)Random.Range(0.0f, (float)validSections.Count)];
//Debug.Log("Chosen section: " + nextSection.name);
addSection(nextSection);
}
@ -212,7 +166,6 @@ public class MapManager : ScriptableObject
//Instantiate new section at x = endX
Vector3 pos = new Vector3(endX, 0.0f, 0.0f);
GameObject newSection = (GameObject)Instantiate(section.gameObject, pos, Quaternion.identity);
//GameObject.Instantiate(section.gameObject, pos, Quaternion.identity);
MapSection newSectionScript = newSection.GetComponent<MapSection>();
@ -233,64 +186,40 @@ public class MapManager : ScriptableObject
bool checkSegments(MapSection first, MapSection second)
{
int connections = 0;
//Debug.Log("Checking " + first.name + ", " + second.name);
//No more than one link section in a row
if (first.length == 1 && second.length == 1)
{
return false;
}
//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);
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);
return false;
}
////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);/**/
if (checkConnection(exit, entry))
{
connections++;
}
}
}
////Debug.Log("Connections = " + connections);
if (connections >= minConns)
{
////Debug.Log("Valid section!");
}
else
{
////Debug.Log("Invalid section!");
}
return (connections >= minConns);
}
bool checkConnection(GameObject exit, GameObject entry)
{
/*//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);
return false;
}
@ -298,23 +227,14 @@ 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");
return false;
}
////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");
return false;
}
////Debug.Log("Exit.isWater = " + exit.GetComponent<Block>().isWater + ", Entry.isWater = " + entry.GetComponent<Block>().isWater);
////Debug.Log("Valid connection!");
//If we've passed all these tests, the connection is valid!
return true;
}
@ -349,7 +269,6 @@ public class MapManager : ScriptableObject
if (checkView(trackEnd))
{
chooseNextSection();
//spawn.GetComponent<blockSpawn>().wakeup();
checkForward();
}
}
@ -368,7 +287,6 @@ public class MapManager : ScriptableObject
spawn.GetComponent<blockSpawn>().updatePositions((int)startX);
activeSections[0].destroySection();
activeSections.RemoveAt(0);
}
}
@ -409,39 +327,21 @@ 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");
difficulty++;
widthMin -= 2;
widthMax -= 2;
}
if (clients.ConnectedClients.Count <= (float)(0.33f * initialPlayerCount))
{
//Debug.Log("Initial players = " + initialPlayerCount + ", current players = " + clients.ConnectedClients.Count + ", player count below 33%");
difficulty += 2;
widthMin -= 2;
widthMax -= 2;
}
}
//Ramp up the difficulty as the track extends
difficulty += ((int)endX - (int)startX) / 7;
/*diffMin += (totalSections - 2) / 2;
diffMax += totalSections / 2;*/
//Dropping the difficulty-based track narrowing for now - we have wide sections designed to be hard, we want them to show up
//Once the difficulty has ramped up, we cause the track to steadily narrow
//It can no longer widen, only remain constant or shrink
//if (diffMin > 2)
/*if (difficulty > 2)
{
widthMax--;
}*/
//Apply caps
if (difficulty > diffCap)
{

+ 1
- 16
Assets/Scripts/Map Generation/MapSection.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
public class MapSection : MonoBehaviour
@ -31,11 +30,6 @@ public class MapSection : MonoBehaviour
public List<GameObject> collectableSpawns; //Which blocks can items spawn on?
// Start is called before the first frame update
void Start()
{
}
public void InitSection()
{
size = widthMax * length;
@ -58,15 +52,6 @@ public class MapSection : MonoBehaviour
public void destroySection()
{
/*foreach (GameObject block in blocks)
{
Object.Destroy(block);
}*/
/*Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
gameObject.transform.position = new Vector3(0.0f, 0.0f, 1000.0f);*/
//Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
//gameObject.SetActive(false);
Destroy(gameObject, 0.0f);
}
}

+ 1
- 2
Assets/Scripts/Map Generation/SectionList.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Map Generation/Section List")]

+ 1
- 4
Assets/Scripts/Map Generation/TestGenerator.cs View File

@ -1,12 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class TestGenerator : MonoBehaviour
{
public MapManager manager;
// Start is called before the first frame update
void Start()
{
manager.init();

+ 1
- 5
Assets/Scripts/NetworkOutput.cs View File

@ -1,7 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine;
using Networking.Client;
using Networking;
@ -16,7 +13,6 @@ public class NetworkOutput : MonoBehaviour
public void SendList()
{
LogicProtocols.LogicMsg msg = new LogicProtocols.LogicMsg(Tray.reader.LogicChain.ToArray());
Debug.Log("sending on " + LogicProtocols.SendLogicList);
Client.client.SendByChannel(LogicProtocols.SendLogicList, msg,TransportConfigure.ReliableFragmented);
}

+ 2
- 15
Assets/Scripts/Networking/Client/ClientLoginManager.cs View File

@ -1,15 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using UnityEngine.Networking;
namespace Networking.Client
{
public class ClientLoginManager : MonoBehaviour
{
#region Inspector Fields
[Header("Connection Settings")]
[SerializeField]
@ -51,18 +47,11 @@ namespace Networking.Client
#endregion Inspector Fields
#region Events
public System.Action OnConnectedToServer;
public System.Action OnLoginSucess;
public System.Action OnLoginFail;
#endregion Events
#region Private variables
#endregion Private variables
// Start is called before the first frame update
private void Awake()
{
if (StartClientOnAwake)
@ -80,7 +69,6 @@ namespace Networking.Client
Client.client.UnregisterHandler(LoginProtocols.RequestLoginDetails);
}
public void StartClient(string ipAddress, int port)
{
Client.Connect(ipAddress, Port);
@ -142,6 +130,5 @@ namespace Networking.Client
Client.Stop();
}
}
}
}

+ 1
- 5
Assets/Scripts/Networking/Client/ClientObject.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using UnityEngine.Networking;
namespace Networking.Client
@ -8,7 +6,6 @@ namespace Networking.Client
[CreateAssetMenu(menuName = "Major Project/Networking/ClientObject", order = 150)]
public class ClientObject : ScriptableObject
{
#region Inspector Fields
[Header("Connection Settings")]
[SerializeField]
@ -56,7 +53,6 @@ namespace Networking.Client
[SerializeField]
[Tooltip("A list of all connected clients")]
public ConnectedClients ConnectedClients;
#endregion Inspector Fields
#region ReadOnly Variables

+ 2
- 8
Assets/Scripts/Networking/Client/ClientOutputManager.cs View File

@ -1,18 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
public class ClientOutputManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
{
}
}

+ 1
- 11
Assets/Scripts/Networking/Client/ConnectedClients.cs View File

@ -1,13 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking;
namespace Networking.Client
{
[CreateAssetMenu(menuName = "Major Project/Networking/Client/OtherClientsList", order = 150)]
public class ConnectedClients : ScriptableObject
{
@ -38,7 +34,6 @@ namespace Networking.Client
client.client.RegisterHandler(LoginProtocols.OtherClientDisconnected, OnClientDisconnect);
}
public void Reset()
{
AllClients = new List<ClientData>();
@ -46,7 +41,6 @@ namespace Networking.Client
OnClientsChange?.Invoke(AllClients);
}
public void OnClientConnect(NetworkMessage msg)
{
LoginProtocols.LoginMsg loginMsg;
@ -67,11 +61,8 @@ namespace Networking.Client
AllClients.RemoveAll(p => (p.Name == loginMsg.Name) && (p.Color == loginMsg.Color) && (p.characterAnimal == loginMsg.Animal));
OnClientsChange?.Invoke(AllClients);
}
}
[System.Serializable]
public class ClientData
{
@ -98,5 +89,4 @@ namespace Networking.Client
this.characterAnimal = msg.Animal;
}
}
}

+ 2
- 12
Assets/Scripts/Networking/Core/Protocols/LogicProtocols.cs View File

@ -1,11 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking;
namespace Networking
{
public class LogicProtocols
{
public const short SendLogicList = 200;
@ -15,10 +11,8 @@ namespace Networking
public const short SendScore = 205;
public const short SendLives = 204;
public class LogicMsg : MessageBase
{
public LogicBlock[] elements;
public LogicMsg() { }
@ -54,8 +48,6 @@ namespace Networking
elements[i] = token.ToLogicBlock();
}
}
}
public class InventoryMsg : MessageBase
@ -130,7 +122,6 @@ namespace Networking
public class StringMsg : MessageBase
{
public float String;
public StringMsg() { }
@ -155,7 +146,6 @@ namespace Networking
public class EmptyMsg : MessageBase
{
}
}
}
}

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

@ -1,9 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Server;
using Networking;
public class PortalSetup : MonoBehaviour
{

+ 0
- 11
Assets/Scripts/Projectiles/HomingMissile.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Networking.Server;
@ -9,11 +7,8 @@ public class HomingMissile : Projectile
[SerializeField]
ClientList Clients;
public override IEnumerator ProjectileLogic(Character player, float animationTime, Vector3 direction)
{
Character target = findPlayer(player);
yield return StartCoroutine(LerpTo(transform.position + Vector3.up * 2, 0.5f));
@ -39,7 +34,6 @@ public class HomingMissile : Projectile
yield return StartCoroutine(player.CurrentBlock.DoPush(player, possibleDirections[i].ToVector()));
break;
}
}
private Character findPlayer(Character thisCharacter)
@ -57,7 +51,6 @@ public class HomingMissile : Projectile
if (retVal.transform.position.x <= client.playerCharacter.transform.position.x)
retVal = client.playerCharacter;
}
return retVal;
}
@ -73,11 +66,7 @@ public class HomingMissile : Projectile
transform.LookAt(endPosition, Vector3.up);
yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime;
}
transform.position = endPosition;
}
}

+ 0
- 8
Assets/Scripts/Projectiles/Hookshot.cs View File

@ -1,10 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hookshot : Projectile
{
[SerializeField]
private Transform hookObject;
@ -14,7 +12,6 @@ public class Hookshot : Projectile
[SerializeField]
private LineRenderer line;
public override IEnumerator ProjectileLogic(Character player, float animationTime, Vector3 direction)
{
Block hitBlock = GetEndBlock(player.CurrentBlock, direction, ~player.Ignore);
@ -25,7 +22,6 @@ public class Hookshot : Projectile
yield return StartCoroutine(lerpShot(hookObject, hookObject.position, hookObject.position + direction*10, 1.0f));
yield break;
}
yield return StartCoroutine(lerpShot(hookObject, player.transform.position, hitBlock.VisualPosition, ShotSpeed * Vector3.Distance(player.transform.position,hitBlock.VisualPosition)/10));
@ -71,15 +67,12 @@ public class Hookshot : Projectile
{
return Block.GetOrCreateBlockAtPosition(position - direction, 1, layerMask);
}
}
return retVal;
}
private IEnumerator lerpShot(Transform target, Vector3 startPosition, Vector3 endPosition, float time)
{
float elapsedTime = 0;
while (elapsedTime < time)
@ -90,7 +83,6 @@ public class Hookshot : Projectile
yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime;
}
target.position = endPosition;
}
}

+ 0
- 1
Assets/Scripts/Projectiles/Projectile.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class Projectile : MonoBehaviour

+ 0
- 4
Assets/Scripts/Traps/ConveyorBelt.cs View File

@ -1,8 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Networking.Client;
using Networking.Server;
public class ConveyorBelt : ActiveBlock
{
@ -10,7 +7,6 @@ public class ConveyorBelt : ActiveBlock
[SerializeField]
public LogicBlock Action;
public override int GetInitative()
{
return 5;

+ 4
- 7
Assets/Scripts/Traps/CrushingBoulder.cs View File

@ -1,26 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class CrushingBoulder : ActiveBlock
{
public int countdowntimer;
int countdowntimer;
public TextMeshPro counter;
int countdown;
public int countdown;
public override int GetInitative()
{
return 3;
}
private void Start()
{
countdown = countdowntimer;
}
private void Update()
{
counter.text = countdown.ToString();
}
public override IEnumerator OnEnvironmentTurn(PlayerData[] allPlayers)
{
countdown--;

+ 0
- 2
Assets/Scripts/Traps/CubeWithCrystals.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeWithCrystals : ActiveBlock
@ -17,7 +16,6 @@ public class CubeWithCrystals : ActiveBlock
yield return new WaitForSeconds(1.0f);
StartCoroutine(ShrinkCoroutine());
isFinished = true;
//yield break;
}
IEnumerator GrowCoroutine()

+ 0
- 5
Assets/Scripts/Traps/FloatingOnWater.cs View File

@ -14,11 +14,6 @@ public class FloatingOnWater : MonoBehaviour
public bool triggeranimate;
public bool triggeranimate1;
private void Update()
{
}
private void Start()
{
for(int i = 0; i < clientData.ConnectedClients.Count; i++)

+ 0
- 2
Assets/Scripts/Traps/InGroundTrap.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InGroundTrap : ActiveBlock
{

+ 0
- 11
Assets/Scripts/Traps/ShootingCannon.cs View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class ShootingCannon : ActiveBlock
{
[Header("Cannon Settings")]
@ -21,15 +20,10 @@ public class ShootingCannon : ActiveBlock
return 4;
}
private void Start()
{
//countdown = countdowntimer;
}
private void Update()
{
counter.text = countdown.ToString();
counter2.text = countdown.ToString();
}
public override IEnumerator OnEnvironmentTurn(PlayerData[] allPlayers)
@ -37,11 +31,9 @@ public class ShootingCannon : ActiveBlock
if (countdown > 0)
{
countdown--;
isFinished = true;
yield break;
}
countdown = countdowntimer;
Vector3 bulletPosition;
@ -55,7 +47,6 @@ public class ShootingCannon : ActiveBlock
StartCoroutine(player.MoveToBlock(moveToBlock, Character.Animation.Hit, 1));
}
StartCoroutine(lerpShot(bulletPosition, Vector3.Distance(spawnLocation.position,bulletPosition)/15));
if (hitPlayers.Length > 0)
@ -65,10 +56,8 @@ public class ShootingCannon : ActiveBlock
yield break;
}
private Character[] getHitPlayers(out Vector3 endPosition)
{
Vector3 curPos;
List<Character> retVal = new List<Character>();
Block hit;

+ 0
- 4
Assets/Scripts/Tutorial/TutorialSetup.cs View File

@ -1,14 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TutorialSetup : MonoBehaviour
{
public Character character;
public InventoryUI inventoryUI;
// Start is called before the first frame update
void Start()
{
StartCoroutine(wait(0.1f, new System.Action(LastStart)));
@ -24,5 +21,4 @@ public class TutorialSetup : MonoBehaviour
yield return new WaitForSeconds(time);
callback();
}
}

+ 1
- 18
Assets/Scripts/UI/BagItem.cs View File

@ -1,8 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class BagItem : LogicElementHolder
@ -22,12 +18,7 @@ public class BagItem : LogicElementHolder
private Text CountText1;
#endregion Private Variables
#region Read Only
#endregion Read Only
#region Class Functionality
public void Initialise(Inventory.Data data)
{
InventoryData = data;
@ -50,10 +41,8 @@ public class BagItem : LogicElementHolder
else
CountText1.text = "∞";
}
#endregion Class Functionality
#region LogicElementHolder Implementation
/// <summary>
/// When a logicElement needs to be added back to this holder
@ -83,9 +72,7 @@ public class BagItem : LogicElementHolder
LogicElementUI logicElement = Instantiate(LogicElementPrefab.gameObject, LogicElementLocation).GetComponent<LogicElementUI>();
logicElement.Initialise(InventoryData.element, this,true);
UpdateUI();
}
/// <summary>
@ -106,9 +93,5 @@ public class BagItem : LogicElementHolder
{
}
#endregion LogicElementHolder Implementation
}

+ 2
- 6
Assets/Scripts/UI/ColourSquareCollection.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
@ -16,14 +14,12 @@ public class ColourSquareCollection : MonoBehaviour
void Start(){
//have to first get colour from player, hard code purple in at the moment
colourCube.GetComponent<Image>().color = currentPlayerColour;
objs = GameObject.FindGameObjectsWithTag("Coloured");
counter = 1;
counterScore.GetComponent<TextMeshProUGUI>().text = counter.ToString();
}
// Update is called once per frame
public void colourupdatefromMove()
{
counter = 1;
@ -36,4 +32,4 @@ public class ColourSquareCollection : MonoBehaviour
}
counterScore.GetComponent<TextMeshProUGUI>().text = counter.ToString();
}
}
}

+ 1
- 11
Assets/Scripts/UI/ComplexLogicElementUI.cs View File

@ -1,19 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ComplexLogicElementUI : LogicElementUI
public class ComplexLogicElementUI : LogicElementUI
{
public CombinedBlock combinedFunction { get { return LogicElement as CombinedBlock; } }
public override void UpdateUI()
{
base.UpdateUI();
//transform.localScale += Vector3.right * LogicElement.Size();
}
}

+ 1
- 2
Assets/Scripts/UI/Dragable.cs View File

@ -68,5 +68,4 @@ public class Dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag
}
protected virtual void OnDoubleClick() { }
}
}

+ 1
- 11
Assets/Scripts/UI/ILogicElementHolder.cs View File

@ -1,14 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Class which component which an LogicElementUI can be dragged into should derive from
/// </summary>
public abstract class LogicElementHolder : MonoBehaviour
{
/// <summary>
/// List of all Holders in scene
/// </summary>
@ -17,7 +14,6 @@ public abstract class LogicElementHolder : MonoBehaviour
[Tooltip("An Element with a higher priority will be used if two object overlap")]
public int Priority = 0;
#region Unity Functions
protected virtual void OnEnable()
{
@ -67,15 +63,12 @@ public abstract class LogicElementHolder : MonoBehaviour
/// <param name="element">element which was double clicked</param>
public abstract void OnDoubleClick(LogicElementUI element);
/// <summary>
/// Called to check if this holder can hold the provided element;
/// </summary>
/// <param name="element">element to check if it can hold</param>
/// <returns>returns true if this can hold the element </returns>
public virtual bool canHold(LogicBlock element) { return true; }
#endregion Class Funtions
#region Static Functions
@ -97,15 +90,12 @@ public abstract class LogicElementHolder : MonoBehaviour
if (rect.Overlaps(holderRect))
retVal.Add(holder);
}
return retVal.ToArray();
}
public static void DebugDrawAll(Color color, float duration = 0.0f, bool depthTest = false)
{
EnabledHolders.ForEach(p => DebugExtensions.DrawRect(p.transform as RectTransform, color,duration, depthTest));
}
#endregion
}

+ 1
- 5
Assets/Scripts/UI/InventoryCatch.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using UnityEngine;
public class InventoryCatch : LogicElementHolder
@ -8,12 +6,10 @@ public class InventoryCatch : LogicElementHolder
[SerializeField]
private InventoryUI InventoryUI;
public override void OnAdd(LogicElementUI element)
{
foreach (LogicBlock block in element.logicElement.GetAllBlocks())
{
BagItem item = InventoryUI.content.FirstOrDefault(p => p.canHold(block));
if (item != default)

+ 1
- 6
Assets/Scripts/UI/InventoryUI.cs View File

@ -1,10 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
public class InventoryUI : MonoBehaviour
{
public Inventory inventory;
[SerializeField]
@ -15,7 +13,6 @@ public class InventoryUI : MonoBehaviour
public List<BagItem> content { get; private set; }
private void Start()
{
UpdateUI();
@ -46,6 +43,4 @@ public class InventoryUI : MonoBehaviour
content.Add(item);
}
}
}

+ 1
- 6
Assets/Scripts/UI/LeadPlayerUI.cs View File

@ -1,6 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using Networking.Server;
@ -39,7 +37,4 @@ public class LeadPlayerUI : MonoBehaviour
ScoreText.text = lead.Lives.ToString();
ColorImage.color = lead.Color;
}
}

+ 1
- 6
Assets/Scripts/UI/LocalUIManager.cs View File

@ -1,10 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LocalUIManager : PlayerUIManager
public class LocalUIManager : PlayerUIManager
{
public BlockInput characterInput;
protected override void Awake()

+ 1
- 9
Assets/Scripts/UI/LogicElementUI.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.EventSystems;
@ -40,7 +39,6 @@ public class LogicElementUI : Dragable
private List<LogicElementHolder> lastHover = new List<LogicElementHolder>();
#endregion Private Variables
#region Unity Functions
private void Start()
{
@ -87,16 +85,13 @@ public class LogicElementUI : Dragable
}
#endregion Class Implementation
#region Drag Implementation
public override void OnBeginDrag(PointerEventData eventData)
{
base.OnBeginDrag(eventData);
if (currentHolder != null)
currentHolder.OnRemove(this);
}
public override void OnDrag(PointerEventData data)
@ -130,7 +125,6 @@ public class LogicElementUI : Dragable
//Call OnHoverStop to each element we are hovering over
lastHover.ForEach(p => p.OnHoverEnd(this));
//order the UIHolders by priority and get the first which will accept this
lastHover = lastHover.OrderByDescending(p => p.Priority).ToList();
@ -146,7 +140,6 @@ public class LogicElementUI : Dragable
}
else
currentHolder.OnAdd(this);
}
protected override void OnDoubleClick()
@ -155,5 +148,4 @@ public class LogicElementUI : Dragable
currentHolder.OnDoubleClick(this);
}
#endregion Drag Implementaion
}

+ 2
- 30
Assets/Scripts/UI/LogicTrayUI.cs View File

@ -1,14 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class LogicTrayUI : LogicElementHolder
{
//[SerializeField]
//protected List<LogicBlock> list;
[SerializeField]
protected LogicElementUI Prefab;
[SerializeField]
@ -35,12 +31,8 @@ public class LogicTrayUI : LogicElementHolder
#region Unity Functions
public void Start()
{
readerQueue.Add(new QueueData(reader, border.color));
UpdateDisplay();
}
protected override void OnEnable()
@ -77,17 +69,10 @@ public class LogicTrayUI : LogicElementHolder
QueueData lastData = readerQueue[readerQueue.Count - 1];
readerQueue.RemoveAt(readerQueue.Count - 1);
//lastData.block.blockReader.LogicChain = new List<LogicBlock>(lastData.reader.LogicChain);
border.color = readerQueue[readerQueue.Count - 1].color;
// readerQueue[readerQueue.Count - 1].reader.LogicChain = new List<LogicBlock>(reader.LogicChain);
SetBlockReader(readerQueue[readerQueue.Count - 1].reader);
UpdateDisplay();
UpdateDisplay();
}
[ContextMenu("Update Display")]
@ -123,16 +108,11 @@ public class LogicTrayUI : LogicElementHolder
elementObject.GetComponentInChildren<TextMeshProUGUI>().text = "X";
elementObject.GetComponentInChildren<Image>().color = new Color(1.0f, 0.25f, 0.25f, 0.5f);
}
//Set sibling index to where we want it in list + add destroyedCount since technically they are still here
elementObject.transform.SetSiblingIndex(destroyedCount + insertIndex);
}
playButton.SetActive(readerQueue.Count <= 1);
returnButton.SetActive(readerQueue.Count > 1);
}
#region LogicElementHolder Implementation
@ -225,19 +205,13 @@ public class LogicTrayUI : LogicElementHolder
{
return readerQueue[0].reader.Length < maxLength;
}
#endregion LogicElementHolder Implementation
#region Helper Functions
public int GetInsertIndex(RectTransform rt, Vector2 offset)
{
Rect rect = rt.rect;
rect.center += offset;
rect = rt.TransformRect(rect);
DebugExtensions.DrawRect(rect, Color.green);
@ -257,7 +231,6 @@ public class LogicTrayUI : LogicElementHolder
{
return GetInsertIndex(rt, Vector2.zero);
}
#endregion Helper Functions
[System.Serializable]
@ -272,5 +245,4 @@ public class LogicTrayUI : LogicElementHolder
this.reader = reader;
}
}
}

+ 0
- 10
Assets/Scripts/UI/MoveAndFade.cs View File

@ -1,12 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
[RequireComponent(typeof(TextMeshPro))]
public class MoveAndFade : MonoBehaviour
{
[SerializeField]
private float AnimationTime;
@ -17,10 +15,8 @@ public class MoveAndFade : MonoBehaviour
[SerializeField]
private AnimationCurve FadeCurve;
private TextMeshPro text;
private void Start()
{
text = GetComponent<TextMeshPro>();
@ -29,7 +25,6 @@ public class MoveAndFade : MonoBehaviour
private IEnumerator FadeAndMove()
{
Vector3 startPoint = transform.position;
Vector3 endPoint = transform.position + EndPoint;
float startAlpha = text.color.a;
@ -38,7 +33,6 @@ public class MoveAndFade : MonoBehaviour
while(elapsedTime < AnimationTime)
{
float ratio = elapsedTime / AnimationTime;
float fadeValue = Mathf.Lerp(startAlpha,0.0f, FadeCurve.Evaluate(ratio));
@ -48,11 +42,7 @@ public class MoveAndFade : MonoBehaviour
yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime;
}
Destroy(gameObject);
}
}

+ 1
- 4
Assets/Scripts/UI/NetworkedUIManager.cs View File

@ -1,7 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine;
using Networking;
using Networking.Client;
using UnityEngine.UI;

+ 0
- 7
Assets/Scripts/UI/PlayerUIManager.cs View File

@ -1,10 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class PlayerUIManager : MonoBehaviour
{
[SerializeField]
protected InventoryUI Inventory;
@ -36,7 +34,6 @@ public abstract class PlayerUIManager : MonoBehaviour
[ContextMenu("Hide")]
public void OnClick_Hide()
{
StopAllCoroutines();
StartCoroutine( LerpPosition(inventoryRect, HidePosition, AnimationSpeed));
}
@ -59,7 +56,6 @@ public abstract class PlayerUIManager : MonoBehaviour
private IEnumerator LerpPosition(RectTransform rt, Vector3 endPosition, float time)
{
float elapsedTime = 0;
Vector3 startPos = rt.anchoredPosition;
@ -69,9 +65,6 @@ public abstract class PlayerUIManager : MonoBehaviour
elapsedTime += Time.deltaTime;
yield return new WaitForEndOfFrame();
}
rt.anchoredPosition = endPosition;
}
}

+ 1
- 7
Assets/Scripts/UI/PreFilledText.cs View File

@ -1,9 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using TMPro;
public class PreFilledText : MonoBehaviour
{
[System.Serializable]
@ -22,7 +19,6 @@ public class PreFilledText : MonoBehaviour
[SerializeField]
private string DefaultValue;
private void Awake()
{
SetText();
@ -43,6 +39,4 @@ public class PreFilledText : MonoBehaviour
break;
}
}
}

+ 0
- 2
Assets/Scripts/UI/ScoreBoard.cs View File

@ -1,9 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Server;
using Networking;
using TMPro;
using UnityEngine.SceneManagement;

+ 0
- 3
Assets/Scripts/UI/levelInfoDisplay.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class levelInfoDisplay : MonoBehaviour
@ -13,10 +12,8 @@ public class levelInfoDisplay : MonoBehaviour
infoDisplay.SetActive(false);
}
// Start is called before the first frame update
public void StartCoroutine()
{
StartCoroutine(displayforSeconds(5.0f));
}
}

+ 2
- 14
Assets/Scripts/animalSelection.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using Networking.Client;
using UnityEngine.UI;
@ -10,17 +9,6 @@ public class animalSelection : MonoBehaviour
public List<Toggle> Animals;
public int count;
//private void OnEnable()
//{
// Clients.OnClientsChange += UpdateAnimals;
//}
//
//private void OnDisable()
//{
// Clients.OnClientsChange -= UpdateAnimals;
//}
public void Update()
{
count = Clients.AllClients.Count;
@ -39,4 +27,4 @@ public class animalSelection : MonoBehaviour
}
}
}
}
}

+ 4
- 22
Assets/Scripts/blockSpawn.cs View File

@ -6,10 +6,7 @@ using Networking.Server;
public class blockSpawn : MonoBehaviour
{
[SerializeField]
public Inventory.Data[] StrongLogicList;
public Inventory.Data[] NormalLogicList;
public Inventory.Data[] WeakLogicList;
Inventory.Data[] listtoUse;
public Inventory.Data[] LogicList;
List<ClientData> ConnectedClients;
public ClientList clientDataList;
@ -77,9 +74,7 @@ public class blockSpawn : MonoBehaviour
{
goto escape;
}
//Debug.Log("spawnNumber " + spawnNumber);
}
//Debug.Log("SpawnTries: " + triesCount);
}
escape:
spawnNumber = 2;
@ -125,21 +120,8 @@ public class blockSpawn : MonoBehaviour
public void assignLogicBlock(GameObject block, float value)
{
if(value > 1)
{
listtoUse = WeakLogicList;
}
else if (value <= 1 && value > (-4))
{
listtoUse = NormalLogicList;
}
else if (value <= (-5))
{
listtoUse = StrongLogicList;
}
int number = Random.Range(0, listtoUse.Length-1);
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.element = listtoUse[number].element;
int number = Random.Range(0, LogicList.Length-1);
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.element = LogicList[number].element;
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.Count = 1;
}
@ -164,4 +146,4 @@ public class blockSpawn : MonoBehaviour
}
}
}
}
}

+ 0
- 24
Assets/Scripts/portalTesting.cs View File

@ -1,24 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Server;
using Networking;
public class portalTesting : MonoBehaviour
{
public ClientList clientDataList;
public List<ClientData> ConnectedClients;
public PortalSetup ps;
void Start(){
ConnectedClients = clientDataList.ConnectedClients;
}
// Update is called once per frame
void Update()
{
}
}

+ 2
- 2
Assets/Scripts/videoToUI.cs View File

@ -1,5 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
@ -8,11 +7,12 @@ public class videoToUI : MonoBehaviour
{
public RawImage rawImage;
public VideoPlayer videoPlayer;
// Use this for initialization
void Start()
{
StartCoroutine(PlayVideo());
}
IEnumerator PlayVideo()
{
videoPlayer.Prepare();

+ 0
- 1
Assets/Scripts/winnerscene.cs View File

@ -13,7 +13,6 @@ public class winnerscene : MonoBehaviour
private void Awake()
{
//GameObject character = Resources.Load<>
GameObject prefab = Resources.Load<GameObject>(GlobalVariables.winneranimal);
GameObject character = Instantiate(prefab, characterPosition);
character.transform.rotation = Quaternion.Euler(0, 152.775f, 0);

+ 2
- 2
Assets/Textures/Icon.png View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c963d84120be6c9dbd55078d72c6872b193294304954c55db22267f0d5317452
size 7257
oid sha256:8ec1b9522a2db5ee09f767dae4c4214b97c6055b9025fe3f3da4301617bc3332
size 52337

+ 62
- 7
Assets/Textures/Icon.png.meta View File

@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
@ -34,13 +34,13 @@ TextureImporter:
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
@ -49,9 +49,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
@ -69,6 +69,61 @@ TextureImporter:
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: tvOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []

+ 24
- 27
Assets/Third Party Assets/KUBIKOS - World/Prefabs/Items/Canon.prefab View File

@ -1,22 +1,12 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1277699181497372}
m_IsPrefabParent: 1
--- !u!1 &1277699181497372
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4904347317534488}
- component: {fileID: 33235018378261012}
@ -30,9 +20,10 @@ GameObject:
m_IsActive: 1
--- !u!4 &4904347317534488
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1277699181497372}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
@ -41,18 +32,30 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &33235018378261012
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1277699181497372}
m_Mesh: {fileID: 4300000, guid: 11fb0b0b08e257f45b2947a4e67e3f39, type: 3}
--- !u!23 &23153283585589664
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1277699181497372}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6e87d9ec395110b44a460dd506e7394a, type: 2}
m_StaticBatchInfo:
@ -65,6 +68,7 @@ MeshRenderer:
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
@ -73,10 +77,3 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &33235018378261012
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1277699181497372}
m_Mesh: {fileID: 4300000, guid: 11fb0b0b08e257f45b2947a4e67e3f39, type: 3}

+ 1
- 1
ProjectSettings/ProjectSettings.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10e0a66072f7571cd5504c1b3fbbcb9214e19f7d90c8737713b00926e1b56bac
oid sha256:14a3ae1e8d542e62e69f3eb680ca69e7105015e4f3855844f646ffd52ff7652f
size 20900

+ 2
- 2
ProjectSettings/TagManager.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7317ce4fb5ff3b0aba81dcbe81d92b823ec0f3ee870b5a2b78560baae6c53a91
size 416
oid sha256:0687602eedd445d6678fa089619485baa9bf0962aeed2f495e1424b471736cf3
size 426

Loading…
Cancel
Save