From b13341b437ab9d0d762da08835f150ec6ce1d130 Mon Sep 17 00:00:00 2001 From: Jiwoo Jang Date: Mon, 10 Dec 2018 00:13:01 -0500 Subject: [PATCH] Added time synchronization for round timer, and finished round start UI --- .gitignore | 44 +- Assets/Animations/UI.meta | 8 + Assets/Animations/UI/FightPopup.anim | 877 ++++++++++++++++++ Assets/Animations/UI/FightPopup.anim.meta | 8 + Assets/Animations/UI/RoundUI.controller | 128 +++ Assets/Animations/UI/RoundUI.controller.meta | 8 + Assets/Fonts/MK2_SDF.asset | 12 +- Assets/Resources/PlayerUI.prefab | 30 +- Assets/Scenes/SandboxScene.unity | 556 ++++++++++- Assets/Scripts/Debug/DebugGameManager.cs | 12 +- Assets/Scripts/Input/InputManager.cs | 27 +- Assets/Scripts/Match/MatchManager.cs | 189 +++- Assets/Scripts/Networking/NetworkManager.cs | 63 +- .../Player Control/FighterController.cs | 2 +- Assets/Scripts/UI/PlayerRoundUI.cs | 31 - Assets/Scripts/UI/PlayerUI.cs | 88 ++ ...PlayerRoundUI.cs.meta => PlayerUI.cs.meta} | 0 Assets/Scripts/UI/RoundUI.cs | 65 ++ Assets/Scripts/UI/RoundUI.cs.meta | 11 + Assets/Scripts/UI/UIManager.cs | 81 +- Assets/Textures/Menus/MenuSprites.png.meta | 42 + .../Resources/PhotonServerSettings.asset | 5 + ProjectSettings/EditorBuildSettings.asset | 3 + 23 files changed, 2177 insertions(+), 113 deletions(-) create mode 100644 Assets/Animations/UI.meta create mode 100644 Assets/Animations/UI/FightPopup.anim create mode 100644 Assets/Animations/UI/FightPopup.anim.meta create mode 100644 Assets/Animations/UI/RoundUI.controller create mode 100644 Assets/Animations/UI/RoundUI.controller.meta delete mode 100644 Assets/Scripts/UI/PlayerRoundUI.cs create mode 100644 Assets/Scripts/UI/PlayerUI.cs rename Assets/Scripts/UI/{PlayerRoundUI.cs.meta => PlayerUI.cs.meta} (100%) create mode 100644 Assets/Scripts/UI/RoundUI.cs create mode 100644 Assets/Scripts/UI/RoundUI.cs.meta diff --git a/.gitignore b/.gitignore index f0c2905..403eacd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,20 @@ -## Ignore Unity temporary files, build results, etc -/[Ll]ibrary/ -/[Tt]emp/ -/[Oo]bj/ -/[Bb]uild/ -/[Bb]uilds/ -/Assets/AssetStoreTools* -/[Bb]uilds[Nn][Cc]lips/ +[Ll]ibrary/ +[Tt]emp/ +[Oo]bj/ +[Bb]uild/ +[Bb]uilds/ +[Bb]uild.meta + +Assets/~NonVersioned* +Assets/LoomSDK/Samples/*.zip +Assets/LoomSDK/Samples/*.zip.meta + +# Visual Studio 2015 cache directory /.vs/ -# Autogenerated VS/MD solution and project files +# Autogenerated VS/MD/Consulo solution and project files ExportedObj/ -.vs/ +.consulo/ *.csproj *.unityproj *.sln @@ -21,9 +25,11 @@ ExportedObj/ *.pidb *.booproj *.svd +*.pdb # Unity3D generated meta files *.pidb.meta +*.pdb.meta # Unity3D Generated File On Crash Reports sysinfo.txt @@ -31,6 +37,24 @@ sysinfo.txt # Builds *.apk *.unitypackage +.DS_Store +Assets/Plugins/AsyncAwaitUtil/Documentation.meta +Assets/Plugins/AsyncAwaitUtil/Documentation/* +/packages/* +/WebGL/Template/node_modules/ +/WebGL/Template/yarn-error.log +/Assets/Plugins/Android/*.aar +/Assets/Plugins/Android/*.jar +/Assets/Plugins/Android/*.jar.meta +/Assets/Plugins/Android/*.aar.meta +/webgl-build/ + +# JetBrains Rider +.idea +Assets/Plugins.meta +Assets/Plugins/Editor.meta +Assets/Plugins/Editor/JetBrains +Assets/Plugins/Editor/JetBrains.meta # OSX .DS_Store diff --git a/Assets/Animations/UI.meta b/Assets/Animations/UI.meta new file mode 100644 index 0000000..c967119 --- /dev/null +++ b/Assets/Animations/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca0c365ac48c9664aa13577f41d9ef4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/UI/FightPopup.anim b/Assets/Animations/UI/FightPopup.anim new file mode 100644 index 0000000..253066b --- /dev/null +++ b/Assets/Animations/UI/FightPopup.anim @@ -0,0 +1,877 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: FightPopup + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.45569456, y: 0.12909172, z: -360.04953} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.5833333 + value: {x: -0.45569456, y: 49, z: -360.04953} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.3333334 + value: {x: -0.45569456, y: 49, z: -360.04953} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.8333334 + value: {x: -0.45569456, y: 0.12909172, z: -360.04953} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.5833333 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.3333334 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1.8333334 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Fight + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.75 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.8333333 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.9166667 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.0833334 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.1666666 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.3333334 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Fight/FightYellow + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.5833333 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.75 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.8333333 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.9166667 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.0833334 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.1666666 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.3333334 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Fight/FightRed + classID: 1 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 12 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 3765136210 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 4156177954 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 1640937944 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1.8333334 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.x + path: Fight + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.y + path: Fight + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.z + path: Fight + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.5833333 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.6666667 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.75 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.8333333 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.9166667 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.0833334 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.1666666 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.3333334 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Fight/FightYellow + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.5833333 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.6666667 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.75 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.8333333 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.9166667 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.0833334 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.1666666 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.3333334 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Fight/FightRed + classID: 1 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.45569456 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: -0.45569456 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: -0.45569456 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: -0.45569456 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.12909172 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: 49 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.3333334 + value: 49 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: 0.12909172 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -360.04953 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5833333 + value: -360.04953 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1.8333334 + value: -360.04953 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_GenerateMotionCurves: 0 + m_Events: + - time: 1.8333334 + functionName: EndFightPopup + data: + objectReferenceParameter: {fileID: 0} + floatParameter: 0 + intParameter: 0 + messageOptions: 0 diff --git a/Assets/Animations/UI/FightPopup.anim.meta b/Assets/Animations/UI/FightPopup.anim.meta new file mode 100644 index 0000000..debd31b --- /dev/null +++ b/Assets/Animations/UI/FightPopup.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39796fed33c8e3b4ea1e54e7aa1d4b6b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/UI/RoundUI.controller b/Assets/Animations/UI/RoundUI.controller new file mode 100644 index 0000000..df74ca8 --- /dev/null +++ b/Assets/Animations/UI/RoundUI.controller @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: RoundUI + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: Fight + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107811841310836428} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &1101916167098913610 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: Fight + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102907559339494394} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &1102907559339494394 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: FightPopup + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 39796fed33c8e3b4ea1e54e7aa1d4b6b, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102981749993682522 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: RoundCounter + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 9020281e2b01e8d498b04e38f62f7587, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1107811841310836428 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102981749993682522} + m_Position: {x: 312, y: 36, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102907559339494394} + m_Position: {x: 132, y: -108, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: 1101916167098913610} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102981749993682522} diff --git a/Assets/Animations/UI/RoundUI.controller.meta b/Assets/Animations/UI/RoundUI.controller.meta new file mode 100644 index 0000000..1d596dc --- /dev/null +++ b/Assets/Animations/UI/RoundUI.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c729523d97c723341b2bd5fde66291cf +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fonts/MK2_SDF.asset b/Assets/Fonts/MK2_SDF.asset index 640ae03..9815e15 100644 --- a/Assets/Fonts/MK2_SDF.asset +++ b/Assets/Fonts/MK2_SDF.asset @@ -1037,7 +1037,7 @@ Material: - _Reflectivity: 10 - _ScaleRatioA: 0.90909094 - _ScaleRatioB: 0.7386364 - - _ScaleRatioC: 0.52311355 + - _ScaleRatioC: 0.7386364 - _ScaleX: 1 - _ScaleY: 1 - _ShaderFlags: 1 @@ -1049,10 +1049,10 @@ Material: - _StencilWriteMask: 255 - _TextureHeight: 512 - _TextureWidth: 512 - - _UnderlayDilate: 0.282 - - _UnderlayOffsetX: 0.8 - - _UnderlayOffsetY: -0.6 - - _UnderlaySoftness: 0.33 + - _UnderlayDilate: 0.303 + - _UnderlayOffsetX: 0.355 + - _UnderlayOffsetY: -0.273 + - _UnderlaySoftness: 0 - _VertexOffsetX: 0 - _VertexOffsetY: 0 - _WeightBold: 0.75 @@ -1067,7 +1067,7 @@ Material: - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} - _SpecularColor: {r: 1, g: 1, b: 1, a: 0.83137256} - - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.78431374} + - _UnderlayColor: {r: 0, g: 0, b: 0, a: 1} --- !u!28 &28190164368604994 Texture2D: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/PlayerUI.prefab b/Assets/Resources/PlayerUI.prefab index 79e5f90..0fe52cc 100644 --- a/Assets/Resources/PlayerUI.prefab +++ b/Assets/Resources/PlayerUI.prefab @@ -68,6 +68,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 224534179785866308} + - component: {fileID: 114698153582249736} m_Layer: 5 m_Name: PlayerUI m_TagString: Untagged @@ -188,6 +189,21 @@ MonoBehaviour: m_EffectColor: {r: 0, g: 0, b: 0, a: 0.78431374} m_EffectDistance: {x: 1.5, y: -1.5} m_UseGraphicAlpha: 1 +--- !u!114 &114698153582249736 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1372591493068986} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9476481cd6bc1c84d9630d7fa3a10813, type: 3} + m_Name: + m_EditorClassIdentifier: + _healthbarSlider: {fileID: 114248190029426828} + _healthbarSpeed: 2 + _playerFighterNameTextMesh: {fileID: 114839010620713710} + _winsTextMesh: {fileID: 114700039095032358} --- !u!114 &114700039095032358 MonoBehaviour: m_ObjectHideFlags: 1 @@ -242,7 +258,7 @@ MonoBehaviour: m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 0 - m_textAlignment: 513 + m_textAlignment: 516 m_isAlignmentEnumConverted: 1 m_characterSpacing: 0 m_wordSpacing: 0 @@ -375,9 +391,7 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_text: 'Player 2 - -' + m_text: Player 2 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: dadd7cf1da5956f4baa0b25937970ba4, type: 2} m_sharedMaterial: {fileID: 21223199838442304, guid: dadd7cf1da5956f4baa0b25937970ba4, @@ -412,7 +426,7 @@ MonoBehaviour: m_fontSizeMin: 18 m_fontSizeMax: 72 m_fontStyle: 0 - m_textAlignment: 513 + m_textAlignment: 516 m_isAlignmentEnumConverted: 1 m_characterSpacing: 0 m_wordSpacing: 0 @@ -446,9 +460,9 @@ MonoBehaviour: m_margin: {x: -46.93446, y: 0, z: -47.05324, w: 0} m_textInfo: textComponent: {fileID: 114839010620713710} - characterCount: 9 + characterCount: 8 spriteCount: 0 - spaceCount: 2 + spaceCount: 1 wordCount: 2 linkCount: 0 lineCount: 1 @@ -591,7 +605,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -5, y: -14} + m_AnchoredPosition: {x: -318, y: 225} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!224 &224563632754887528 diff --git a/Assets/Scenes/SandboxScene.unity b/Assets/Scenes/SandboxScene.unity index be7bd3d..d8f3db2 100644 --- a/Assets/Scenes/SandboxScene.unity +++ b/Assets/Scenes/SandboxScene.unity @@ -182,6 +182,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 135821057} + - component: {fileID: 135821059} - component: {fileID: 135821058} m_Layer: 0 m_Name: Match Manager @@ -218,9 +219,32 @@ MonoBehaviour: m_EditorClassIdentifier: _playerRightSpawn: {fileID: 1891517229} _playerLeftSpawn: {fileID: 1351792068} + roundLength: 30 playerSpawn: {fileID: 0} DiveDirection: {x: 0, y: 0} KickDirection: {x: 0, y: 0} + scoreToWin: 3 +--- !u!114 &135821059 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 135821056} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3} + m_Name: + m_EditorClassIdentifier: + ObservedComponentsFoldoutOpen: 1 + Group: 0 + prefixField: -1 + Synchronization: 0 + OwnershipTransfer: 0 + ObservedComponents: + - {fileID: 0} + viewIdField: 2 + InstantiationId: 2 + isRuntimeInstantiated: 0 --- !u!1 &210174634 GameObject: m_ObjectHideFlags: 0 @@ -229,6 +253,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 210174635} + - component: {fileID: 210174636} m_Layer: 0 m_Name: UI m_TagString: Untagged @@ -251,6 +276,22 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &210174636 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 210174634} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb48d900c89111f45a28000a7e69d597, type: 3} + m_Name: + m_EditorClassIdentifier: + _player1UI: {fileID: 1999053673} + _player2UI: {fileID: 627600868} + _roundUI: {fileID: 918509548} + _roundUIDisplayTime: 2 + _roundTimer: {fileID: 311789615} --- !u!1 &311789613 GameObject: m_ObjectHideFlags: 0 @@ -262,7 +303,7 @@ GameObject: - component: {fileID: 311789616} - component: {fileID: 311789615} m_Layer: 5 - m_Name: Counter + m_Name: RoundTimer m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -845,6 +886,82 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c9335df1c91843b47aef5dc6c45dd398, type: 3} m_Name: m_EditorClassIdentifier: + roundStarted: 0 +--- !u!1 &559766505 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 559766506} + - component: {fileID: 559766507} + m_Layer: 0 + m_Name: FightYellow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &559766506 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 559766505} + 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: 854025845} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &559766507 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 559766505} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 4 + m_Sprite: {fileID: 21300006, guid: e54cabe188dae97489d17d8313f3b6f0, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.95, y: 0.29} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1001 &627600863 Prefab: m_ObjectHideFlags: 0 @@ -890,7 +1007,7 @@ Prefab: - target: {fileID: 224534179785866308, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_RootOrder - value: 1 + value: 3 objectReference: {fileID: 0} - target: {fileID: 224534179785866308, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} @@ -942,6 +1059,10 @@ Prefab: propertyPath: m_Pivot.y value: 0.5 objectReference: {fileID: 0} + - target: {fileID: 1372591493068986, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} + propertyPath: m_Name + value: Player2UI + objectReference: {fileID: 0} - target: {fileID: 224454599304112662, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_AnchorMax.x @@ -955,26 +1076,47 @@ Prefab: - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_havePropertiesChanged - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_isInputParsingRequired - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114700039095032358, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_havePropertiesChanged - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114700039095032358, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_isInputParsingRequired + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_textAlignment + value: 513 + objectReference: {fileID: 0} + - target: {fileID: 114700039095032358, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_textAlignment + value: 513 + objectReference: {fileID: 0} + - target: {fileID: 114573858624589618, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_EffectColor.a value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} m_IsPrefabAsset: 0 +--- !u!114 &627600868 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 114698153582249736, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + m_PrefabInternal: {fileID: 627600863} + m_Script: {fileID: 11500000, guid: 9476481cd6bc1c84d9630d7fa3a10813, type: 3} --- !u!1 &663760093 GameObject: m_ObjectHideFlags: 0 @@ -1076,6 +1218,166 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 7.2, y: 0.49036288} m_EdgeRadius: 0 +--- !u!1 &758383844 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 1224143414951262, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 758383845} + - component: {fileID: 758383847} + - component: {fileID: 758383846} + m_Layer: 5 + m_Name: RoundCounter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &758383845 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 224025229934445224, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 758383844} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0.8441068} + m_LocalScale: {x: 0.0024181502, y: 0.0024181502, z: 0.0024181502} + m_Children: [] + m_Father: {fileID: 918509547} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0.176} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &758383846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 758383844} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1453722849, guid: 89f0137620f6af44b9ba852b4190e64e, 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: Round 1 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: dadd7cf1da5956f4baa0b25937970ba4, type: 2} + m_sharedMaterial: {fileID: 21223199838442304, guid: dadd7cf1da5956f4baa0b25937970ba4, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278255615 + m_fontColor: {r: 1, g: 1, b: 0, a: 1} + m_enableVertexGradient: 0 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 0, a: 1} + topRight: {r: 1, g: 1, b: 0, a: 1} + bottomLeft: {r: 0.8396226, g: 0.8396226, b: 0, a: 1} + bottomRight: {r: 0.8392157, g: 0.8392157, b: 0, 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: 36.63 + m_fontSizeBase: 36.63 + m_fontWeight: 400 + m_enableAutoSizing: 0 + 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: -46.93446, y: 0, z: -47.05324, w: 0} + m_textInfo: + textComponent: {fileID: 758383846} + characterCount: 7 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_havePropertiesChanged: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_isInputParsingRequired: 1 + 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} +--- !u!222 &758383847 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 222044982308141062, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 758383844} + m_CullTransparentMesh: 0 --- !u!1 &799139389 GameObject: m_ObjectHideFlags: 0 @@ -1265,6 +1567,36 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &854025844 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 854025845} + m_Layer: 0 + m_Name: Fight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &854025845 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 854025844} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1584240602} + - {fileID: 559766506} + m_Father: {fileID: 918509547} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &872393074 GameObject: m_ObjectHideFlags: 0 @@ -1273,6 +1605,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 872393075} + - component: {fileID: 872393077} - component: {fileID: 872393076} m_Layer: 0 m_Name: Network Manager @@ -1305,11 +1638,94 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b64137f77cc41d94fa6b1387327f6690, type: 3} m_Name: m_EditorClassIdentifier: - isConnectedToMaster: 0 - isConnectedToRoom: 0 player1RoomPropertyKey: Player1 player2RoomPropertyKey: Player2 _playerPrefabName: DebugPlayer +--- !u!114 &872393077 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 872393074} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3} + m_Name: + m_EditorClassIdentifier: + ObservedComponentsFoldoutOpen: 1 + Group: 0 + prefixField: -1 + Synchronization: 0 + OwnershipTransfer: 0 + ObservedComponents: + - {fileID: 0} + viewIdField: 1 + InstantiationId: 1 + isRuntimeInstantiated: 0 +--- !u!1 &918509546 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 918509547} + - component: {fileID: 918509548} + - component: {fileID: 918509549} + m_Layer: 0 + m_Name: RoundUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &918509547 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 918509546} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.45569456, y: 0.12909172, z: -360.04953} + m_LocalScale: {x: 426.54498, y: 426.54498, z: 426.54498} + m_Children: + - {fileID: 758383845} + - {fileID: 854025845} + m_Father: {fileID: 1681634729} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &918509548 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 918509546} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a7ecad25e4ab828499c4501b968dbbd0, type: 3} + m_Name: + m_EditorClassIdentifier: + _roundCounterText: {fileID: 758383846} + _animator: {fileID: 918509549} + _fadeSpeed: 10 +--- !u!95 &918509549 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 918509546} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c729523d97c723341b2bd5fde66291cf, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 --- !u!1 &975565063 GameObject: m_ObjectHideFlags: 0 @@ -1776,6 +2192,81 @@ MonoBehaviour: - {fileID: 1304380350} - {fileID: 447927083} _paralaxSpeed: 0.25 +--- !u!1 &1584240601 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1584240602} + - component: {fileID: 1584240603} + m_Layer: 0 + m_Name: FightRed + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1584240602 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1584240601} + 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: 854025845} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1584240603 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1584240601} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 4 + m_Sprite: {fileID: 21300004, guid: e54cabe188dae97489d17d8313f3b6f0, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.95, y: 0.29} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &1610247771 GameObject: m_ObjectHideFlags: 0 @@ -1999,8 +2490,9 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 311789614} - - {fileID: 1761507095} + - {fileID: 918509547} - {fileID: 1999053671} + - {fileID: 1761507095} m_Father: {fileID: 210174635} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2182,36 +2674,56 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 1372591493068986, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_Name - value: PlayerUI (1) + value: Player1UI objectReference: {fileID: 0} - - target: {fileID: 114700039095032358, guid: 702c6cc0c610cce4db1c5389edabfe69, + - target: {fileID: 224454599304112662, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} - propertyPath: m_textAlignment - value: 516 + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 224454599304112662, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_AnchorMax.y + value: 0 objectReference: {fileID: 0} - target: {fileID: 114700039095032358, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_havePropertiesChanged - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114700039095032358, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} propertyPath: m_isInputParsingRequired - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} - propertyPath: m_textAlignment - value: 516 + propertyPath: m_havePropertiesChanged + value: 0 objectReference: {fileID: 0} - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} - propertyPath: m_havePropertiesChanged - value: 1 + propertyPath: m_isInputParsingRequired + value: 0 objectReference: {fileID: 0} - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} - propertyPath: m_isInputParsingRequired + propertyPath: m_text + value: Player 1 + objectReference: {fileID: 0} + - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_textInfo.characterCount + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 114839010620713710, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_textInfo.wordCount + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 114573858624589618, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + propertyPath: m_EffectColor.a value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] @@ -2222,3 +2734,9 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 224534179785866308, guid: 702c6cc0c610cce4db1c5389edabfe69, type: 2} m_PrefabInternal: {fileID: 1999053670} +--- !u!114 &1999053673 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 114698153582249736, guid: 702c6cc0c610cce4db1c5389edabfe69, + type: 2} + m_PrefabInternal: {fileID: 1999053670} + m_Script: {fileID: 11500000, guid: 9476481cd6bc1c84d9630d7fa3a10813, type: 3} diff --git a/Assets/Scripts/Debug/DebugGameManager.cs b/Assets/Scripts/Debug/DebugGameManager.cs index 59f0ec9..c211c57 100755 --- a/Assets/Scripts/Debug/DebugGameManager.cs +++ b/Assets/Scripts/Debug/DebugGameManager.cs @@ -3,14 +3,18 @@ using UnityEngine; using KickDive.Hardware; using Photon.Pun; +using KickDive.Match; +using Photon.Realtime; // A class used for debugging game properties/application level functionality // Not meant to be included in the final game -public class DebugGameManager : MonoBehaviour { +public class DebugGameManager : MonoBehaviourPunCallbacks { private InputManager _inputManager; private NetworkManager _networkManager; + public bool roundStarted; + public void Start() { if (InputManager.instance != null) { _inputManager = InputManager.instance; @@ -56,7 +60,7 @@ private void OnConnectedToMaster() { } private void OnConnectedToRoom(string roomName) { - _networkManager.InstantiatePlayerPrefab(); + //_networkManager.InstantiatePlayerPrefab(); } private void PrimaryButtonStartedHandler(HardwareInput sender) { @@ -74,4 +78,8 @@ private void SecondaryButtonStartedHandler(HardwareInput sender) { private void SecondaryButtonEndedHandler(HardwareInput sender) { //Debug.Log("Secondary Button Ended"); } + + public override void OnPlayerEnteredRoom(Player newPlayer) { + MatchManager.instance.RemoteInitializeRound(); + } } diff --git a/Assets/Scripts/Input/InputManager.cs b/Assets/Scripts/Input/InputManager.cs index e85fbc3..7fc47b4 100755 --- a/Assets/Scripts/Input/InputManager.cs +++ b/Assets/Scripts/Input/InputManager.cs @@ -5,16 +5,23 @@ namespace KickDive.Hardware{ public class InputManager : MonoBehaviour { + private enum InputLockStatus { + None, + Locked, + Unlocked + } + enum GameplayInputType { PCDebug, XboxController } - public static InputManager instance; - public HardwareInput gameInput { get; private set; } + public static InputManager instance; + public HardwareInput gameInput { get; private set; } [SerializeField] - private GameplayInputType _inputType; + private GameplayInputType _inputType; + private InputLockStatus _inputLockStatus = InputLockStatus.None; private void Awake() { @@ -37,9 +44,19 @@ private void Awake() { } } + public void LockInput() { + _inputLockStatus = InputLockStatus.Locked; + } + + public void UnlockInput() { + _inputLockStatus = InputLockStatus.Unlocked; + } + private void Update() { - gameInput.GetPrimaryButtonStatus(); - gameInput.GetSecondaryButtonStatus(); + if (_inputLockStatus == InputLockStatus.Unlocked) { + gameInput.GetPrimaryButtonStatus(); + gameInput.GetSecondaryButtonStatus(); + } } } diff --git a/Assets/Scripts/Match/MatchManager.cs b/Assets/Scripts/Match/MatchManager.cs index 6d32805..d82eedc 100644 --- a/Assets/Scripts/Match/MatchManager.cs +++ b/Assets/Scripts/Match/MatchManager.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using UnityEngine; using Photon.Pun; +using KickDive.UI; +using KickDive.Hardware; // A class that handles all match specific work // This may include per-round management @@ -10,14 +12,30 @@ public enum PlayerNumber { None, // Player 1 starts on the right side of the screen Player1, - // PLayer 2 starts on the left side of the screen + // Player 2 starts on the left side of the screen Player2, } - public class MatchManager : MonoBehaviour { + // Life cycle enum for match and round + public enum MatchStatus { + None, + WaitingToStartMatch, + WaitingToStartRound, + RoundInProgress, + MatchComplete, + } + + public class MatchManager : MonoBehaviourPun { public static MatchManager instance; + // Events for match and round results + public delegate void PlayerWonRound(PlayerNumber roundWinningPlayer); + public delegate void PlayerWonMatch(PlayerNumber matchWinningPlayer); + + public event PlayerWonRound OnPlayerWonRound; + public event PlayerWonMatch OnPlayerWonMatch; + // Player 1 spawn [SerializeField] private Transform _playerRightSpawn; @@ -26,16 +44,36 @@ public class MatchManager : MonoBehaviour { [SerializeField] private Transform _playerLeftSpawn; + // Length of a round in seconds + [SerializeField] + private int roundLength = 30; + [HideInInspector] public Transform playerSpawn; public Vector2 DiveDirection; public Vector2 KickDirection; + // Private setters for these match critical values + public MatchStatus matchStatus { get; private set; } + + public int player1RoundScore { get; private set; } + public int player2RoundScore { get; private set; } + public int scoreToWin = 3; + public int roundNumber { get; private set; } + + // Time left in this round in whole seconds + // Truncates the floating point remaning time + public int currentIntegerRoundTimeRemaning { get { return (int)_currentFloatingPointRoundTimeRemanining; } } + + private float _roundTimerStartDelay = 0; + // Time left in this round in floating point precision + private float _currentFloatingPointRoundTimeRemanining = 30.0f; + private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { - Debug.Log("Found an existing instance of the NetworkManager, destroying this one"); + Debug.Log("Found an existing instance of the MatchManager, destroying this one"); DestroyImmediate(this); } @@ -48,6 +86,10 @@ private void Awake() { } DiveDirection = Vector2.up; + + matchStatus = MatchStatus.WaitingToStartMatch; + InputManager.instance.LockInput(); + roundNumber = 1; } // For setting the player number, and spawn @@ -71,11 +113,146 @@ public void SetPlayerSpawn(PlayerNumber playerNumber) { } } - public void StartNewRound() { - // Tear down player - NetworkManager.instance.DestroyPlayerPrefab(); + // Matches + public void EndMatch() { + matchStatus = MatchStatus.MatchComplete; + } + + // Rounds + public void SetPlayerWonRound(PlayerNumber playerNumber) { + PlayerNumber roundWinningPlayer = PlayerNumber.None; + switch (playerNumber) { + case PlayerNumber.Player1: { + player1RoundScore++; + roundWinningPlayer = PlayerNumber.Player1; + break; + } + case PlayerNumber.Player2: { + player2RoundScore++; + roundWinningPlayer = PlayerNumber.Player2; + break; + } + } + + if (OnPlayerWonRound != null) { + OnPlayerWonRound(roundWinningPlayer); + } + + EndRound(); + } + + public void RemoteInitializeRound() { + if (matchStatus != MatchStatus.MatchComplete) { + photonView.RPC("InitializeRound", RpcTarget.All); + } + } + + [PunRPC] + public void InitializeRound() { + matchStatus = MatchStatus.WaitingToStartRound; + + // Player 1 will always request the timer to synchronize + // TODO: Make this more flexible + if (NetworkManager.playerNumber == PlayerNumber.Player1) { + StartRoundTimerSynchronization(); + } + // Restart player NetworkManager.instance.InstantiatePlayerPrefab(); } + + public void StartRound() { + // Unlock input + InputManager.instance.UnlockInput(); + + matchStatus = MatchStatus.RoundInProgress; + } + + public void EndRound() { + // Lock input + InputManager.instance.LockInput(); + + // Tear down player + NetworkManager.instance.DestroyPlayerPrefab(); + + // Reset timers + _currentFloatingPointRoundTimeRemanining = 30.0f; + matchStatus = MatchStatus.WaitingToStartRound; + + // Check if anyone has won the match + if ((player1RoundScore == scoreToWin) || (player2RoundScore == scoreToWin)) { + EndMatch(); + + PlayerNumber matchWinningPlayer = player1RoundScore > player2RoundScore ? PlayerNumber.Player1 : PlayerNumber.Player2; + + Debug.Log(matchWinningPlayer + " won the match!"); + + if (OnPlayerWonMatch != null) { + OnPlayerWonMatch(matchWinningPlayer); + } + } else { + // Start a new round if no one won the match + RemoteInitializeRound(); + roundNumber++; + } + } + + // Round timers + public void StartRoundTimerSynchronization() { + if (matchStatus == MatchStatus.WaitingToStartRound) { + // There should only be one other player in this list + // Ping in this situation is RTT + // Note this value could overflow to negative + int otherPlayerPing = (int)PhotonNetwork.PlayerListOthers[0].CustomProperties["Ping"]; + int thisPlayerPing = PhotonNetwork.GetPing(); + + // Whichever player has the higher ping, use their ping as the delay to start the timer + int delayPing = (otherPlayerPing > thisPlayerPing) ? otherPlayerPing : thisPlayerPing; + + // Note there may be discrepancy if the ping of the other client changes significantly within the time to recieve this RPC + // Buffer this by double so that the client with the highest ping will not have to start the timer right away + photonView.RPC("HandleRoundTimerStartSynchronization", RpcTarget.AllViaServer, PhotonNetwork.ServerTimestamp, 2 * delayPing); + } + } + + [PunRPC] + public void HandleRoundTimerStartSynchronization(int serverTimeStamp, int timerStartDelay) { + // Find out how long ago this RPC was called from the other client + // This should be about the same as RTT + int RPCCallTime = PhotonNetwork.ServerTimestamp - serverTimeStamp; + + SetRoundTimerStartDelay(timerStartDelay - RPCCallTime); + } + + public void SetRoundTimerStartDelay(int delay) { + _roundTimerStartDelay = delay; + } + + private void Update() { + switch (matchStatus) { + case MatchStatus.WaitingToStartRound: { + // Time sync + if (_roundTimerStartDelay != 0) { + _roundTimerStartDelay -= (Time.deltaTime * 1000); + + if (_roundTimerStartDelay < 0) { + Debug.Log("Round Timer Synchronized!"); + _roundTimerStartDelay = 0; + UIManager.instance.StartRoundUI(); + } + } + break; + } + case MatchStatus.RoundInProgress: { + _currentFloatingPointRoundTimeRemanining -= Time.deltaTime; + + // End the round if the time runs out + if (_currentFloatingPointRoundTimeRemanining < 0) { + EndRound(); + } + break; + } + } + } } } diff --git a/Assets/Scripts/Networking/NetworkManager.cs b/Assets/Scripts/Networking/NetworkManager.cs index e80ebd2..7ba5504 100644 --- a/Assets/Scripts/Networking/NetworkManager.cs +++ b/Assets/Scripts/Networking/NetworkManager.cs @@ -5,6 +5,8 @@ using Photon.Realtime; using Hashtable = ExitGames.Client.Photon.Hashtable; +// All things at the game-level related to network live here +// Accessible as a singleton namespace Photon.Pun { public class NetworkManager : MonoBehaviourPunCallbacks { @@ -18,15 +20,20 @@ public class NetworkManager : MonoBehaviourPunCallbacks { public event ConnectedToPhotonMaster OnConnectedToPhotonMaster; public event ConnectedToRoom OnConnectedToRoom; - public bool isConnectedToMaster; - public bool isConnectedToRoom; + // No one should modify these values other than NetworkManager + public bool isConnectedToMaster { get; private set; } + public bool isConnectedToRoom { get; private set; } public string player1RoomPropertyKey; public string player2RoomPropertyKey; [SerializeField] - private string _playerPrefabName; - private string _gameVersion = "1.0"; + private string _playerPrefabName; + private string _gameVersion = "1.0"; + + // The time between sending the RPC to start the timer and when the timer should start on both clients + // This should be a time in milliseconds + private int _roundTimerStartDelay; private PhotonView _playerPrefabPhotonView; @@ -58,12 +65,21 @@ private void Awake() { } else { Debug.Log("Network Manager is attempting to initialize while already connected"); } + + isConnectedToMaster = false; + isConnectedToRoom = false; } public override void OnConnectedToMaster() { Debug.Log("Connected to Photon master server"); isConnectedToMaster = true; + // Set custom some player properties before joining room + Hashtable playerProperties = new Hashtable(); + playerProperties["Ping"] = PhotonNetwork.GetPing(); + + PhotonNetwork.LocalPlayer.SetCustomProperties(playerProperties); + // Fire Event if (OnConnectedToPhotonMaster != null) OnConnectedToPhotonMaster(); @@ -89,27 +105,22 @@ public override void OnJoinedRoom() { Debug.Log("Connected to room: " + PhotonNetwork.CurrentRoom.Name); - // Set custom room properties - Hashtable setValue = new Hashtable(); - Hashtable expectedValue = new Hashtable(); + // Set player property for player number + Hashtable playerProperties = PhotonNetwork.LocalPlayer.CustomProperties; // First person to join gets P1 // TODO: Make this a selectable option? if (PhotonNetwork.CurrentRoom.PlayerCount > 1) { playerNumber = PlayerNumber.Player2; - setValue.Add(player2RoomPropertyKey, PhotonNetwork.LocalPlayer.ActorNumber); - - expectedValue.Add(player2RoomPropertyKey, PhotonNetwork.LocalPlayer.ActorNumber); + playerProperties[player2RoomPropertyKey] = playerNumber; } else { playerNumber = PlayerNumber.Player1; - setValue.Add(player1RoomPropertyKey, PhotonNetwork.LocalPlayer.ActorNumber); - - expectedValue.Add(player1RoomPropertyKey, PhotonNetwork.LocalPlayer.ActorNumber); + playerProperties[player1RoomPropertyKey] = playerNumber; } - PhotonNetwork.CurrentRoom.SetCustomProperties(setValue, expectedValue); + PhotonNetwork.LocalPlayer.SetCustomProperties(playerProperties); Debug.Log("Joined as Player Number: " + playerNumber); @@ -120,6 +131,16 @@ public override void OnJoinedRoom() { OnConnectedToRoom(PhotonNetwork.CurrentRoom.Name); } + public override void OnPlayerLeftRoom(Player otherPlayer) { + base.OnPlayerLeftRoom(otherPlayer); + + Debug.Log("Other player has disconnected! Shutting down match"); + + // Teardown + MatchManager.instance.EndMatch(); + MatchManager.instance.EndRound(); + } + public void InstantiatePlayerPrefab() { if (PhotonNetwork.CurrentRoom == null) { Debug.LogError("Cannot instantiate player prefab, not connected to room. Bailing"); @@ -141,5 +162,19 @@ public void DestroyPlayerPrefab() { PhotonNetwork.Destroy(_playerPrefabPhotonView); } + + private void Update() { + // TODO: Profile this in some way and see if its more overhead that just sending an RPC between two clients and checking the RTT + if (isConnectedToRoom) { + Hashtable playerCustomProperties = PhotonNetwork.LocalPlayer.CustomProperties; + + // If ping changed, update it + if (PhotonNetwork.GetPing() != (int)playerCustomProperties["Ping"]) { + playerCustomProperties["Ping"] = PhotonNetwork.GetPing(); + + PhotonNetwork.LocalPlayer.SetCustomProperties(playerCustomProperties); + } + } + } } } diff --git a/Assets/Scripts/Player Control/FighterController.cs b/Assets/Scripts/Player Control/FighterController.cs index 7b3dba7..85df348 100755 --- a/Assets/Scripts/Player Control/FighterController.cs +++ b/Assets/Scripts/Player Control/FighterController.cs @@ -170,7 +170,7 @@ public void HandleWonRound(PlayerNumber roundWinningPlayer) { public void HandleAcknowledgeWonRound(PlayerNumber roundWinningPlayer) { Debug.Log(roundWinningPlayer + " won the round!"); - MatchManager.instance.StartNewRound(); + MatchManager.instance.SetPlayerWonRound(roundWinningPlayer); } private void Update() { diff --git a/Assets/Scripts/UI/PlayerRoundUI.cs b/Assets/Scripts/UI/PlayerRoundUI.cs deleted file mode 100644 index 9983294..0000000 --- a/Assets/Scripts/UI/PlayerRoundUI.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using KickDive.Match; -using Photon.Pun; - -namespace KickDive.UI { - public class HealthBar : MonoBehaviour { - - // This sprite is only the green bar - [SerializeField] - private SpriteRenderer _healthbarFullSprite; - - // This sprite also contains the background outline for the healthbar - [SerializeField] - private SpriteRenderer _healthbarEmptySprite; - - private string _playerFighterName; - private PlayerNumber _playerNumber; - - // Use this for initialization - void Start() { - - } - - // Update is called once per frame - void Update() { - - } - } -} diff --git a/Assets/Scripts/UI/PlayerUI.cs b/Assets/Scripts/UI/PlayerUI.cs new file mode 100644 index 0000000..9dc5aed --- /dev/null +++ b/Assets/Scripts/UI/PlayerUI.cs @@ -0,0 +1,88 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using KickDive.Match; +using Photon.Pun; +using UnityEngine.UI; +using TMPro; + +// A nice class that wraps all the UI related to a single player +// Everything in the top two corners of the screen +namespace KickDive.UI { + public class PlayerUI : MonoBehaviour { + + private enum PlayerHealthState { + Alive, + Dead + } + + [SerializeField] + private Slider _healthbarSlider; + + [SerializeField] + private float _healthbarSpeed = 1.0f; + + [SerializeField] + private TextMeshProUGUI _playerFighterNameTextMesh; + + [SerializeField] + private TextMeshProUGUI _winsTextMesh; + + private string _playerFighterName; + private PlayerNumber _playerNumber; + private PlayerHealthState _playerHealth = PlayerHealthState.Alive; + + // Sets all important properties for this UI bundle + public void SetPlayerInfo(string fighterName, PlayerNumber playerNumber) { + _playerFighterName = fighterName; + _playerNumber = playerNumber; + + if (_playerNumber != PlayerNumber.None) { + switch (_playerNumber) { + // Right Side + case PlayerNumber.Player1: { + _playerFighterNameTextMesh.alignment = TextAlignmentOptions.MidlineRight; + _winsTextMesh.alignment = TextAlignmentOptions.MidlineRight; + break; + } + // Left Side + case PlayerNumber.Player2: { + _playerFighterNameTextMesh.alignment = TextAlignmentOptions.MidlineLeft; + _winsTextMesh.alignment = TextAlignmentOptions.MidlineLeft; + break; + } + } + } else { + Debug.LogError("Initializing player UI without a player number!"); + } + + _playerFighterNameTextMesh.SetText(fighterName); + } + + // Always between 1 or 0 health + public void DepleteHealth() { + _playerHealth = PlayerHealthState.Dead; + } + + public void ResetHealth() { + _healthbarSlider.value = 1.0f; + _playerHealth = PlayerHealthState.Alive; + } + + public void SetPlayerWins(int winNumber) { + _winsTextMesh.SetText("0" + winNumber + " Wins"); + } + + void Update() { + // Smooth out the depleting of the healthbar + if (_playerHealth == PlayerHealthState.Dead) { + _healthbarSlider.value = Mathf.MoveTowards(_healthbarSlider.value, _healthbarSlider.minValue, _healthbarSpeed * Time.deltaTime); + + if (_healthbarSlider.value < _healthbarSlider.maxValue * 0.05) { + // Reset the player health when the animation is done + ResetHealth(); + } + } + } + } +} diff --git a/Assets/Scripts/UI/PlayerRoundUI.cs.meta b/Assets/Scripts/UI/PlayerUI.cs.meta similarity index 100% rename from Assets/Scripts/UI/PlayerRoundUI.cs.meta rename to Assets/Scripts/UI/PlayerUI.cs.meta diff --git a/Assets/Scripts/UI/RoundUI.cs b/Assets/Scripts/UI/RoundUI.cs new file mode 100644 index 0000000..58e010d --- /dev/null +++ b/Assets/Scripts/UI/RoundUI.cs @@ -0,0 +1,65 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using TMPro; +using KickDive.Match; + +// A class dedicated to the UI at the beginning of rounds +namespace KickDive.UI { + public class RoundUI : MonoBehaviour { + + [SerializeField] + private TextMeshProUGUI _roundCounterText; + [SerializeField] + private Animator _animator; + [SerializeField] + private float _fadeSpeed = 10.0f; + + private Color _roundCounterTextColor; + private bool _fadeText; + private int _fightPopupStartHash; + + private void Awake() { + _fightPopupStartHash = Animator.StringToHash("Fight"); + _roundCounterTextColor = _roundCounterText.color; + } + + public void DisplayNewRound() { + _roundCounterText.color = _roundCounterTextColor; + _roundCounterText.SetText("Round " + MatchManager.instance.roundNumber); + _roundCounterText.gameObject.SetActive(true); + } + + public void StartRoundCounterFade() { + _fadeText = true; + } + + private void StopRoundCounterFade() { + _roundCounterText.gameObject.SetActive(false); + _fadeText = false; + } + + private void StartFightPopup() { + _animator.SetTrigger(_fightPopupStartHash); + } + + // Public so it can be triggered by animation event + public void EndFightPopup() { + MatchManager.instance.StartRound(); + _animator.ResetTrigger(_fightPopupStartHash); + } + + void Update() { + if (_fadeText) { + + float newAlpha = _roundCounterText.color.a - _fadeSpeed * Time.deltaTime; + _roundCounterText.color = new Color(_roundCounterTextColor.r, _roundCounterTextColor.g, _roundCounterTextColor.b, newAlpha); + + if (newAlpha < 0) { + StopRoundCounterFade(); + StartFightPopup(); + } + } + } + } +} diff --git a/Assets/Scripts/UI/RoundUI.cs.meta b/Assets/Scripts/UI/RoundUI.cs.meta new file mode 100644 index 0000000..8aca852 --- /dev/null +++ b/Assets/Scripts/UI/RoundUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a7ecad25e4ab828499c4501b968dbbd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/UIManager.cs b/Assets/Scripts/UI/UIManager.cs index 300eb01..19e5390 100644 --- a/Assets/Scripts/UI/UIManager.cs +++ b/Assets/Scripts/UI/UIManager.cs @@ -1,21 +1,80 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using KickDive.Match; +using TMPro; -public class UIManager : MonoBehaviour { +// Manages logic for in game UI +// Accessible as a singleton +namespace KickDive.UI { + public class UIManager : MonoBehaviour { + public static UIManager instance; - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } + [SerializeField] + private PlayerUI _player1UI; - private void SetHealthBars() { + [SerializeField] + private PlayerUI _player2UI; + [SerializeField] + private RoundUI _roundUI; + + // How long the "Round X" text is displayed for in seconds + [SerializeField] + private float _roundUIDisplayTime = 2.0f; + + [SerializeField] + private TextMeshProUGUI _roundTimer; + + private void Awake() { + if (instance == null) { + instance = this; + } else if (instance != this) { + Debug.Log("Found an existing instance of the UIManager, destroying this one"); + DestroyImmediate(this); + } + + if (MatchManager.instance != null) { + MatchManager.instance.OnPlayerWonRound += PlayerWonRound; + } else { + Debug.LogError("Could not find MatchManager to get match information for the UI!"); + } + } + + void Start() { + // DEBUG VALUES FOR NOW! + _player1UI.SetPlayerInfo("SubZero", PlayerNumber.Player1); + _player2UI.SetPlayerInfo("Scorpion", PlayerNumber.Player2); + } + + public void PlayerWonRound(PlayerNumber playerNumber) { + switch (playerNumber) { + case PlayerNumber.Player1: { + _player1UI.SetPlayerWins(MatchManager.instance.player1RoundScore); + _player2UI.DepleteHealth(); + break; + } + case PlayerNumber.Player2: { + _player2UI.SetPlayerWins(MatchManager.instance.player2RoundScore); + _player1UI.DepleteHealth(); + break; + } + } + } + + public void StartRoundUI() { + StartCoroutine(NewRoundTextCoroutine()); + } + + private IEnumerator NewRoundTextCoroutine() { + _roundUI.DisplayNewRound(); + yield return new WaitForSeconds(_roundUIDisplayTime); + _roundUI.StartRoundCounterFade(); + } + + private void Update() { + _roundTimer.SetText(MatchManager.instance.currentIntegerRoundTimeRemaning.ToString()); + } } } diff --git a/Assets/Textures/Menus/MenuSprites.png.meta b/Assets/Textures/Menus/MenuSprites.png.meta index 1399384..5a8dd3f 100644 --- a/Assets/Textures/Menus/MenuSprites.png.meta +++ b/Assets/Textures/Menus/MenuSprites.png.meta @@ -4,6 +4,8 @@ TextureImporter: fileIDToRecycleName: 21300000: HealthBarFull 21300002: HealthBarEmpty + 21300004: FightRed + 21300006: FightYellow externalObjects: {} serializedVersion: 7 mipmaps: @@ -147,6 +149,46 @@ TextureImporter: indices: edges: [] weights: [] + - serializedVersion: 2 + name: FightRed + rect: + serializedVersion: 2 + x: 840 + y: 544 + width: 95 + height: 29 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 9bb76ecfe81c96441aba6fd8a3bdf2ca + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: FightYellow + rect: + serializedVersion: 2 + x: 840 + y: 512 + width: 95 + height: 29 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 34bb8793028e17e46b698ac9c245659e + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] diff --git a/Assets/Third Party/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset b/Assets/Third Party/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset index d151701..fd4f458 100644 --- a/Assets/Third Party/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset +++ b/Assets/Third Party/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset @@ -34,4 +34,9 @@ MonoBehaviour: - HandleWonRound - HandleAcknowledgeRonRound - HandleAcknowledgeWonRound + - HandleRoundTimerStartFromOther + - NetworkStartRound + - HandleRoundTimerStart + - InitializeRound + - HandleRoundTimerStartSynchronization DisableAutoOpenWizard: 1 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 9bd6d10..693ea66 100755 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -8,4 +8,7 @@ EditorBuildSettings: - enabled: 0 path: guid: 00000000000000000000000000000000 + - enabled: 1 + path: Assets/Scenes/SandboxScene.unity + guid: 1ba2940682727cd4e910279214d8c6c4 m_configObjects: {}