diff --git a/Assets/Art/T_Char_01.png b/Assets/Art/T_Char_01.png new file mode 100644 index 0000000..f5fe783 Binary files /dev/null and b/Assets/Art/T_Char_01.png differ diff --git a/Assets/Art/T_Char_01.png.meta b/Assets/Art/T_Char_01.png.meta new file mode 100644 index 0000000..2a1bc64 --- /dev/null +++ b/Assets/Art/T_Char_01.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: b428255ba3ffb5642adbc9c28d91864d +timeCreated: 1460094721 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Art/T_Char_Dash_01.png b/Assets/Art/T_Char_Dash_01.png new file mode 100644 index 0000000..749b469 Binary files /dev/null and b/Assets/Art/T_Char_Dash_01.png differ diff --git a/Assets/Art/T_Char_Dash_01.png.meta b/Assets/Art/T_Char_Dash_01.png.meta new file mode 100644 index 0000000..4f1f6d4 --- /dev/null +++ b/Assets/Art/T_Char_Dash_01.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 1638a85de9c1a524ab602d8d8370dd8d +timeCreated: 1460094721 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ControllerMapper.asset b/Assets/ControllerMapper.asset new file mode 100644 index 0000000..556769e Binary files /dev/null and b/Assets/ControllerMapper.asset differ diff --git a/Assets/ControllerMapper.asset.meta b/Assets/ControllerMapper.asset.meta new file mode 100644 index 0000000..ad87b0e --- /dev/null +++ b/Assets/ControllerMapper.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ba52e0f13249c9e46bb162622e61904f +timeCreated: 1460092146 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor.meta b/Assets/Editor.meta new file mode 100644 index 0000000..30f1702 --- /dev/null +++ b/Assets/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2ca10ed205191f6469b088b753449e2e +folderAsset: yes +timeCreated: 1436647855 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/InputHandler.meta b/Assets/Editor/InputHandler.meta new file mode 100644 index 0000000..60fef14 --- /dev/null +++ b/Assets/Editor/InputHandler.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7f51e978f4624ae4794201e436ec39e5 +folderAsset: yes +timeCreated: 1435023323 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/InputHandler/CreateControllerMapperAsset.cs b/Assets/Editor/InputHandler/CreateControllerMapperAsset.cs new file mode 100644 index 0000000..5ded958 --- /dev/null +++ b/Assets/Editor/InputHandler/CreateControllerMapperAsset.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using System.Collections; +using UnityEditor; + +namespace InputHandler +{ + public class CreateControllerMapperAsset + { + [MenuItem("InputHandler/Create/ControllerMapper")] + public static void CreateInputAsset() + { + ControllerMapperAsset asset = ControllerMapperAsset.CreateInstance(); + AssetDatabase.CreateAsset(asset, "Assets/ControllerMapper.asset"); + AssetDatabase.SaveAssets(); + + EditorUtility.FocusProjectWindow(); + + Selection.activeObject = asset; + } + } +} \ No newline at end of file diff --git a/Assets/Editor/InputHandler/CreateControllerMapperAsset.cs.meta b/Assets/Editor/InputHandler/CreateControllerMapperAsset.cs.meta new file mode 100644 index 0000000..b030eaf --- /dev/null +++ b/Assets/Editor/InputHandler/CreateControllerMapperAsset.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 37a276da6a074c149a173094095c1e94 +timeCreated: 1434958498 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fonts.meta b/Assets/Fonts.meta new file mode 100644 index 0000000..cdda644 --- /dev/null +++ b/Assets/Fonts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 20134f50d6e763b41835848a2d42d00b +folderAsset: yes +timeCreated: 1460089798 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fonts/MenusHandler.meta b/Assets/Fonts/MenusHandler.meta new file mode 100644 index 0000000..3e9efdf --- /dev/null +++ b/Assets/Fonts/MenusHandler.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 80a249040a3563a43a7393513351b66c +folderAsset: yes +timeCreated: 1434250925 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fonts/MenusHandler/Hangyaboly.ttf b/Assets/Fonts/MenusHandler/Hangyaboly.ttf new file mode 100644 index 0000000..ae083db Binary files /dev/null and b/Assets/Fonts/MenusHandler/Hangyaboly.ttf differ diff --git a/Assets/Fonts/MenusHandler/Hangyaboly.ttf.meta b/Assets/Fonts/MenusHandler/Hangyaboly.ttf.meta new file mode 100644 index 0000000..785f409 --- /dev/null +++ b/Assets/Fonts/MenusHandler/Hangyaboly.ttf.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 7ad9c0075fe8016418f05173debbc8ec +timeCreated: 1434250925 +licenseType: Free +TrueTypeFontImporter: + serializedVersion: 2 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 1 + characterPadding: 0 + includeFontData: 1 + use2xBehaviour: 0 + fontNames: [] + customCharacters: + fontRenderingMode: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 0000000..a865646 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b7bbc4d80023984499ce688e0c85bd4b +folderAsset: yes +timeCreated: 1460089798 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86.meta b/Assets/Plugins/x86.meta new file mode 100644 index 0000000..58e77ae --- /dev/null +++ b/Assets/Plugins/x86.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d5a17b4fbbb9c794fb163e397e963e00 +folderAsset: yes +timeCreated: 1434857820 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86/XInputDotNetPure.dll b/Assets/Plugins/x86/XInputDotNetPure.dll new file mode 100644 index 0000000..f44f947 Binary files /dev/null and b/Assets/Plugins/x86/XInputDotNetPure.dll differ diff --git a/Assets/Plugins/x86/XInputDotNetPure.dll.meta b/Assets/Plugins/x86/XInputDotNetPure.dll.meta new file mode 100644 index 0000000..bd05672 --- /dev/null +++ b/Assets/Plugins/x86/XInputDotNetPure.dll.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c4e96c35cd46f534592ecc07b608e110 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86/XInputInterface.dll b/Assets/Plugins/x86/XInputInterface.dll new file mode 100644 index 0000000..7efa8fa Binary files /dev/null and b/Assets/Plugins/x86/XInputInterface.dll differ diff --git a/Assets/Plugins/x86/XInputInterface.dll.meta b/Assets/Plugins/x86/XInputInterface.dll.meta new file mode 100644 index 0000000..6c437d5 --- /dev/null +++ b/Assets/Plugins/x86/XInputInterface.dll.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: bbceb1b00a2e35849a7020d601589c40 +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86_64.meta b/Assets/Plugins/x86_64.meta new file mode 100644 index 0000000..f103658 --- /dev/null +++ b/Assets/Plugins/x86_64.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 19f56f3d79f95da47ae4895f7588c43b +folderAsset: yes +timeCreated: 1434857820 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86_64/XInputDotNetPure.dll b/Assets/Plugins/x86_64/XInputDotNetPure.dll new file mode 100644 index 0000000..d345520 Binary files /dev/null and b/Assets/Plugins/x86_64/XInputDotNetPure.dll differ diff --git a/Assets/Plugins/x86_64/XInputDotNetPure.dll.meta b/Assets/Plugins/x86_64/XInputDotNetPure.dll.meta new file mode 100644 index 0000000..b1b839c --- /dev/null +++ b/Assets/Plugins/x86_64/XInputDotNetPure.dll.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: b9f05caccaeb48146ae995df3ed431ab +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/x86_64/XInputInterface.dll b/Assets/Plugins/x86_64/XInputInterface.dll new file mode 100644 index 0000000..8a2d764 Binary files /dev/null and b/Assets/Plugins/x86_64/XInputInterface.dll differ diff --git a/Assets/Plugins/x86_64/XInputInterface.dll.meta b/Assets/Plugins/x86_64/XInputInterface.dll.meta new file mode 100644 index 0000000..bae1129 --- /dev/null +++ b/Assets/Plugins/x86_64/XInputInterface.dll.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: ea895df4f09804d47ac0a43ce22418cb +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/InputManager.prefab b/Assets/Prefabs/InputManager.prefab new file mode 100644 index 0000000..6e3fc71 --- /dev/null +++ b/Assets/Prefabs/InputManager.prefab @@ -0,0 +1,54 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &127118 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 498212} + - 114: {fileID: 11450178} + m_Layer: 0 + m_Name: InputManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &498212 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 127118} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -.669233799, y: 1.78620481, z: -.0453276634} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11450178 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 127118} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6e33ba5066fe01747b2722e6f089a2ba, type: 3} + m_Name: + m_EditorClassIdentifier: + MAX_PLAYER_COUNT: 4 + InputMapperAsset: {fileID: 11400000, guid: f4e69a787b1338846b2293e50d7cc92e, type: 2} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 127118} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/InputManager.prefab.meta b/Assets/Prefabs/InputManager.prefab.meta new file mode 100644 index 0000000..7e77ed1 --- /dev/null +++ b/Assets/Prefabs/InputManager.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 158e745881137e04ca2086294f44d74c +timeCreated: 1440215386 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Menus.meta b/Assets/Prefabs/Menus.meta new file mode 100644 index 0000000..5d2d412 --- /dev/null +++ b/Assets/Prefabs/Menus.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0baf798af518d8c43aaa48513682a8eb +folderAsset: yes +timeCreated: 1434247891 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Menus/MomWinsMenu.prefab b/Assets/Prefabs/Menus/MomWinsMenu.prefab new file mode 100644 index 0000000..a552b93 --- /dev/null +++ b/Assets/Prefabs/Menus/MomWinsMenu.prefab @@ -0,0 +1,670 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &100636 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22444946} + - 222: {fileID: 22288126} + - 114: {fileID: 11458902} + m_Layer: 5 + m_Name: Overlay + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &152940 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22485006} + - 222: {fileID: 22277124} + - 114: {fileID: 11463784} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160360 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460360} + - 222: {fileID: 22260360} + - 114: {fileID: 11460360} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160366 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460366} + - 222: {fileID: 22260366} + - 114: {fileID: 11460368} + - 114: {fileID: 11460394} + m_Layer: 5 + m_Name: ButtonRestart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160380 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 460360} + - 114: {fileID: 11431370} + - 114: {fileID: 11412680} + - 114: {fileID: 11469064} + m_Layer: 0 + m_Name: MomWinsMenu + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160382 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460380} + - 223: {fileID: 22360360} + - 114: {fileID: 11460398} + - 114: {fileID: 11460400} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160384 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460382} + - 222: {fileID: 22260376} + - 114: {fileID: 11460402} + - 114: {fileID: 11454254} + m_Layer: 5 + m_Name: ButtonExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160386 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460384} + - 222: {fileID: 22260378} + - 114: {fileID: 11460404} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &460360 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + 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: 22460380} + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11412680 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38c11234779339d4f8412f72ddd8889b, type: 3} + m_Name: + m_EditorClassIdentifier: + Delay: .200000003 + DeadZone: .5 + BackButtonEvent: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null +--- !u!114 &11431370 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 160366} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!114 &11454254 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: .929411829, g: .101960793, b: .274509817, a: 1} + m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} + m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} + m_ColorMultiplier: 1 + m_FadeDuration: .100000001 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 11460402} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11469064} + m_MethodName: OnExitClick + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &11458902 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100636} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: .303000003} + m_Sprite: {fileID: 21300000, guid: d90a8faf6fb9540b084ef2825cc3a5dc, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11460360 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160360} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 12800000, guid: 7ad9c0075fe8016418f05173debbc8ec, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Restart +--- !u!114 &11460368 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 21300000, guid: bb6a5d6e11b51d5449dd5b0f5230903c, type: 3} + m_Type: 1 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11460394 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: .929411829, g: .101960793, b: .274509817, a: 1} + m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} + m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} + m_ColorMultiplier: 1 + m_FadeDuration: .100000001 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 11460368} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11469064} + m_MethodName: OnRestartClick + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &11460398 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &11460400 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &11460402 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 21300000, guid: bb6a5d6e11b51d5449dd5b0f5230903c, type: 3} + m_Type: 1 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11460404 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160386} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 12800000, guid: 7ad9c0075fe8016418f05173debbc8ec, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Exit +--- !u!114 &11463784 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152940} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FontData: + m_Font: {fileID: 12800000, guid: 7ad9c0075fe8016418f05173debbc8ec, type: 3} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Mom Wins! +--- !u!114 &11469064 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1b367055e661c84d965e27bf591f3f7, type: 3} + m_Name: + m_EditorClassIdentifier: + Message: {fileID: 0} +--- !u!222 &22260360 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160360} +--- !u!222 &22260366 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} +--- !u!222 &22260376 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} +--- !u!222 &22260378 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160386} +--- !u!222 &22277124 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152940} +--- !u!222 &22288126 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100636} +--- !u!223 &22360360 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 1 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!224 &22444946 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100636} + 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: 22460380} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460360 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160360} + 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: 22460366} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .122000009} + m_AnchorMax: {x: 1, y: .769512236} + m_AnchoredPosition: {x: -.5, y: 0} + m_SizeDelta: {x: -1, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460366 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} + 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: 22460360} + m_Father: {fileID: 22460380} + m_RootOrder: 2 + m_AnchorMin: {x: .349999994, y: .400000006} + m_AnchorMax: {x: .649999976, y: .5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460380 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + 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: 22444946} + - {fileID: 22485006} + - {fileID: 22460366} + - {fileID: 22460382} + m_Father: {fileID: 460360} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!224 &22460382 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} + 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: 22460384} + m_Father: {fileID: 22460380} + m_RootOrder: 3 + m_AnchorMin: {x: .349999994, y: .200392365} + m_AnchorMax: {x: .649999976, y: .300392389} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460384 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160386} + 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: 22460382} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .122000001} + m_AnchorMax: {x: 1, y: .769512177} + m_AnchoredPosition: {x: -.5, y: 0} + m_SizeDelta: {x: -1, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22485006 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152940} + 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: 22460380} + m_RootOrder: 1 + m_AnchorMin: {x: .0500000007, y: .684177101} + m_AnchorMax: {x: .949999988, y: .866000056} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 160380} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/Menus/MomWinsMenu.prefab.meta b/Assets/Prefabs/Menus/MomWinsMenu.prefab.meta new file mode 100644 index 0000000..ba5fc2c --- /dev/null +++ b/Assets/Prefabs/Menus/MomWinsMenu.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a495bf58d4ebd442b25dfc40a98e481 +timeCreated: 1440270348 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Menus/PlayerWinsMenu.prefab b/Assets/Prefabs/Menus/PlayerWinsMenu.prefab new file mode 100644 index 0000000..e5ded55 --- /dev/null +++ b/Assets/Prefabs/Menus/PlayerWinsMenu.prefab @@ -0,0 +1,670 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &100636 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22444946} + - 222: {fileID: 22288126} + - 114: {fileID: 11458902} + m_Layer: 5 + m_Name: Overlay + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &152940 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22485006} + - 222: {fileID: 22277124} + - 114: {fileID: 11463784} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160360 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460360} + - 222: {fileID: 22260360} + - 114: {fileID: 11460360} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160366 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460366} + - 222: {fileID: 22260366} + - 114: {fileID: 11460368} + - 114: {fileID: 11460394} + m_Layer: 5 + m_Name: ButtonRestart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160380 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 460360} + - 114: {fileID: 11431370} + - 114: {fileID: 11412680} + - 114: {fileID: 11469064} + m_Layer: 0 + m_Name: PlayerWinsMenu + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160382 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460380} + - 223: {fileID: 22360360} + - 114: {fileID: 11460398} + - 114: {fileID: 11460400} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160384 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460382} + - 222: {fileID: 22260376} + - 114: {fileID: 11460402} + - 114: {fileID: 11454254} + m_Layer: 5 + m_Name: ButtonExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &160386 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22460384} + - 222: {fileID: 22260378} + - 114: {fileID: 11460404} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &460360 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + 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: 22460380} + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11412680 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 38c11234779339d4f8412f72ddd8889b, type: 3} + m_Name: + m_EditorClassIdentifier: + Delay: .200000003 + DeadZone: .5 + BackButtonEvent: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral, + PublicKeyToken=null +--- !u!114 &11431370 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 160366} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!114 &11454254 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: .929411829, g: .101960793, b: .274509817, a: 1} + m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} + m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} + m_ColorMultiplier: 1 + m_FadeDuration: .100000001 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 11460402} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11469064} + m_MethodName: OnExitClick + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &11458902 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100636} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: .303000003} + m_Sprite: {fileID: 21300000, guid: d90a8faf6fb9540b084ef2825cc3a5dc, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11460360 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160360} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 12800000, guid: 7ad9c0075fe8016418f05173debbc8ec, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Restart +--- !u!114 &11460368 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 21300000, guid: bb6a5d6e11b51d5449dd5b0f5230903c, type: 3} + m_Type: 1 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11460394 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: .929411829, g: .101960793, b: .274509817, a: 1} + m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} + m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} + m_ColorMultiplier: 1 + m_FadeDuration: .100000001 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 11460368} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11469064} + m_MethodName: OnRestartClick + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &11460398 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &11460400 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &11460402 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 21300000, guid: bb6a5d6e11b51d5449dd5b0f5230903c, type: 3} + m_Type: 1 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11460404 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160386} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 12800000, guid: 7ad9c0075fe8016418f05173debbc8ec, type: 3} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Exit +--- !u!114 &11463784 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152940} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FontData: + m_Font: {fileID: 12800000, guid: 7ad9c0075fe8016418f05173debbc8ec, type: 3} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Player 1 Wins! +--- !u!114 &11469064 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e1b367055e661c84d965e27bf591f3f7, type: 3} + m_Name: + m_EditorClassIdentifier: + Message: {fileID: 11463784} +--- !u!222 &22260360 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160360} +--- !u!222 &22260366 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} +--- !u!222 &22260376 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} +--- !u!222 &22260378 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160386} +--- !u!222 &22277124 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152940} +--- !u!222 &22288126 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100636} +--- !u!223 &22360360 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 1 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!224 &22444946 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100636} + 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: 22460380} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460360 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160360} + 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: 22460366} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .122000009} + m_AnchorMax: {x: 1, y: .769512236} + m_AnchoredPosition: {x: -.5, y: 0} + m_SizeDelta: {x: -1, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460366 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160366} + 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: 22460360} + m_Father: {fileID: 22460380} + m_RootOrder: 2 + m_AnchorMin: {x: .349999994, y: .400000006} + m_AnchorMax: {x: .649999976, y: .5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460380 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160382} + 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: 22444946} + - {fileID: 22485006} + - {fileID: 22460366} + - {fileID: 22460382} + m_Father: {fileID: 460360} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!224 &22460382 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160384} + 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: 22460384} + m_Father: {fileID: 22460380} + m_RootOrder: 3 + m_AnchorMin: {x: .349999994, y: .200392365} + m_AnchorMax: {x: .649999976, y: .300392389} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22460384 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 160386} + 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: 22460382} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: .122000001} + m_AnchorMax: {x: 1, y: .769512177} + m_AnchoredPosition: {x: -.5, y: 0} + m_SizeDelta: {x: -1, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22485006 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152940} + 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: 22460380} + m_RootOrder: 1 + m_AnchorMin: {x: .0500000007, y: .684177101} + m_AnchorMax: {x: .949999988, y: .866000056} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 160380} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/Menus/PlayerWinsMenu.prefab.meta b/Assets/Prefabs/Menus/PlayerWinsMenu.prefab.meta new file mode 100644 index 0000000..911dfb9 --- /dev/null +++ b/Assets/Prefabs/Menus/PlayerWinsMenu.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cf712c8a251107d4db1ded768a7e8d98 +timeCreated: 1440278006 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/MenusHandler.meta b/Assets/Prefabs/MenusHandler.meta new file mode 100644 index 0000000..2761517 --- /dev/null +++ b/Assets/Prefabs/MenusHandler.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d400fbe6e79cd3f41ac51081aa196e08 +folderAsset: yes +timeCreated: 1434247496 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/MenusHandler/MenusManager.prefab b/Assets/Prefabs/MenusHandler/MenusManager.prefab new file mode 100644 index 0000000..3c75011 --- /dev/null +++ b/Assets/Prefabs/MenusHandler/MenusManager.prefab @@ -0,0 +1,55 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &183988 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 483988} + - 114: {fileID: 11483988} + m_Layer: 0 + m_Name: MenusManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &483988 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 183988} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.11251187, y: 2.53501511, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11483988 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 183988} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b40c9a6b8e14bc84a8e8d472d4e124ea, type: 3} + m_Name: + m_EditorClassIdentifier: + Menus: + - {fileID: 11469064, guid: 6a495bf58d4ebd442b25dfc40a98e481, type: 2} + - {fileID: 11469064, guid: cf712c8a251107d4db1ded768a7e8d98, type: 2} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 183988} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/MenusHandler/MenusManager.prefab.meta b/Assets/Prefabs/MenusHandler/MenusManager.prefab.meta new file mode 100644 index 0000000..4d3bf33 --- /dev/null +++ b/Assets/Prefabs/MenusHandler/MenusManager.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 38eb021af0911154aab92f72bc4f341a +timeCreated: 1432957259 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/file.txt.meta b/Assets/Prefabs/file.txt.meta new file mode 100644 index 0000000..d90c250 --- /dev/null +++ b/Assets/Prefabs/file.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 956f6dc5d62f42447bf1cd7e795dd4f1 +timeCreated: 1460088419 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs new file mode 100644 index 0000000..3351978 --- /dev/null +++ b/Assets/Scripts/GameManager.cs @@ -0,0 +1,77 @@ +using UnityEngine; +using System.Collections; +using InputHandler; +using MenusHandler; + +public class GameManager : MonoBehaviour +{ + public int PlayerCount = 4; + private static GameManager _instance; + + public static GameManager Instance + { + get { return _instance; } + } + + void Awake() + { + _instance = this; + + /* + if (_instance != null) + { + Destroy(gameObject); + } + else + { + _instance = this; + DontDestroyOnLoad(gameObject); + }*/ + } + + void Start() + { + for (int i = 0; i < PlayerCount; i++) + { + InputManager.Instance.AddCallback(i, HandleMenuInput); + } + + + // play gameplay music + //MusicManager.Instance.PlayGameplayMusic(); + } + + public void PushMenuContext() + { + for (int i = 0; i < PlayerCount; i++) + { + InputManager.Instance.PushActiveContext("Menu", i); + } + } + + public void PopMenuContext() + { + for (int i = 0; i < PlayerCount; i++) + { + InputManager.Instance.PopActiveContext(i); + } + } + + private void HandleMenuInput(MappedInput input) + { + float yAxis = 0f; + + if (input.Ranges.ContainsKey("SelectOptionUp")) + { + yAxis = input.Ranges["SelectOptionUp"]; + } + else if (input.Ranges.ContainsKey("SelectOptionDown")) + { + yAxis = -input.Ranges["SelectOptionDown"]; + } + + bool accept = input.Actions.Contains("Accept"); + + MenusManager.Instance.SetInputValues(accept, false, 0f, yAxis); + } +} diff --git a/Assets/Scripts/GameManager.cs.meta b/Assets/Scripts/GameManager.cs.meta new file mode 100644 index 0000000..2e4ef60 --- /dev/null +++ b/Assets/Scripts/GameManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1825cbcd751ef524bbccc0b274d69d7a +timeCreated: 1440271895 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler.meta b/Assets/Scripts/InputHandler.meta new file mode 100644 index 0000000..8fe520f --- /dev/null +++ b/Assets/Scripts/InputHandler.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d6e2ccb4aa280a04297ff5048cde5ee1 +folderAsset: yes +timeCreated: 1434183356 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler/ControllerManager.cs b/Assets/Scripts/InputHandler/ControllerManager.cs new file mode 100644 index 0000000..f911a9e --- /dev/null +++ b/Assets/Scripts/InputHandler/ControllerManager.cs @@ -0,0 +1,196 @@ +using UnityEngine; +using System.Collections; +using XInputDotNetPure; +using System.Collections.Generic; + +namespace InputHandler +{ + public class ControllerManager : InputManager + { + private bool[] _initialSetupDone; + private PlayerIndex[] _playerIndexes; + private GamePadState[] _gamePadPreviousStates; + private GamePadState[] _gamePadStates; + + protected override void InitialSetup() + { + _initialSetupDone = new bool[MAX_PLAYER_COUNT]; + _playerIndexes = new PlayerIndex[MAX_PLAYER_COUNT]; + _gamePadPreviousStates = new GamePadState[MAX_PLAYER_COUNT]; + _gamePadStates = new GamePadState[MAX_PLAYER_COUNT]; + + for (int i = 0; i < MAX_PLAYER_COUNT; i++) + { + _gamePadStates[i] = GamePad.GetState(_playerIndexes[i]); + } + } + + protected override void MapInputs() + { + for (int i = 0; i < MAX_PLAYER_COUNT; i++) + { + _gamePadPreviousStates[i] = _gamePadStates[i]; + _gamePadStates[i] = GamePad.GetState(_playerIndexes[i]); + + if (!_gamePadPreviousStates[i].IsConnected || !_initialSetupDone[i]) + { + _initialSetupDone[i] = true; + + if (_gamePadStates[i].IsConnected) + { + _playerIndexes[i] = (PlayerIndex)i; + + Debug.Log(string.Format("GamePad {0} is ready", _playerIndexes[i])); + } + } + + MapPlayerInput(_inputMappers[i], _gamePadStates[i], _gamePadPreviousStates[i]); + } + } + + // TODO: Maybe reduce it to only the inputs actually used in the game? + private void MapPlayerInput(InputMapper inputMapper, GamePadState state, GamePadState previousState) + { + foreach (int axisInt in InputMapperAsset.GetMappedXboxAxis()) + { + MapXboxAxis(axisInt, inputMapper, state); + } + + foreach (int buttonInt in InputMapperAsset.GetMappedXboxButtons()) + { + MapXboxButton(buttonInt, inputMapper, state, previousState); + } + + // TODO: Put the following code into another class, so we can have 2 distinct XboxManager and KeyboardManager classes + + // We map only the keyboard keys that are going to be used in the game + + foreach (int key in InputMapperAsset.GetMappedKeyboardKeys()) + { + inputMapper.SetRawButtonState(100 + key, Input.GetKey((KeyCode)key), Input.GetKey((KeyCode)key) && !Input.GetKeyDown((KeyCode)key)); + } + + foreach (int key in InputMapperAsset.GetMappedKeyboardKeysAxis()) + { + float value = Input.GetKey((KeyCode)key) ? 1f : 0f; + + inputMapper.SetRawAxisValue(100 + key, value); + } + } + + private void MapXboxButton(int buttonInt, InputMapper inputMapper, GamePadState state, GamePadState previousState) + { + XboxInputConstants.Buttons button = (XboxInputConstants.Buttons)buttonInt; + + bool pressed = false; + bool previouslyPressed = false; + + switch (button) + { + case XboxInputConstants.Buttons.A: + pressed = state.Buttons.A == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.A == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.B: + pressed = state.Buttons.B == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.B == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.X: + pressed = state.Buttons.X == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.X == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.Y: + pressed = state.Buttons.Y == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.Y == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.LeftShoulder: + pressed = state.Buttons.LeftShoulder == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.LeftShoulder == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.RightShoulder: + pressed = state.Buttons.RightShoulder == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.RightShoulder == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.Back: + pressed = state.Buttons.Back == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.Back == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.Start: + pressed = state.Buttons.Start == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.Start == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.LeftStick: + pressed = state.Buttons.LeftStick == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.LeftStick == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.RightStick: + pressed = state.Buttons.RightStick == ButtonState.Pressed; + previouslyPressed = previousState.Buttons.RightStick == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.DPadLeft: + pressed = state.DPad.Left == ButtonState.Pressed; + previouslyPressed = previousState.DPad.Left == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.DPadRight: + pressed = state.DPad.Right == ButtonState.Pressed; + previouslyPressed = previousState.DPad.Right == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.DPadUp: + pressed = state.DPad.Up == ButtonState.Pressed; + previouslyPressed = previousState.DPad.Up == ButtonState.Pressed; + break; + case XboxInputConstants.Buttons.DPadDown: + pressed = state.DPad.Down == ButtonState.Pressed; + previouslyPressed = previousState.DPad.Down == ButtonState.Pressed; + break; + } + + inputMapper.SetRawButtonState(buttonInt, pressed, previouslyPressed); + } + + private void MapXboxAxis(int axisInt, InputMapper inputMapper, GamePadState state) + { + XboxInputConstants.Axis axis = (XboxInputConstants.Axis)axisInt; + + float value = 0f; + + switch (axis) + { + case XboxInputConstants.Axis.LeftStickLeft: + // If the left stick X value is negative, we keep it and take its absolute value + value = state.ThumbSticks.Left.X < 0f ? -state.ThumbSticks.Left.X : 0f; + break; + case XboxInputConstants.Axis.LeftStickRight: + // If the left stick X value is positive, we keep it + value = state.ThumbSticks.Left.X > 0f ? state.ThumbSticks.Left.X : 0f; + break; + case XboxInputConstants.Axis.LeftStickDown: + value = state.ThumbSticks.Left.Y < 0f ? -state.ThumbSticks.Left.Y : 0f; + break; + case XboxInputConstants.Axis.LeftStickUp: + value = state.ThumbSticks.Left.Y > 0f ? state.ThumbSticks.Left.Y : 0f; + break; + case XboxInputConstants.Axis.RightStickLeft: + value = state.ThumbSticks.Right.X < 0f ? -state.ThumbSticks.Right.X : 0f; + break; + case XboxInputConstants.Axis.RightStickRight: + value = state.ThumbSticks.Right.X > 0f ? state.ThumbSticks.Right.X : 0f; + break; + case XboxInputConstants.Axis.RightStickDown: + value = state.ThumbSticks.Right.Y < 0f ? -state.ThumbSticks.Right.Y : 0f; + break; + case XboxInputConstants.Axis.RightStickUp: + value = state.ThumbSticks.Right.Y > 0f ? state.ThumbSticks.Right.Y : 0f; + break; + case XboxInputConstants.Axis.TriggerLeft: + value = state.Triggers.Left; + break; + case XboxInputConstants.Axis.TriggerRight: + value = state.Triggers.Right; + break; + } + + inputMapper.SetRawAxisValue(axisInt, value); + } + } +} diff --git a/Assets/Scripts/InputHandler/ControllerManager.cs.meta b/Assets/Scripts/InputHandler/ControllerManager.cs.meta new file mode 100644 index 0000000..f25f973 --- /dev/null +++ b/Assets/Scripts/InputHandler/ControllerManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6e33ba5066fe01747b2722e6f089a2ba +timeCreated: 1436627825 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -50 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler/ControllerMapperAsset.cs b/Assets/Scripts/InputHandler/ControllerMapperAsset.cs new file mode 100644 index 0000000..bf77e1d --- /dev/null +++ b/Assets/Scripts/InputHandler/ControllerMapperAsset.cs @@ -0,0 +1,197 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +namespace InputHandler +{ + // TODO: REFACTOR THE WHOLE CLASS, IT STINKS + + [SerializeField] + public class ControllerMapperAsset : InputMapperAsset + { + [Serializable] + public class XboxContext + { + public string name; + public XboxAction[] ButtonActions; + public XboxRange[] AxisRanges; + public XboxState[] ButtonStates; + } + + [Serializable] + public class XboxAction + { + public string name; + public XboxInputConstants.Buttons[] XboxButtons; + public KeyCode[] KeyboardKeys; + } + + [Serializable] + public class XboxRange + { + public string name; + public XboxInputConstants.Axis[] Axis; + public KeyCode[] KeyboardKeys; + } + + [Serializable] + public class XboxState + { + public string name; + public XboxInputConstants.Buttons[] XboxButtons; + public KeyCode[] KeyboardKeys; + } + + public XboxContext[] Contexts; + + // TODO: Temporary + private List _mappedKeyboardKeysAxis; + private List _mappedKeyboardKeys; + private List _mappedXboxAxis; + private List _mappedXboxButtons; + + // Context -> InputMap + public override Dictionary GetMappedContexts() + { + _mappedKeyboardKeys = new List(); + _mappedKeyboardKeysAxis = new List(); + _mappedXboxButtons = new List(); + _mappedXboxAxis = new List(); + + Dictionary mappedContexts = new Dictionary(); + + foreach (XboxContext xboxContext in Contexts) + { + InputMap inputMap = new InputMap(); + + inputMap.ButtonsToActionsMap = new List[xboxContext.ButtonActions.Length]; + inputMap.ButtonsToStatesMap = new List[xboxContext.ButtonStates.Length]; + inputMap.AxisToRangesMap = new List[xboxContext.AxisRanges.Length]; + + for (int i = 0; i < xboxContext.ButtonActions.Length; i++) + { + XboxAction buttonAction = xboxContext.ButtonActions[i]; + + inputMap.ButtonsToActionsMap[i] = new List(); + + foreach (XboxInputConstants.Buttons xboxButton in buttonAction.XboxButtons) + { + // TODO: We need to manage this in the InputMapper side + inputMap.ButtonsToActionsMap[i].Add(new InputToActionMap { action = buttonAction.name, input = (int)xboxButton }); + + if (!_mappedXboxButtons.Contains((int)xboxButton)) + { + _mappedXboxButtons.Add((int)xboxButton); + } + } + + // Keyboard part + foreach (KeyCode key in buttonAction.KeyboardKeys) + { + // TODO: Find a way to not add 100 to the code (for now, it's necessary since there are overlaps with the xbox enum) + inputMap.ButtonsToActionsMap[i].Add(new InputToActionMap { action = buttonAction.name, input = 100 + (int)key }); + + // TODO: Temporary + if (!_mappedKeyboardKeys.Contains((int)key)) + { + _mappedKeyboardKeys.Add((int)key); + } + } + } + + for (int i = 0; i < xboxContext.ButtonStates.Length; i++) + { + XboxState buttonState = xboxContext.ButtonStates[i]; + + inputMap.ButtonsToStatesMap[i] = new List(); + + foreach (XboxInputConstants.Buttons xboxButton in buttonState.XboxButtons) + { + // TODO: We need to manage this in the InputMapper side + inputMap.ButtonsToStatesMap[i].Add(new InputToActionMap() { action = buttonState.name, input = (int)xboxButton }); + + if (!_mappedXboxButtons.Contains((int)xboxButton)) + { + _mappedXboxButtons.Add((int)xboxButton); + } + } + + // Keyboard part + foreach (KeyCode key in buttonState.KeyboardKeys) + { + // TODO: Find a way to not add 100 to the code (for now, it's necessary since there are overlaps with the xbox enum) + inputMap.ButtonsToStatesMap[i].Add(new InputToActionMap { action = buttonState.name, input = 100 + (int)key }); + + // TODO: Temporary + if (!_mappedKeyboardKeys.Contains((int)key)) + { + _mappedKeyboardKeys.Add((int)key); + } + } + } + + for (int i = 0; i < xboxContext.AxisRanges.Length; i++) + { + XboxRange axisRange = xboxContext.AxisRanges[i]; + + inputMap.AxisToRangesMap[i] = new List(); + + foreach (XboxInputConstants.Axis xboxAxis in axisRange.Axis) + { + // TODO: We need to manage this in the InputMapper side + inputMap.AxisToRangesMap[i].Add(new InputToActionMap() { action = axisRange.name, input = (int)xboxAxis }); + + if (!_mappedXboxAxis.Contains((int)xboxAxis)) + { + _mappedXboxAxis.Add((int)xboxAxis); + } + } + + // Keyboard part + foreach (KeyCode key in axisRange.KeyboardKeys) + { + // TODO: Find a way to not add 100 to the code (for now, it's necessary since there are overlaps with the xbox enum) + inputMap.AxisToRangesMap[i].Add(new InputToActionMap { action = axisRange.name, input = 100 + (int)key }); + + // TODO: Temporary + if (!_mappedKeyboardKeysAxis.Contains((int)key)) + { + _mappedKeyboardKeysAxis.Add((int)key); + } + } + } + + InputContext context = new InputContext(xboxContext.name, inputMap); + + mappedContexts.Add(xboxContext.name, context); + } + + return mappedContexts; + } + + // TODO: Probably temporary, until we find a better way and all the classes are refactored + + // Utility method to be used by the ControllerManager class + public override List GetMappedKeyboardKeysAxis() + { + return _mappedKeyboardKeysAxis; + } + + // Utility method to be used by the ControllerManager class + public override List GetMappedKeyboardKeys() + { + return _mappedKeyboardKeys; + } + + public override List GetMappedXboxAxis() + { + return _mappedXboxAxis; + } + + public override List GetMappedXboxButtons() + { + return _mappedXboxButtons; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/InputHandler/ControllerMapperAsset.cs.meta b/Assets/Scripts/InputHandler/ControllerMapperAsset.cs.meta new file mode 100644 index 0000000..aedca80 --- /dev/null +++ b/Assets/Scripts/InputHandler/ControllerMapperAsset.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 539aad81a9327404e8e67bb53c540d91 +timeCreated: 1436387267 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler/InputConstants.cs b/Assets/Scripts/InputHandler/InputConstants.cs new file mode 100644 index 0000000..0b823e8 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputConstants.cs @@ -0,0 +1,19 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace InputHandler +{ + public struct InputMap + { + public List[] ButtonsToActionsMap; + public List[] ButtonsToStatesMap; + public List[] AxisToRangesMap; + } + + public struct InputToActionMap + { + public int input; + public string action; + } +} diff --git a/Assets/Scripts/InputHandler/InputConstants.cs.meta b/Assets/Scripts/InputHandler/InputConstants.cs.meta new file mode 100644 index 0000000..5bc8258 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputConstants.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: baa0e457a4ff21a4a8eb7d57efeef697 +timeCreated: 1434996179 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler/InputContext.cs b/Assets/Scripts/InputHandler/InputContext.cs new file mode 100644 index 0000000..1ca6d92 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputContext.cs @@ -0,0 +1,70 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +namespace InputHandler +{ + public class InputContext + { + private Dictionary _mappedButtons; + private Dictionary _mappedStates; + private Dictionary _mappedAxis; + + private string _name; + + public string Name + { + get { return _name; } + } + + + public InputContext(string contextName, InputMap inputMap) + { + _name = contextName; + + _mappedButtons = new Dictionary(); + _mappedStates = new Dictionary(); + _mappedAxis = new Dictionary(); + + foreach (List buttonsToActionsMap in inputMap.ButtonsToActionsMap) + { + foreach (InputToActionMap buttonToActionMap in buttonsToActionsMap) + { + _mappedButtons.Add(buttonToActionMap.input, buttonToActionMap.action); + } + } + + foreach (List buttonsToStatesMap in inputMap.ButtonsToStatesMap) + { + foreach (InputToActionMap buttonToStateMap in buttonsToStatesMap) + { + _mappedStates.Add(buttonToStateMap.input, buttonToStateMap.action); + } + } + + foreach (List axisToRangesMap in inputMap.AxisToRangesMap) + { + foreach (InputToActionMap axisToRangeMap in axisToRangesMap) + { + _mappedAxis.Add(axisToRangeMap.input, axisToRangeMap.action); + } + } + } + + public string GetActionForButton(int button) + { + return _mappedButtons.ContainsKey(button) ? _mappedButtons[button] : null; + } + + public string GetStateForButton(int button) + { + return _mappedStates.ContainsKey(button) ? _mappedStates[button] : null; + } + + public string GetRangeForAxis(int axis) + { + return _mappedAxis.ContainsKey(axis) ? _mappedAxis[axis] : null; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/InputHandler/InputContext.cs.meta b/Assets/Scripts/InputHandler/InputContext.cs.meta new file mode 100644 index 0000000..dc2aa61 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputContext.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4d99cd0919594864482148f723dfa8e2 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Scripts/InputHandler/InputManager.cs b/Assets/Scripts/InputHandler/InputManager.cs new file mode 100644 index 0000000..2c0e292 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputManager.cs @@ -0,0 +1,98 @@ +using UnityEngine; +using System.Collections; +using XInputDotNetPure; +using System; +using System.Collections.Generic; + +namespace InputHandler +{ + public abstract class InputManager : MonoBehaviour + { + public static InputManager Instance + { + get + { + return _instance; + } + } + + private static InputManager _instance; + + protected InputMapper[] _inputMappers; + + public int MAX_PLAYER_COUNT = 2; + public InputMapperAsset InputMapperAsset; + + protected abstract void InitialSetup(); + protected abstract void MapInputs(); + + void Awake() + { + if (_instance != null) + { + Destroy(gameObject); + } + else + { + _instance = this; + + _inputMappers = new InputMapper[MAX_PLAYER_COUNT]; + + Dictionary mappedContexts = InputMapperAsset.GetMappedContexts(); + + for (int i = 0; i < MAX_PLAYER_COUNT; i++) + { + _inputMappers[i] = new InputMapper(mappedContexts); + } + + // Do the needed initial setup in the derived classes + InitialSetup(); + } + } + + void Update() + { + // Do the input mapping here in the derived classes + MapInputs(); + + for (int i = 0; i < _inputMappers.Length; i++) + { + _inputMappers[i].Dispatch(); + } + } + + public void AddCallback(int playerIndex, Action action) + { + _inputMappers[playerIndex].AddCallback(action); + } + + public void PushActiveContext(string name, int playerIndex) + { + _inputMappers[playerIndex].PushActiveContext(name); + } + + public void PopActiveContext(int playerIndex) + { + // TODO: Give the choice to remove an active context not on top + _inputMappers[playerIndex].PopActiveContext(); + } + + public void ClearContexts() + { + // For now, all input mappers are gonna have the same contexts at the same time + + for (int i = 0; i < _inputMappers.Length; i++) + { + _inputMappers[i].ClearActiveContexts(); + } + } + + void LateUpdate() + { + for (int i = 0; i < _inputMappers.Length; i++) + { + _inputMappers[i].ResetInputs(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/InputHandler/InputManager.cs.meta b/Assets/Scripts/InputHandler/InputManager.cs.meta new file mode 100644 index 0000000..7e29a63 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 967b7f4e180b49f4fb6f53702c67aa34 +timeCreated: 1436627825 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -100 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler/InputMapper.cs b/Assets/Scripts/InputHandler/InputMapper.cs new file mode 100644 index 0000000..25dc580 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputMapper.cs @@ -0,0 +1,205 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +/* + Strongly inspired from Mike Lewis' excellent post about input handling + http://www.gamedev.net/blog/355/entry-2250186-designing-a-robust-input-handling-system-for-games/ +*/ + +namespace InputHandler +{ + public class InputMapper + { + // Right now, the only active context is the peek of the stack, but when we will need multiple contexts at once, this is going to be useful + private Dictionary _contexts; + private Stack _activeContexts; + + private List> _callbacks; + + private MappedInput _currentFrameMappedInput; + + public InputMapper(Dictionary contexts) + { + _contexts = contexts; + _activeContexts = new Stack(); + _callbacks = new List>(); + _currentFrameMappedInput = new MappedInput(); + } + + public void Dispatch() + { + foreach (Action callback in _callbacks) + { + callback(_currentFrameMappedInput); + } + } + + public void PushActiveContext(string name) + { + InputContext context = _contexts[name]; + + if (_activeContexts.Count == 0 || _activeContexts.Peek().Name != name) + { + _activeContexts.Push(context); + } + } + + public void PopActiveContext() + { + if (_activeContexts.Count != 0) + { + _activeContexts.Pop(); + } + } + + public void ClearActiveContexts() + { + _activeContexts.Clear(); + } + + public void AddCallback(Action callback) + { + _callbacks.Add(callback); + } + + public void SetRawButtonState(int button, bool pressed, bool previouslyPressed) + { + string action = GetActionForButton(button); + string state = GetStateForButton(button); + + if (pressed) + { + if (!previouslyPressed && action != null) + { + _currentFrameMappedInput.Actions.Add(action); + return; + } + + if (state != null) + { + _currentFrameMappedInput.States.Add(state); + return; + } + } + + // Uncomment if we start to have problems + //RemoveButtonFromLists(button); + } + + public void SetRawAxisValue(int axis, float value) + { + // TODO: Have contexts for every single player? + + // TODO: Use the commented code below instead when we will want multiple contexts to be available at the same time (maybe for when the player holds a weapon?). We'll keep it simple for now. + + /* + foreach (InputContext activeContext in _activeContexts) + { + InputConstants.Ranges range = activeContext.GetRangeForAxis(axis); + + if (range != InputConstants.Ranges.None) + { + // We only want the first active "range behaviour" of the player to handle the ranges values, since we don't want multiple actions to react to it + _mappedInputs[playerIndex].Ranges[range] = value; + break; + } + }*/ + + if (value != 0f) + { + string range = null; + + if (_activeContexts.Count != 0) + { + range = _activeContexts.Peek().GetRangeForAxis(axis); + } + + if (range != null) + { + _currentFrameMappedInput.Ranges[range] = value; + } + } + } + + public void ResetInputs() + { + _currentFrameMappedInput.Clear(); + } + + #region Helper methods + + private string GetActionForButton(int button) + { + // TODO: Have contexts for every single player? + + // TODO: Use the commented code below instead when we will want multiple contexts to be available at the same time (maybe for when the player holds a weapon?). We'll keep it simple for now. + + /* + foreach (InputContext activeContext in _activeContexts) + { + InputConstants.Actions action = activeContext.GetActionForButton(button); + + if (action != InputConstants.Actions.None) + { + return action; + } + }*/ + + string action = null; + + if (_activeContexts.Count != 0) + { + action = _activeContexts.Peek().GetActionForButton(button); + } + + return action; + } + + private string GetStateForButton(int button) + { + // TODO: Have contexts for every single player? + + // TODO: Use the commented code below instead when we will want multiple contexts to be available at the same time (maybe for when the player holds a weapon?). We'll keep it simple for now. + + /* + foreach (InputContext activeContext in _activeContexts) + { + InputConstants.States state = activeContext.GetStateForButton(button); + + if (state != InputConstants.States.None) + { + return state; + } + }*/ + + string state = null; + + if (_activeContexts.Count != 0) + { + state = _activeContexts.Peek().GetStateForButton(button); + } + + return state; + } + + private void RemoveButtonFromLists(int button) + { + string action = GetActionForButton(button); + string state = GetStateForButton(button); + + if (action != null) + { + _currentFrameMappedInput.Actions.Remove(action); + } + + if (state != null) + { + _currentFrameMappedInput.States.Remove(state); + } + } + + #endregion + } +} diff --git a/Assets/Scripts/InputHandler/InputMapper.cs.meta b/Assets/Scripts/InputHandler/InputMapper.cs.meta new file mode 100644 index 0000000..f760acc --- /dev/null +++ b/Assets/Scripts/InputHandler/InputMapper.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 586455317dda0b543a30eff647db722e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Scripts/InputHandler/InputMapperAsset.cs b/Assets/Scripts/InputHandler/InputMapperAsset.cs new file mode 100644 index 0000000..f9bbbaa --- /dev/null +++ b/Assets/Scripts/InputHandler/InputMapperAsset.cs @@ -0,0 +1,20 @@ +using UnityEngine; +using System.Collections; +using System; +using System.Collections.Generic; + +namespace InputHandler +{ + public abstract class InputMapperAsset : ScriptableObject + { + public enum InputTypes { Action, State, Range } + + public abstract Dictionary GetMappedContexts(); + + // TODO: Probably temporary, until we find a better way and all the classes are refactored + public abstract List GetMappedKeyboardKeysAxis(); + public abstract List GetMappedKeyboardKeys(); + public abstract List GetMappedXboxAxis(); + public abstract List GetMappedXboxButtons(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/InputHandler/InputMapperAsset.cs.meta b/Assets/Scripts/InputHandler/InputMapperAsset.cs.meta new file mode 100644 index 0000000..beec650 --- /dev/null +++ b/Assets/Scripts/InputHandler/InputMapperAsset.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3a5ffa04260e8db4a9eab84c1e6b11ae +timeCreated: 1434962375 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputHandler/MappedInput.cs b/Assets/Scripts/InputHandler/MappedInput.cs new file mode 100644 index 0000000..b244bce --- /dev/null +++ b/Assets/Scripts/InputHandler/MappedInput.cs @@ -0,0 +1,23 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +namespace InputHandler +{ + // Specific to the game + public class MappedInput + { + // We use hashets for the actions and the states because we just need to check if they are in the collection, and not retrieve them + public HashSet Actions = new HashSet(); + public HashSet States = new HashSet(); + public Dictionary Ranges = new Dictionary(); + + public void Clear() + { + Actions.Clear(); + States.Clear(); + Ranges.Clear(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/InputHandler/MappedInput.cs.meta b/Assets/Scripts/InputHandler/MappedInput.cs.meta new file mode 100644 index 0000000..40b9d51 --- /dev/null +++ b/Assets/Scripts/InputHandler/MappedInput.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5fe308a0d85530408827f4357cc1ff5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Scripts/InputHandler/XboxInputConstants.cs b/Assets/Scripts/InputHandler/XboxInputConstants.cs new file mode 100644 index 0000000..e5ab19d --- /dev/null +++ b/Assets/Scripts/InputHandler/XboxInputConstants.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using System.Collections; + +namespace InputHandler +{ + //TODO: When we will be ready to read raw inputs from a file, we need this to simply be generic "BUTTON_ONE, BUTTON_TWO, etc." + + public class XboxInputConstants + { + // These buttons will eventually map to controls saved in a file + public enum Buttons + { + A, + B, + X, + Y, + LeftShoulder, + RightShoulder, + Back, + Start, + LeftStick, + RightStick, + DPadLeft, + DPadRight, + DPadUp, + DPadDown, + } + + public enum Axis + { + LeftStickLeft, + LeftStickRight, + LeftStickUp, + LeftStickDown, + RightStickLeft, + RightStickRight, + RightStickUp, + RightStickDown, + TriggerLeft, + TriggerRight + } + } +} diff --git a/Assets/Scripts/InputHandler/XboxInputConstants.cs.meta b/Assets/Scripts/InputHandler/XboxInputConstants.cs.meta new file mode 100644 index 0000000..c9ed15d --- /dev/null +++ b/Assets/Scripts/InputHandler/XboxInputConstants.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4b46fefecf9412e46bdad7c26a00d537 +timeCreated: 1436628179 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/InputTest.cs b/Assets/Scripts/InputTest.cs new file mode 100644 index 0000000..d61c6f8 --- /dev/null +++ b/Assets/Scripts/InputTest.cs @@ -0,0 +1,64 @@ +using UnityEngine; +using System.Collections; +using InputHandler; + +public class InputTest : MonoBehaviour { + + private int PlayerNumber; + + // Use this for initialization + void Start () { + InputManager.Instance.PushActiveContext("Gameplay", PlayerNumber); + InputManager.Instance.AddCallback(PlayerNumber, HandlePlayerAxis); + InputManager.Instance.AddCallback(PlayerNumber, HandlePlayerButtons); + } + + private void HandlePlayerAxis(MappedInput input) + { + if (this == null) return; + + // movement + + float xValue = 0f; + + if (input.Ranges.ContainsKey("MoveLeft")) + { + xValue = -input.Ranges["MoveLeft"]; + Debug.Log("Moved left!"); + } + else if (input.Ranges.ContainsKey("MoveRight")) + { + xValue = input.Ranges["MoveRight"]; + Debug.Log("Moved right!"); + } + + float zValue = 0f; + + if (input.Ranges.ContainsKey("MoveUp")) + { + zValue = input.Ranges["MoveUp"]; + Debug.Log("Moved up!"); + } + else if (input.Ranges.ContainsKey("MoveDown")) + { + zValue = -input.Ranges["MoveDown"]; + Debug.Log("Moved down!"); + } + + if (input.Ranges.ContainsKey("Dash")) + { + //zValue = -input.Ranges["Dash"]; + Debug.Log("Dashed!"); + } + } + + private void HandlePlayerButtons(MappedInput input) + { + if (this == null) return; + + if (input.Actions.Contains("Jump")) + { + Debug.Log("Jumped!"); + } + } +} diff --git a/Assets/Scripts/InputTest.cs.meta b/Assets/Scripts/InputTest.cs.meta new file mode 100644 index 0000000..87d8805 --- /dev/null +++ b/Assets/Scripts/InputTest.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c8ea5c2832373d844bbef8e01bc6c6a7 +timeCreated: 1460092132 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Menus.meta b/Assets/Scripts/Menus.meta new file mode 100644 index 0000000..308794f --- /dev/null +++ b/Assets/Scripts/Menus.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d760adee926677142b681f1c9f9f1a4a +folderAsset: yes +timeCreated: 1434247891 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Menus/PlayerWinsMenu.cs b/Assets/Scripts/Menus/PlayerWinsMenu.cs new file mode 100644 index 0000000..98f663e --- /dev/null +++ b/Assets/Scripts/Menus/PlayerWinsMenu.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using System.Collections; +using MenusHandler; +using UnityEngine.UI; +using UnityEngine.SceneManagement; + +public class PlayerWinsMenu : Menu +{ + public Text Message; + + public override void Open() + { + base.Open(); + + GameManager.Instance.PushMenuContext(); + + Time.timeScale = 0f; + } + + public override void Close() + { + base.Close(); + + GameManager.Instance.PopMenuContext(); + + Time.timeScale = 1f; + } + + public void SetPlayerIndex(int index) + { + Message.text = "Player " + (index + 1) + " Wins!"; + } + + public void OnRestartClick() + { + Time.timeScale = 1f; + SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); + } + + public void OnExitClick() + { + Application.Quit(); + } +} diff --git a/Assets/Scripts/Menus/PlayerWinsMenu.cs.meta b/Assets/Scripts/Menus/PlayerWinsMenu.cs.meta new file mode 100644 index 0000000..ce46bd1 --- /dev/null +++ b/Assets/Scripts/Menus/PlayerWinsMenu.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e1b367055e661c84d965e27bf591f3f7 +timeCreated: 1434247895 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Menus/SimpleMenu.cs b/Assets/Scripts/Menus/SimpleMenu.cs new file mode 100644 index 0000000..d9fb5a0 --- /dev/null +++ b/Assets/Scripts/Menus/SimpleMenu.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.SceneManagement; + +public class SimpleMenu : MonoBehaviour +{ + public int NextLevel; + + + // Update is called once per frame + void Update () { + if (Input.anyKeyDown) { + if (NextLevel == 200) + Application.Quit(); + else + SceneManager.LoadScene(NextLevel); + } + } + + IEnumerator AutoSkip() { + + yield return new WaitForSeconds(5); + + + } +} diff --git a/Assets/Scripts/Menus/SimpleMenu.cs.meta b/Assets/Scripts/Menus/SimpleMenu.cs.meta new file mode 100644 index 0000000..e4e193a --- /dev/null +++ b/Assets/Scripts/Menus/SimpleMenu.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 769d2d55a9b6b104baa54b6081fbe205 +timeCreated: 1440313599 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MenusHandler.meta b/Assets/Scripts/MenusHandler.meta new file mode 100644 index 0000000..ba28888 --- /dev/null +++ b/Assets/Scripts/MenusHandler.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7fadf2e5fa3e5d640a263265b68583f2 +folderAsset: yes +timeCreated: 1434216062 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MenusHandler/Menu.cs b/Assets/Scripts/MenusHandler/Menu.cs new file mode 100644 index 0000000..745f5f0 --- /dev/null +++ b/Assets/Scripts/MenusHandler/Menu.cs @@ -0,0 +1,28 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; + +namespace MenusHandler +{ + [RequireComponent(typeof(MenuInputModule))] + public abstract class Menu : MonoBehaviour + { + private MenuInputModule _inputModule; + + public MenuInputModule InputModule + { + get { return _inputModule; } + } + + void Awake() + { + _inputModule = GetComponent(); + } + + protected virtual void Start() { } + + public virtual void Open() { } + + public virtual void Close() { } + } +} diff --git a/Assets/Scripts/MenusHandler/Menu.cs.meta b/Assets/Scripts/MenusHandler/Menu.cs.meta new file mode 100644 index 0000000..902bf74 --- /dev/null +++ b/Assets/Scripts/MenusHandler/Menu.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 742b9043bc8a6ad49976846ccee3e85d +timeCreated: 1432957414 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MenusHandler/MenuButton.cs b/Assets/Scripts/MenusHandler/MenuButton.cs new file mode 100644 index 0000000..d32c6b9 --- /dev/null +++ b/Assets/Scripts/MenusHandler/MenuButton.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; +using System; +using UnityEngine.EventSystems; + +namespace MenusHandler +{ + public class MenuButton : Button + { + public Image LeftSelectorImage; + public Image RightSelectorImage; + + protected override void Awake() + { + base.Awake(); + + LeftSelectorImage.gameObject.SetActive(false); + RightSelectorImage.gameObject.SetActive(false); + } + + public override void OnSelect(UnityEngine.EventSystems.BaseEventData eventData) + { + base.OnSelect(eventData); + + LeftSelectorImage.gameObject.SetActive(true); + RightSelectorImage.gameObject.SetActive(true); + } + + public override void OnDeselect(UnityEngine.EventSystems.BaseEventData eventData) + { + + base.OnDeselect(eventData); + + LeftSelectorImage.gameObject.SetActive(false); + RightSelectorImage.gameObject.SetActive(false); + } + + public void SetText(string text) + { + GetComponentInChildren().text = text; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MenusHandler/MenuButton.cs.meta b/Assets/Scripts/MenusHandler/MenuButton.cs.meta new file mode 100644 index 0000000..ce96a24 --- /dev/null +++ b/Assets/Scripts/MenusHandler/MenuButton.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 77f8cfacd7a48bc4e94dd33e9924e13e +timeCreated: 1434216115 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MenusHandler/MenuInputModule.cs b/Assets/Scripts/MenusHandler/MenuInputModule.cs new file mode 100644 index 0000000..37ebd38 --- /dev/null +++ b/Assets/Scripts/MenusHandler/MenuInputModule.cs @@ -0,0 +1,197 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.EventSystems; +using UnityEngine.UI; +using System; +using UnityEngine.Events; + +namespace MenusHandler +{ + [RequireComponent(typeof(EventSystem))] + public class MenuInputModule : BaseInputModule + { + public float Delay = 0.2f; + public float DeadZone = 0.5f; + + public UnityEvent BackButtonEvent; + + private EventSystem _eventSystem; + + private bool _canNavigate = true; + + private GameObject _previousTargettedObject; + + private bool _acceptButtonPressed = false; + private bool _backButtonPressed = false; + private bool _menuDownPressed = false; + private bool _menuUpPressed = false; + private bool _menuRightPressed = false; + private bool _menuLeftPressed = false; + + protected override void Start() + { + base.Start(); + + _eventSystem = GetComponent(); + } + + public override void ActivateModule() + { + base.ActivateModule(); + + SelectFirstButton(); + _canNavigate = true; + } + + public override void Process() + { + if (_acceptButtonPressed) + { + ExecuteEvents.Execute(_eventSystem.currentSelectedGameObject.gameObject, new BaseEventData(eventSystem), ExecuteEvents.submitHandler); + } + else if (_backButtonPressed) + { + BackButtonEvent.Invoke(); + } + else if (_canNavigate) + { + if (_menuRightPressed) + { + SelectRightButton(); + } + else if (_menuLeftPressed) + { + SelectLeftButton(); + } + else if (_menuDownPressed) + { + SelectDownButton(); + } + else if (_menuUpPressed) + { + SelectUpButton(); + } + } + + _acceptButtonPressed = false; + _backButtonPressed = false; + _menuDownPressed = false; + _menuUpPressed = false; + _menuRightPressed = false; + _menuLeftPressed = false; + } + + public void ChangeFirstButton(Selectable button) + { + _eventSystem.firstSelectedGameObject = button.gameObject; + } + + public void SelectFirstButton() + { + if (_eventSystem.firstSelectedGameObject == null) return; + + if (_eventSystem.currentSelectedGameObject != _eventSystem.firstSelectedGameObject) + { + ExecuteEvents.Execute(_eventSystem.currentSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.deselectHandler); + } + + ExecuteEvents.Execute(_eventSystem.firstSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.selectHandler); + _eventSystem.SetSelectedGameObject(_eventSystem.firstSelectedGameObject); + } + + private void SelectLeftButton() + { + if (_eventSystem.currentSelectedGameObject == null) return; + + Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent().FindSelectableOnLeft(); + + if (toBeSelected != null) + { + _eventSystem.SetSelectedGameObject(toBeSelected.gameObject); + StartCoroutine("PauseNavigation"); + } + } + + private void SelectRightButton() + { + if (_eventSystem.currentSelectedGameObject == null) return; + + Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent().FindSelectableOnRight(); + + if (toBeSelected != null) + { + _eventSystem.SetSelectedGameObject(toBeSelected.gameObject); + StartCoroutine("PauseNavigation"); + } + } + + private void SelectUpButton() + { + if (_eventSystem.currentSelectedGameObject == null) return; + + Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent().FindSelectableOnUp(); + + if (toBeSelected != null) + { + _eventSystem.SetSelectedGameObject(toBeSelected.gameObject); + StartCoroutine("PauseNavigation"); + } + } + + private void SelectDownButton() + { + if (_eventSystem.currentSelectedGameObject == null) return; + + Selectable toBeSelected = _eventSystem.currentSelectedGameObject.GetComponent().FindSelectableOnDown(); + + if (toBeSelected != null) + { + _eventSystem.SetSelectedGameObject(toBeSelected.gameObject); + StartCoroutine("PauseNavigation"); + } + } + + // Adds a delay before we can switch options again + private IEnumerator PauseNavigation() + { + _canNavigate = false; + + float elapsedTime = 0f; + + // Since the game might be paused here, we can't do "yield return new WaitForSeconds(0.2f);" + while (elapsedTime < Delay) + { + elapsedTime += Time.unscaledDeltaTime; + + yield return null; + } + + _canNavigate = true; + } + + public void SetInputValues(bool acceptButton, bool backButton, float horizontalAxis, float verticalAxis) + { + if (acceptButton) + { + _acceptButtonPressed = true; + } + + if (backButton) + { + _backButtonPressed = true; + } + + if (verticalAxis != 0f) + { + _menuDownPressed = verticalAxis < -DeadZone; + _menuUpPressed = verticalAxis > DeadZone; + } + + if (horizontalAxis != 0f) + { + _menuRightPressed = horizontalAxis > DeadZone; + _menuLeftPressed = horizontalAxis < -DeadZone; + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MenusHandler/MenuInputModule.cs.meta b/Assets/Scripts/MenusHandler/MenuInputModule.cs.meta new file mode 100644 index 0000000..a9e654b --- /dev/null +++ b/Assets/Scripts/MenusHandler/MenuInputModule.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 38c11234779339d4f8412f72ddd8889b +timeCreated: 1434216114 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MenusHandler/MenusManager.cs b/Assets/Scripts/MenusHandler/MenusManager.cs new file mode 100644 index 0000000..6789e70 --- /dev/null +++ b/Assets/Scripts/MenusHandler/MenusManager.cs @@ -0,0 +1,123 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; +using System; + +namespace MenusHandler +{ + public class MenusManager : MonoBehaviour + { + public Action OnMenusOpened; + public Action OnMenusClosed; + + public Menu[] Menus; + + private static MenusManager _instance; + private Dictionary _menus; + private Dictionary _cachedMenus; + private Menu _currentMenu; + + public static MenusManager Instance + { + get { return _instance; } + } + + void Awake() + { + if (Instance) + { + Destroy(gameObject); + } + else + { + _instance = this; + + _menus = new Dictionary(); + _cachedMenus = new Dictionary(); + + foreach (Menu menu in Menus) + { + _menus[menu.name] = menu; + } + } + } + + public Menu ShowMenu(string name) + { + if (_currentMenu != null) + { + CloseCurrentMenu(); + } + + if (!_cachedMenus.ContainsKey(name) || _cachedMenus[name] == null) + { + _cachedMenus[name] = Instantiate(_menus[name], Vector3.zero, Quaternion.identity) as Menu; + DontDestroyOnLoad(_cachedMenus[name]); + _cachedMenus[name].name = name; + } + + _currentMenu = _cachedMenus[name]; + + OpenCurrentMenu(); + + return _currentMenu; + } + + public void RequestClose() + { + CloseCurrentMenu(); + } + + public void SetInputValues(bool acceptButton, bool backButton, float horizontalAxis, float verticalAxis) + { + if (_currentMenu != null) + { + _currentMenu.InputModule.SetInputValues(acceptButton, backButton, horizontalAxis, verticalAxis); + } + } + + void OnDestroy() + { + foreach (KeyValuePair kvp in _cachedMenus) + { + if (kvp.Value != null) + { + Destroy(kvp.Value.gameObject); + } + } + } + + void OnLevelWasLoaded(int levelIndex) + { + // When we load a new level, we close the currently active menu if it's still open + CloseCurrentMenu(); + } + + // Can change based on whether we simply hide the menus or destroy them + private void OpenCurrentMenu() + { + _currentMenu.gameObject.SetActive(true); + _currentMenu.Open(); + + if (OnMenusOpened != null) + { + OnMenusOpened(); + } + } + + // Can change based on whether we simply hide the menus or destroy them + private void CloseCurrentMenu() + { + if (_currentMenu != null && _currentMenu.gameObject.activeSelf) + { + _currentMenu.Close(); + _currentMenu.gameObject.SetActive(false); + + if (OnMenusClosed != null) + { + OnMenusClosed(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/MenusHandler/MenusManager.cs.meta b/Assets/Scripts/MenusHandler/MenusManager.cs.meta new file mode 100644 index 0000000..431d3f2 --- /dev/null +++ b/Assets/Scripts/MenusHandler/MenusManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b40c9a6b8e14bc84a8e8d472d4e124ea +timeCreated: 1432957285 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/file.txt.meta b/Assets/Scripts/file.txt.meta new file mode 100644 index 0000000..86e7793 --- /dev/null +++ b/Assets/Scripts/file.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77f8a1d558598d9408cb2abb88189467 +timeCreated: 1460088419 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/file.txt.meta b/Assets/Sounds/file.txt.meta new file mode 100644 index 0000000..42c0197 --- /dev/null +++ b/Assets/Sounds/file.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f202c98948164344a3f24d311356aeb +timeCreated: 1460088418 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Test.meta b/Assets/Test.meta new file mode 100644 index 0000000..ae14c52 --- /dev/null +++ b/Assets/Test.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1684ce2102780804caea41f9c941be9a +folderAsset: yes +timeCreated: 1460094089 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Test/SR_TestInput.unity b/Assets/Test/SR_TestInput.unity new file mode 100644 index 0000000..425a364 Binary files /dev/null and b/Assets/Test/SR_TestInput.unity differ diff --git a/Assets/Test/SR_TestInput.unity.meta b/Assets/Test/SR_TestInput.unity.meta new file mode 100644 index 0000000..62ca9a0 --- /dev/null +++ b/Assets/Test/SR_TestInput.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d59d73cf72fdb0042a1a8f4fd05307f6 +timeCreated: 1460094090 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/file.txt.meta b/Assets/_Scenes/file.txt.meta new file mode 100644 index 0000000..81832fe --- /dev/null +++ b/Assets/_Scenes/file.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 27f8660ce677f614998367591f127e5a +timeCreated: 1460088419 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: