Browse Source

more work on gamemodes

Josh_Dev_branch
Joshua Reason 5 years ago
parent
commit
8b1e2b3d78
41 changed files with 1019 additions and 186 deletions
  1. +1
    -1
      Assets/Data/GameModes.meta
  2. +3
    -0
      Assets/Data/GameModes/ColorCollide.asset
  3. +8
    -0
      Assets/Data/GameModes/ColorCollide.asset.meta
  4. +1
    -1
      Assets/Data/Inventory/PlayerInventory.asset
  5. +2
    -2
      Assets/Data/Logic Blocks/ForLoop.asset
  6. +2
    -2
      Assets/Data/Logic Blocks/Jump.asset
  7. +2
    -2
      Assets/Data/Logic Blocks/Move x2.asset
  8. +2
    -2
      Assets/Data/Logic Blocks/Move.asset
  9. +2
    -2
      Assets/Data/Logic Blocks/Rotate Left.asset
  10. +2
    -2
      Assets/Data/Logic Blocks/Rotate Right.asset
  11. +3
    -0
      Assets/Data/Networking/Server/Realtime/Current GameMode.asset
  12. +8
    -0
      Assets/Data/Networking/Server/Realtime/Current GameMode.asset.meta
  13. +63
    -0
      Assets/Materials/MajorProject_ColorMask.mat
  14. +8
    -0
      Assets/Materials/MajorProject_ColorMask.mat.meta
  15. +127
    -0
      Assets/Materials/Shaders/ColorMask.shader
  16. +9
    -0
      Assets/Materials/Shaders/ColorMask.shader.meta
  17. +1
    -15
      Assets/Prefabs/GameManager.prefab
  18. +251
    -0
      Assets/Prefabs/UI/Logic Element For.prefab
  19. +7
    -0
      Assets/Prefabs/UI/Logic Element For.prefab.meta
  20. +32
    -14
      Assets/Scenes/Client Scenes/ClientScene.unity
  21. +39
    -0
      Assets/Scenes/Server Scenes/ServerTestScene.unity
  22. +1
    -1
      Assets/Scripts/Components.meta
  23. +0
    -112
      Assets/Scripts/GameMode/ColorGameMode.cs
  24. +1
    -1
      Assets/Scripts/GameMode/ColorGameMode.meta
  25. +137
    -0
      Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs
  26. +0
    -0
      Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs.meta
  27. +47
    -0
      Assets/Scripts/GameMode/ColorGameMode/ScoreDisplay.cs
  28. +11
    -0
      Assets/Scripts/GameMode/ColorGameMode/ScoreDisplay.cs.meta
  29. +21
    -6
      Assets/Scripts/GameMode/GameMode.cs
  30. +12
    -0
      Assets/Scripts/Logic/Blocks/CombinedBlock.cs
  31. +21
    -1
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  32. +22
    -18
      Assets/Scripts/Managers/GameManager.cs
  33. +14
    -3
      Assets/Scripts/UI/BagItem.cs
  34. +19
    -0
      Assets/Scripts/UI/ComplexLogicElementUI.cs
  35. +11
    -0
      Assets/Scripts/UI/ComplexLogicElementUI.cs.meta
  36. +14
    -1
      Assets/Scripts/UI/Dragable.cs
  37. +8
    -0
      Assets/Scripts/UI/ILogicElementHolder.cs
  38. +6
    -0
      Assets/Scripts/UI/LogicElementUI.cs
  39. +10
    -0
      Assets/Scripts/UI/LogicTrayUI.cs
  40. +3
    -0
      Assets/Textures/GroundWGrass_Mask.jpg
  41. +88
    -0
      Assets/Textures/GroundWGrass_Mask.jpg.meta

+ 1
- 1
Assets/Data/GameModes.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ac893ebcf6aa2894cbfa7152c977643e
guid: af92d541cb7dc944d8fffa68aa3a6e94
folderAsset: yes
DefaultImporter:
externalObjects: {}

+ 3
- 0
Assets/Data/GameModes/ColorCollide.asset View File

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

+ 8
- 0
Assets/Data/GameModes/ColorCollide.asset.meta View File

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

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4583835e60ade6fdf62d738ba16346ea0b0a272531ddc3f2ae77eb4a08015b0c
oid sha256:b461219fe61fa8068804d40407fb1e13919f1586959b20af63ed803c87d8ce40
size 972

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34e0722afbe625d87d5ef748ee29a3ed763df335fd3bb1f189820962121e4411
size 675
oid sha256:6e6e8e46d29e12c7793ce76da141fbb3dc619368660efd6d4338052edcafd802
size 787

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:49d74fee28f711c623d0d219f70aa6b3099be45bbb398fc9b46373c2f962a3c5
size 507
oid sha256:1f714c1e2427f440973c4b364ef594f0ae120c6b7110676cbf8514a5788b8942
size 629

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:32f839ca370d74c812af63fa2b54ea03337bbc29aa02e1c325a37869ea9e2f0f
size 511
oid sha256:dde8e452b31badc77fd8e878c2e1e69f4e3759006ef42706647133b16b1204c8
size 607

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c02ccd234c974be76b21bbc246437fb9b8bb724e596d77213d0023012cf1996
size 508
oid sha256:2c997ef9823b34568317d076bc4e80df598da865723f32016fbbc3cc9f82211d
size 604

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b8a99ebd1cdcc067be9e66d49377b3fea82bccb6ed878edf467bd9af4020451b
size 514
oid sha256:f4eeaa30543f44211dc633b143fed2198f22e0efffa66487324ddcc30be54401
size 610

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

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03cc745c401648ff6ebd18a61cb036d5b11da4725fe81d5d8203de7d48e44684
size 516
oid sha256:e63d262fe598ea766710e22e16e8a332c70be0f95b9c4e507448c05b99f9bedb
size 612

+ 3
- 0
Assets/Data/Networking/Server/Realtime/Current GameMode.asset View File

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

+ 8
- 0
Assets/Data/Networking/Server/Realtime/Current GameMode.asset.meta View File

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

+ 63
- 0
Assets/Materials/MajorProject_ColorMask.mat View File

@ -0,0 +1,63 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MajorProject_ColorMask
m_Shader: {fileID: 4800000, guid: ce792a77c9d4bdd41b4a3bbada679045, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Albedo:
m_Texture: {fileID: 2800000, guid: 257566232cf784c47ac6cedbd2354753, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Gradient:
m_Texture: {fileID: 2800000, guid: 24528dab924059845ba09c5e2035bfb6, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _GreyScale:
m_Texture: {fileID: 2800000, guid: bdde6241b2279b2428f3dd16d64db5c5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Mask:
m_Texture: {fileID: 2800000, guid: 4cc972a8190637f429988d776be4bfe1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal:
m_Texture: {fileID: 2800000, guid: 9b5ce4b2cb92101469e6b391a0eb11fa, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Smoothness:
m_Texture: {fileID: 2800000, guid: 7576199877aa5fe488012ae9d8bae852, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Base: -0.87
- _Cutoff: 0.5
- _GradiantBoost: 0
- _MaskCutoff: 1
- _Multiplier: 1
- _OpacityMask: 0
- _RemapMax: 1
- _RemapMin: -0.93
- __dirty: 0
m_Colors:
- _ColorMask: {r: 0.54509807, g: 0.6666667, b: 0.14509805, a: 1}
- _NewColor: {r: 1, g: 0, b: 0.5997324, a: 1}
- _Remap: {r: -0.85, g: 1, b: 0, a: 0}

+ 8
- 0
Assets/Materials/MajorProject_ColorMask.mat.meta View File

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

+ 127
- 0
Assets/Materials/Shaders/ColorMask.shader View File

@ -0,0 +1,127 @@
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "MajorProject/ColorMask"
{
Properties
{
_Albedo("Albedo", 2D) = "white" {}
_Normal("Normal", 2D) = "bump" {}
_Smoothness("Smoothness", 2D) = "black" {}
_Mask("Mask", 2D) = "black" {}
_NewColor("New Color", Color) = (1,1,1,1)
_Multiplier("Multiplier", Range( 0 , 1)) = 0
_RemapMin("Remap Min", Float) = 0
_RemapMax("Remap Max", Float) = 1
[Toggle(_OPACITYMASK_ON)] _OpacityMask("Opacity Mask", Float) = 0
_Cutoff( "Mask Clip Value", Float ) = 0.5
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[HideInInspector] __dirty( "", Int ) = 1
}
SubShader
{
Tags{ "RenderType" = "TransparentCutout" "Queue" = "AlphaTest+0" }
Cull Back
CGPROGRAM
#pragma target 3.5
#pragma shader_feature _OPACITYMASK_ON
#pragma surface surf Standard keepalpha addshadow fullforwardshadows
struct Input
{
float2 uv_texcoord;
};
uniform sampler2D _Normal;
uniform float4 _Normal_ST;
uniform sampler2D _Albedo;
uniform float4 _Albedo_ST;
uniform float4 _NewColor;
uniform sampler2D _Mask;
uniform float4 _Mask_ST;
uniform float _Multiplier;
uniform float _RemapMin;
uniform float _RemapMax;
uniform sampler2D _Smoothness;
uniform float4 _Smoothness_ST;
uniform float _Cutoff = 0.5;
void surf( Input i , inout SurfaceOutputStandard o )
{
float2 uv_Normal = i.uv_texcoord * _Normal_ST.xy + _Normal_ST.zw;
o.Normal = UnpackNormal( tex2D( _Normal, uv_Normal ) );
float2 uv_Albedo = i.uv_texcoord * _Albedo_ST.xy + _Albedo_ST.zw;
float2 uv_Mask = i.uv_texcoord * _Mask_ST.xy + _Mask_ST.zw;
float4 tex2DNode40 = tex2D( _Mask, uv_Mask );
float GreyScale57 = tex2DNode40.g;
float Mask56 = tex2DNode40.r;
float Gradient58 = tex2DNode40.b;
float clampResult49 = clamp( ( Mask56 * ( Gradient58 + (_RemapMin + (_Multiplier - 0.0) * (_RemapMax - _RemapMin) / (1.0 - 0.0)) ) ) , 0.0 , 1.0 );
float4 lerpResult37 = lerp( tex2D( _Albedo, uv_Albedo ) , ( _NewColor * GreyScale57 ) , clampResult49);
o.Albedo = lerpResult37.rgb;
float2 uv_Smoothness = i.uv_texcoord * _Smoothness_ST.xy + _Smoothness_ST.zw;
o.Smoothness = tex2D( _Smoothness, uv_Smoothness ).r;
o.Alpha = 1;
#ifdef _OPACITYMASK_ON
float staticSwitch62 = Mask56;
#else
float staticSwitch62 = 1.0;
#endif
clip( staticSwitch62 - _Cutoff );
}
ENDCG
}
Fallback "Diffuse"
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=16301
-1913;41;1906;904;2697.262;385.5416;1.738442;True;True
Node;AmplifyShaderEditor.SamplerNode;40;-3308.219,121.9752;Float;True;Property;_Mask;Mask;3;0;Create;True;0;0;False;0;None;e7d9151c9febbf644bde373c46578f65;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.RangedFloatNode;66;-2319.11,529.9472;Float;False;Property;_RemapMin;Remap Min;6;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;67;-2317.577,621.9814;Float;False;Property;_RemapMax;Remap Max;7;0;Create;True;0;0;False;0;1;1;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;17;-2420.317,447.0833;Float;False;Property;_Multiplier;Multiplier;5;0;Create;True;0;0;False;0;0;0;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;58;-2932.687,259.9786;Float;False;Gradient;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;56;-2929.621,75.90977;Float;False;Mask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;61;-2093.632,353.5475;Float;False;58;Gradient;1;0;OBJECT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.TFHCRemapNode;53;-2103.26,450.3091;Float;False;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;0;False;4;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleAddOpNode;47;-1852.525,396.3673;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.RegisterLocalVarNode;57;-2932.687,163.3426;Float;False;GreyScale;-1;True;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;59;-1927.977,144.9355;Float;False;56;Mask;1;0;OBJECT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;60;-1464.73,-192.5235;Float;False;57;GreyScale;1;0;OBJECT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ColorNode;23;-1481.814,-381.4917;Float;False;Property;_NewColor;New Color;4;0;Create;True;0;0;False;0;1,1,1,1;1,0,0.5997324,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;44;-1654.714,30.30221;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ClampOpNode;49;-1475.303,6.989078;Float;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
Node;AmplifyShaderEditor.GetLocalVarNode;65;-868.0339,539.1504;Float;False;56;Mask;1;0;OBJECT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;64;-832.7534,387.294;Float;False;Constant;_White;White;9;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.SamplerNode;1;-896.2167,-467.1677;Float;True;Property;_Albedo;Albedo;0;0;Create;True;0;0;False;0;None;7f1bb6af05d718f48af775047bd04b4f;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;38;-1105.531,-227.9056;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
Node;AmplifyShaderEditor.SamplerNode;2;-540.3304,-42.06005;Float;True;Property;_Normal;Normal;1;0;Create;True;0;0;False;0;None;5553ee8a4e29ebe4db63964308557f7e;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.LerpOp;37;-414.3218,-176.3671;Float;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
Node;AmplifyShaderEditor.SamplerNode;3;-537.3937,163.1603;Float;True;Property;_Smoothness;Smoothness;2;0;Create;True;0;0;False;0;None;71b48a5f1f9284144afd3ecc727acec1;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.StaticSwitch;62;-496.8282,433.3114;Float;False;Property;_OpacityMask;Opacity Mask;8;0;Create;True;0;0;False;0;0;0;0;True;;Toggle;2;Key0;Key1;9;1;FLOAT;0;False;0;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;12.78892,-25.57785;Float;False;True;3;Float;ASEMaterialInspector;0;0;Standard;MajorProject/ColorMask;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Masked;0.5;True;True;0;False;TransparentCutout;;AlphaTest;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;True;0;0;False;-1;0;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;9;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;False;0.1;False;-1;0;False;-1;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;58;0;40;3
WireConnection;56;0;40;1
WireConnection;53;0;17;0
WireConnection;53;3;66;0
WireConnection;53;4;67;0
WireConnection;47;0;61;0
WireConnection;47;1;53;0
WireConnection;57;0;40;2
WireConnection;44;0;59;0
WireConnection;44;1;47;0
WireConnection;49;0;44;0
WireConnection;38;0;23;0
WireConnection;38;1;60;0
WireConnection;37;0;1;0
WireConnection;37;1;38;0
WireConnection;37;2;49;0
WireConnection;62;1;64;0
WireConnection;62;0;65;0
WireConnection;0;0;37;0
WireConnection;0;1;2;0
WireConnection;0;4;3;0
WireConnection;0;10;62;0
ASEEND*/
//CHKSM=E703D98EAA5182A09A8F04184916C8E4E717C59A

+ 9
- 0
Assets/Materials/Shaders/ColorMask.shader.meta View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ce792a77c9d4bdd41b4a3bbada679045
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 15
Assets/Prefabs/GameManager.prefab View File

@ -10,7 +10,6 @@ GameObject:
m_Component:
- component: {fileID: 1698745550996942701}
- component: {fileID: 1698745550996942698}
- component: {fileID: 1698745550996942699}
m_Layer: 0
m_Name: GameManager
m_TagString: Untagged
@ -45,21 +44,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
AnimationTime: 1
CurrentGameMode: {fileID: 1698745550996942699}
CurrentGameMode: {fileID: 11400000, guid: be8c78868a86aad448fd14e46bd40e51, type: 2}
characterPrefab: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a,
type: 3}
server: {fileID: 11400000, guid: aba6c842adfc9904dba334cb48257361, type: 2}
ClientList: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2}
--- !u!114 &1698745550996942699
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1698745550996942700}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 409aae8124657b749a57c1c665917371, type: 3}
m_Name:
m_EditorClassIdentifier:
MaxRound: 5

+ 251
- 0
Assets/Prefabs/UI/Logic Element For.prefab View File

@ -0,0 +1,251 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &995834699587958428
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 315265088473579728}
- component: {fileID: 8830634564332075202}
- component: {fileID: 8680666039847169627}
- component: {fileID: 4922755785039726207}
m_Layer: 5
m_Name: Logic Element For
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &315265088473579728
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 995834699587958428}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2825904309766046644}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 57.750065, y: -57.349976}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8830634564332075202
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 995834699587958428}
m_CullTransparentMesh: 0
--- !u!114 &8680666039847169627
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 995834699587958428}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &4922755785039726207
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 995834699587958428}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7107813cded9af9409ab112a20b5fc65, type: 3}
m_Name:
m_EditorClassIdentifier:
LogicElement: {fileID: 0}
--- !u!1 &8739916369872115426
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2825904309766046644}
- component: {fileID: 8242920397958318725}
- component: {fileID: 4794918698464335520}
m_Layer: 5
m_Name: TextMeshPro Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2825904309766046644
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8739916369872115426}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 315265088473579728}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -10, y: -10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8242920397958318725
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8739916369872115426}
m_CullTransparentMesh: 0
--- !u!114 &4794918698464335520
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8739916369872115426}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: Logic
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 37.6
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_isAlignmentEnumConverted: 1
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 4794918698464335520}
characterCount: 5
spriteCount: 0
spaceCount: 0
wordCount: 1
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_havePropertiesChanged: 0
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_isInputParsingRequired: 0
m_inputSource: 0
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}

+ 7
- 0
Assets/Prefabs/UI/Logic Element For.prefab.meta View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ea33f57b7c744cd48a020596f0ae72f5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 32
- 14
Assets/Scenes/Client Scenes/ClientScene.unity View File

@ -112,18 +112,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!114 &760546447 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5195354183157824118, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
m_PrefabInstance: {fileID: 5195354181466942481}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 140e56929e1450a48b2f7716511bb327, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1254212986
GameObject:
m_ObjectHideFlags: 0
@ -193,6 +181,29 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1324620580 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5195354183101525344, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
m_PrefabInstance: {fileID: 5195354181466942481}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1324620581
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324620580}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 140e56929e1450a48b2f7716511bb327, type: 3}
m_Name:
m_EditorClassIdentifier:
Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3}
insertIndex: -1
content: {fileID: 1704581577}
reader:
LogicChain: []
--- !u!1 &1352513146
GameObject:
m_ObjectHideFlags: 0
@ -275,6 +286,12 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!224 &1704581577 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
m_PrefabInstance: {fileID: 5195354181466942481}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1804173232 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5195354183134146528, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
@ -473,7 +490,7 @@ PrefabInstance:
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -0.000008558129
value: -0.000013713701
objectReference: {fileID: 0}
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
@ -612,6 +629,7 @@ PrefabInstance:
objectReference: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
m_RemovedComponents:
- {fileID: 5195354182462625307, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3}
- {fileID: 5195354183157824118, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3}
--- !u!1 &5195354181466942482 stripped
GameObject:
@ -633,5 +651,5 @@ MonoBehaviour:
m_EditorClassIdentifier:
Inventory: {fileID: 1804173232}
AnimationSpeed: 0.5
TrayUI: {fileID: 760546447}
TrayUI: {fileID: 1324620581}
Client: {fileID: 11400000, guid: 8dca4719b56d91143b236583a436c911, type: 2}

+ 39
- 0
Assets/Scenes/Server Scenes/ServerTestScene.unity View File

@ -2778,3 +2778,42 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a199dd5d5f6e9ad48966d0d0a8961305, type: 3}
--- !u!1 &1698745552051899335 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1698745550996942700, guid: a199dd5d5f6e9ad48966d0d0a8961305,
type: 3}
m_PrefabInstance: {fileID: 1698745552051899334}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1698745552051899336
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1698745552051899335}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 96bf274f514b09741a0ff748fef480f0, type: 3}
m_Name:
m_EditorClassIdentifier:
Reference: {fileID: 11400000, guid: be8c78868a86aad448fd14e46bd40e51, type: 2}
OnRoundStart:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
OnPlayersMoved:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
OnRoundEnd:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
OnGameOver:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null

Assets/Models.meta → Assets/Scripts/Components.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 296bd90e667df1f4697823a0aa45acf0
guid: 8d7394d70ec233849a60a26da5f23b75
folderAsset: yes
DefaultImporter:
externalObjects: {}

+ 0
- 112
Assets/Scripts/GameMode/ColorGameMode.cs View File

@ -1,112 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Networking.Server;
using TMPro;
using UnityEngine.UI;
public class ColorGameMode : GameMode
{
public int MaxRound = 5;
private int RoundCount = 0;
public GameObject counterScore;
public GameObject colorCube;
private int counter = 1;
private GameObject[] objs;
public Texture playerTexture;
private LayerMask Ignore;
public List<ClientData> ConnectedClients;
public GameObject levelScoreboard;
public GameObject[] players = new GameObject[4];
public GameObject[] scores = new GameObject[4];
public ScoreBoard mainscoreboard;
void Start(){
counterScore.GetComponent<TextMeshProUGUI>().text = counter.ToString();
objs = GameObject.FindGameObjectsWithTag("Coloured");
}
/// <summary>
/// Called once all players have finished their moves but before the Objective is checked
/// </summary>
public override void OnRoundFinished()
{
RoundCount++;
}
/// <summary>
/// Checks if the Game is finished
/// </summary>
/// <returns>returns if game is finished</returns>
public override bool isGameOver()
{
return (RoundCount <= MaxRound);
}
/// <summary>
/// couroutine to display level scores
/// </summary>
IEnumerator displayforSeconds(GameObject display, float time)
{
display.SetActive (true);
yield return new WaitForSeconds(time);
display.SetActive (false);
mainscoreboard.endGame();
}
/// <summary>
/// calculates and assigns scores in desc order, call coroutine
/// </summary>
public void levelComplete(ClientList clientDataList)
{
ConnectedClients = clientDataList.ConnectedClients;
ConnectedClients.Sort((a, b) => b.collected.CompareTo(a.collected));
for (int i = 0; i<ConnectedClients.Count; i++){
players[i].GetComponent<TextMeshProUGUI>().text = ConnectedClients[i].Name;
scores[i].GetComponent<TextMeshProUGUI>().text = ConnectedClients[i].collected.ToString();
}
StartCoroutine(displayforSeconds(levelScoreboard, 10.0f));
}
/// <summary>
/// Called once per player after they have moved onto a block
/// </summary>
/// <param name="character">Character which moved</param>
/// <param name="client">Client of the character</param>
/// <param name="currentBlock">Block moved onto</param>
public override void OnPlayerFinishedMove(Character character, ClientData client, Block currentBlock)
{
string clientTexture = client.Color + "Grass";
playerTexture = Resources.Load<Texture>(clientTexture);
//Resources.Load<Texture2D>(clientTexture);
//Code for changing block color;
//Block.isBlockAtPosition(transform.position + Vector3.down / 2, 0.5f, ~Ignore, out CurrentBlock);
Renderer abc = currentBlock.GetComponent<Renderer>();
if(abc.material.GetTexture("_Albedo") != playerTexture){
abc.material.SetTexture("_Albedo", playerTexture);
}
//Code for updating player scores;
colorCube.GetComponent<Image>().color = client.Color;
counter = 1;
foreach(GameObject a in objs){
abc = a.GetComponent<Renderer>();
if (abc.material.GetTexture("_Albedo") == playerTexture)
{
counter++;
}
}
counterScore.GetComponent<TextMeshProUGUI>().text = counter.ToString();
client.collected = counter;
}
}

Assets/Scripts/LogicBlocks.meta → Assets/Scripts/GameMode/ColorGameMode.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8936b441d7647f74884c94f97bfb8931
guid: e251164a6e5cf944faa5e01f8dc9e2d4
folderAsset: yes
DefaultImporter:
externalObjects: {}

+ 137
- 0
Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs View File

@ -0,0 +1,137 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Networking.Server;
using TMPro;
using UnityEngine.UI;
[CreateAssetMenu(menuName = "Major Project/GameModes/Color Collide", order = 201)]
public class ColorGameMode : GameMode
{
public int MaxRound = 5;
public Material OverlayMaterial;
private int RoundCount = 0;
private Dictionary<ClientData, List<Block>> BlocksOwned;
/// <summary>
/// Called once all players have finished their moves but before the Objective is checked
/// </summary>
protected override void OnRoundEnd(PlayerData[] allPlayers)
{
RoundCount++;
}
/// <summary>
/// Checks if the Game is finished
/// </summary>
/// <returns>returns if game is finished</returns>
public override bool isGameOver(PlayerData[] allPlayers)
{
return (RoundCount <= MaxRound);
}
/// <summary>
/// Called once per player after they have moved onto a block
/// </summary>
/// <param name="character">Character which moved</param>
/// <param name="client">Client of the character</param>
/// <param name="currentBlock">Block moved onto</param>
protected override void OnPlayerFinishedMove(Character character, ClientData client, Block currentBlock)
{
ClientData OwnedClient;
Material overlay = null;
if (isOwned(currentBlock, out OwnedClient))
{
if (OwnedClient == client)
return;
BlocksOwned[OwnedClient].Remove(currentBlock);
foreach (Material mat in currentBlock.GetComponent<Renderer>().materials)
{
if (mat.name == OverlayMaterial.name + " (Instance)")
overlay = mat;
}
}
if (overlay == null)
{
overlay = new Material(OverlayMaterial);
List<Material> mats = new List<Material>(currentBlock.GetComponent<Renderer>().materials);
mats.Add(overlay);
currentBlock.GetComponent<Renderer>().materials = mats.ToArray();
}
overlay.SetColor("_NewColor", client.Color);
if (!BlocksOwned.ContainsKey(client))
BlocksOwned.Add(client, new List<Block>());
BlocksOwned[client].Add(currentBlock);
if (overlay != null)
currentBlock.StartCoroutine(AnimateBlock(overlay, 0.25f));
}
protected override void OnRoundStart(PlayerData[] allPlayers)
{
}
protected override void OnAllPlayersFinishedMove(PlayerData[] allPlayers)
{
foreach (PlayerData player in allPlayers)
{
if (BlocksOwned.ContainsKey(player.client))
player.client.collected = BlocksOwned[player.client].Count;
else
player.client.collected = 0;
}
}
protected override void OnGameOver(PlayerData[] allPlayers)
{
throw new System.NotImplementedException();
}
private bool isOwned(Block block, out ClientData client)
{
client = null;
foreach (KeyValuePair<ClientData, List<Block>> ownedList in BlocksOwned)
{
if (ownedList.Value.Contains(block))
{
client = ownedList.Key;
return true;
}
}
return false;
}
private IEnumerator AnimateBlock(Material mat, float time)
{
float timeElasped = 0;
while (timeElasped < time)
{
mat.SetFloat("_Multiplier", (timeElasped / time));
yield return new WaitForEndOfFrame();
timeElasped += Time.deltaTime;
}
mat.SetFloat("_Multiplier", 1);
}
protected override void OnGameStart(PlayerData[] allPlayers)
{
BlocksOwned = new Dictionary<ClientData, List<Block>>();
}
}

Assets/Scripts/GameMode/ColorGameMode.cs.meta → Assets/Scripts/GameMode/ColorGameMode/ColorGameMode.cs.meta View File


+ 47
- 0
Assets/Scripts/GameMode/ColorGameMode/ScoreDisplay.cs View File

@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Networking.Server;
public class ScoreDisplay : MonoBehaviour
{
public List<ClientData> ConnectedClients;
public GameObject levelScoreboard;
public GameObject[] players = new GameObject[4];
public GameObject[] scores = new GameObject[4];
public ScoreBoard mainscoreboard;
/// <summary>
/// calculates and assigns scores in desc order, call coroutine
/// </summary>
public void levelComplete(ClientList clientDataList)
{
ConnectedClients = clientDataList.ConnectedClients;
ConnectedClients.Sort((a, b) => b.collected.CompareTo(a.collected));
for (int i = 0; i < ConnectedClients.Count; i++)
{
players[i].GetComponent<TextMeshProUGUI>().text = ConnectedClients[i].Name;
scores[i].GetComponent<TextMeshProUGUI>().text = ConnectedClients[i].collected.ToString();
}
StartCoroutine(displayforSeconds(levelScoreboard, 10.0f));
}
/// <summary>
/// couroutine to display level scores
/// </summary>
IEnumerator displayforSeconds(GameObject display, float time)
{
display.SetActive(true);
yield return new WaitForSeconds(time);
display.SetActive(false);
mainscoreboard.endGame();
}
}

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

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

+ 21
- 6
Assets/Scripts/GameMode/GameMode.cs View File

@ -6,11 +6,19 @@ using Networking.Server;
public abstract class GameMode : ScriptableObject
{
[SerializeField]
[Tooltip("Scene to load which contains Gamemode UI")]
private string GameModeScene;
public Action RoundStartEvent;
public Action AllPlayersMovedEvent;
public Action RoundEndEvent;
public Action OnGameOverEvent;
protected abstract void OnGameStart(PlayerData[] allPlayers);
/// <summary>
/// Called at the beginning of a new Round
/// </summary>
@ -32,16 +40,23 @@ public abstract class GameMode : ScriptableObject
public abstract bool isGameOver(PlayerData[] allPlayers);
public abstract void OnRoundEnd(PlayerData[] allPlayers);
protected abstract void OnRoundEnd(PlayerData[] allPlayers);
public abstract void OnGameOver(PlayerData[] allPlayers);
protected abstract void OnGameOver(PlayerData[] allPlayers);
public void GameStart(PlayerData[] allPlayers)
{
if (!String.IsNullOrEmpty(GameModeScene))
UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(GameModeScene);
OnGameStart(allPlayers);
}
public void RoundStart(PlayerData[] allPlayers)
{
OnRoundStart(allPlayers);
RoundStartEvent.Invoke();
RoundStartEvent?.Invoke();
}
public void FinishedMove(PlayerData[] allPlayers)
@ -50,18 +65,18 @@ public abstract class GameMode : ScriptableObject
OnPlayerFinishedMove(player.character, player.client, player.character.CurrentBlock);
OnAllPlayersFinishedMove(allPlayers);
AllPlayersMovedEvent.Invoke();
AllPlayersMovedEvent?.Invoke();
}
public void RoundEnd(PlayerData[] allPlayers)
{
OnRoundEnd(allPlayers);
RoundEndEvent.Invoke();
RoundEndEvent?.Invoke();
}
public void GameOver(PlayerData[] allPlayers)
{
OnGameOver(allPlayers);
OnGameOverEvent.Invoke();
OnGameOverEvent?.Invoke();
}
}

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

@ -7,6 +7,10 @@ using UnityEngine;
public class CombinedBlock : LogicBlock
{
#region Inspector Variables
[SerializeField]
[Tooltip("Is this block editable")]
protected bool isEditable = false;
[SerializeField]
[Tooltip("Blocks this will run through")]
protected BlockReader blockReader;
@ -56,6 +60,13 @@ public class CombinedBlock : LogicBlock
blockReader.Reset();
}
public override void OnDoubleClick()
{
base.OnDoubleClick();
}
#region Serialisation Functions
public override void CopyToken(BlockToken token)
{
base.CopyToken(token);
@ -79,6 +90,7 @@ public class CombinedBlock : LogicBlock
return retVal;
}
#endregion Serialisation Functions
}

+ 21
- 1
Assets/Scripts/Logic/Blocks/LogicBlock.cs View File

@ -27,6 +27,11 @@ public abstract class LogicBlock : ScriptableObject
[SerializeField]
[Tooltip("Amount of times to run this Block before moving to next")]
protected int RepeatAmount = 1;
[SerializeField]
[Tooltip("UI Object which is spawned as object")]
public LogicElementUI UIPrefab;
#endregion Inspector Fields
#region ReadOnly Variables
@ -42,7 +47,6 @@ public abstract class LogicBlock : ScriptableObject
#endregion private variables
#region Class Functions
/// <summary>
/// Runs the block
@ -100,6 +104,11 @@ public abstract class LogicBlock : ScriptableObject
}
#region Serialisation Functions
/// <summary>
/// Copies data from BlockToken to this Block
/// </summary>
/// <param name="token">Token to Copy</param>
public virtual void CopyToken(BlockToken token)
{
Color = token.Color;
@ -109,6 +118,11 @@ public abstract class LogicBlock : ScriptableObject
name = token.ObjectName;
}
/// <summary>
/// Copies Block data to supplied token, if token is null creates new token
/// </summary>
/// <param name="token">token to copy data to</param>
/// <returns></returns>
public virtual BlockToken ToToken(BlockToken token = null)
{
if (token == null)
@ -121,7 +135,13 @@ public abstract class LogicBlock : ScriptableObject
return token;
}
#endregion Serialisation Functions
public virtual void OnDoubleClick()
{
}
#endregion Class Functions
}

+ 22
- 18
Assets/Scripts/Managers/GameManager.cs View File

@ -14,7 +14,7 @@ public class GameManager : MonoBehaviour
[SerializeField]
private float AnimationTime;
[SerializeField]
private GameMode CurrentGameMode;
private GameModeReference CurrentGameMode;
[Header("References")]
@ -33,12 +33,19 @@ public class GameManager : MonoBehaviour
#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 void Awake()
{
gamemode = CurrentGameMode.Value;
RegisterHandlers();
SpawnCharacters();
gamemode.GameStart(playerArray.ToArray());
}
private void Update()
@ -74,12 +81,12 @@ public class GameManager : MonoBehaviour
private IEnumerator RoundRoutine()
{
playerData.ForEach(p => p.Value.recievedList = false);
playerArray.ForEach(p => p.recievedList = false);
while (playerData.Any(p => !p.Value.blockReader.Finished))
while (playerArray.Any(p => !p.blockReader.Finished))
{
foreach (PlayerData player in playerData.Values)
foreach (PlayerData player in playerArray)
{
if (!player.waiting)
{
@ -89,22 +96,24 @@ public class GameManager : MonoBehaviour
yield return new WaitForSeconds(AnimationTime);
foreach(KeyValuePair<int,PlayerData> player in playerData)
gamemode.FinishedMove(playerArray.ToArray());
if (playerArray.All(p => p.waiting))
{
ClientData client = ClientList.ConnectedClients.First(p => p.ID == player.Key);
CurrentGameMode.OnPlayerFinishedMove(player.Value.character, client, player.Value.character.CurrentBlock);
playerArray.ForEach(p => p.waiting = false);
Debug.Log("Finished one move");
}
if (playerData.All(p => p.Value.waiting))
if (gamemode.isGameOver(playerArray.ToArray()))
{
playerData.ForEach(p => p.Value.waiting = false);
Debug.Log("Finished one move");
Debug.Log("Game Over");
}
}
CurrentGameMode.OnRoundFinished();
CurrentGameMode.isGameOver();
gamemode.RoundEnd(playerArray.ToArray());
foreach (PlayerData player in playerArray)
player.blockReader.Reset();
Debug.Log("Finished Moving");
}
@ -129,12 +138,7 @@ public class GameManager : MonoBehaviour
private void RegisterHandlers()
{
server.server.RegisterHandler(LogicProtocols.SendLogicList, RecieveLogicList);
}
}
}
public class PlayerData

+ 14
- 3
Assets/Scripts/UI/BagItem.cs View File

@ -7,9 +7,6 @@ using TMPro;
public class BagItem : LogicElementHolder
{
#region Inspector Elements
[SerializeField]
private LogicElementUI LogicElementPrefab;
[SerializeField]
private Transform LogicElementLocation;
#endregion Inspector Elements
@ -18,6 +15,7 @@ public class BagItem : LogicElementHolder
private int Count;
protected Inventory.Data InventoryData;
private TextMeshProUGUI CountText;
private LogicElementUI LogicElementPrefab;
#endregion Private Variables
#region Class Functionality
@ -25,6 +23,7 @@ public class BagItem : LogicElementHolder
public void Initialise(Inventory.Data data)
{
InventoryData = data;
LogicElementPrefab = data.element.UIPrefab;
if (CountText == null)
CountText = GetComponentInChildren<TextMeshProUGUI>();
@ -81,6 +80,18 @@ public class BagItem : LogicElementHolder
UpdateUI();
}
/// <summary>
/// Called when an element in this holder is double clicked
/// </summary>
/// <param name="element">element which was double clicked</param>
public override void OnDoubleClick(LogicElementUI element)
{
}
#endregion LogicElementHolder Implementation
}

+ 19
- 0
Assets/Scripts/UI/ComplexLogicElementUI.cs View File

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

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

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

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

@ -3,10 +3,12 @@ using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class Dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
public class Dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerClickHandler
{
protected RectTransform m_DraggingPlane;
private float lastClickTime = -1;
public virtual void OnBeginDrag(PointerEventData eventData)
{
var canvas = FindInParents<Canvas>(gameObject);
@ -56,4 +58,15 @@ public class Dragable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDrag
}
return comp;
}
public void OnPointerClick(PointerEventData eventData)
{
if (Time.time - lastClickTime <= 0.5f)
OnDoubleClick();
lastClickTime = Time.time;
}
protected virtual void OnDoubleClick() { }
}

+ 8
- 0
Assets/Scripts/UI/ILogicElementHolder.cs View File

@ -56,6 +56,14 @@ public abstract class LogicElementHolder : MonoBehaviour
/// </summary>
/// <param name="element">Element which is hovering</param>
public virtual void OnHoverEnd(LogicElementUI element) { }
/// <summary>
/// Called when an element in this holder is double clicked
/// </summary>
/// <param name="element">element which was double clicked</param>
public abstract void OnDoubleClick(LogicElementUI element);
#endregion Class Funtions
#region Static Functions

+ 6
- 0
Assets/Scripts/UI/LogicElementUI.cs View File

@ -128,6 +128,12 @@ public class LogicElementUI : Dragable
currentHolder.OnAdd(this);
}
protected override void OnDoubleClick()
{
base.OnDoubleClick();
currentHolder.OnDoubleClick(this);
}
#endregion Drag Implementaion
}

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

@ -140,6 +140,15 @@ public class LogicTrayUI : LogicElementHolder
}
#endregion LogicElementHolder Implementation
/// <summary>
/// Called when an element in this holder is double clicked
/// </summary>
/// <param name="element">element which was double clicked</param>
public override void OnDoubleClick(LogicElementUI element)
{
throw new System.NotImplementedException();
}
#region Helper Functions
public int GetInsertIndex(RectTransform rt)
@ -156,6 +165,7 @@ public class LogicTrayUI : LogicElementHolder
return reader.LogicChain.Count;
}
#endregion Helper Functions
}

+ 3
- 0
Assets/Textures/GroundWGrass_Mask.jpg View File

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

+ 88
- 0
Assets/Textures/GroundWGrass_Mask.jpg.meta View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 4cc972a8190637f429988d776be4bfe1
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
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: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
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: 0
spriteTessellationDetail: -1
textureType: 0
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save