From 9ed3d98e21949cf0cafa70ec0946ce02a63690c3 Mon Sep 17 00:00:00 2001 From: Teascade Date: Sun, 4 Aug 2019 18:35:05 +0300 Subject: [PATCH] Add hud and fun bar, and make it kinda work --- Assets/Graphics/FunBar.png | Bin 0 -> 200 bytes Assets/Graphics/FunBar.png.meta | 103 +++++++ Assets/Prefabs/HUD.prefab | 488 ++++++++++++++++++++++++++++++- Assets/Prefabs/Player.prefab | 2 +- Assets/Scenes/MainScene.unity | 171 ++++++----- Assets/Scripts/HUDController.cs | 36 ++- Assets/Scripts/Player.cs | 9 +- Assets/Scripts/PlayerFun.cs | 60 ++++ Assets/Scripts/PlayerFun.cs.meta | 11 + 9 files changed, 796 insertions(+), 84 deletions(-) create mode 100644 Assets/Graphics/FunBar.png create mode 100644 Assets/Graphics/FunBar.png.meta create mode 100644 Assets/Scripts/PlayerFun.cs create mode 100644 Assets/Scripts/PlayerFun.cs.meta diff --git a/Assets/Graphics/FunBar.png b/Assets/Graphics/FunBar.png new file mode 100644 index 0000000000000000000000000000000000000000..3c63e3eed9908b6d2e8eeacea246baeb01e348d5 GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^r+`?1g9%99SX90ZNO2Z;L>4nJ=qZCRW5rVYGN2%P ziKnkC`(q9kerAaa+>$-HLxe(-=Hm{an^LB{Ts5wXHwK literal 0 HcmV?d00001 diff --git a/Assets/Graphics/FunBar.png.meta b/Assets/Graphics/FunBar.png.meta new file mode 100644 index 0000000..8d5437c --- /dev/null +++ b/Assets/Graphics/FunBar.png.meta @@ -0,0 +1,103 @@ +fileFormatVersion: 2 +guid: 4ba8bbbba9bde8846b81aed533f02ac5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 32 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/HUD.prefab b/Assets/Prefabs/HUD.prefab index 5589be4..fbd78ae 100644 --- a/Assets/Prefabs/HUD.prefab +++ b/Assets/Prefabs/HUD.prefab @@ -1,5 +1,343 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &468242468806270567 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4531584877236580830} + - component: {fileID: 5184216719862736668} + - component: {fileID: 2245787847809376028} + m_Layer: 5 + m_Name: DamageBonus + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4531584877236580830 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 468242468806270567} + 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: 3965881083143910201} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -94.9, y: -25.4} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5184216719862736668 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 468242468806270567} + m_CullTransparentMesh: 0 +--- !u!114 &2245787847809376028 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 468242468806270567} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.95709896, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: c2b8548a6d222b44cbdceae5b971a677, type: 3} + m_FontSize: 25 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 50 + m_Alignment: 2 + m_AlignByGeometry: 1 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +100% +--- !u!1 &1247685834992216397 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5884054962017161911} + - component: {fileID: 968757470911926827} + - component: {fileID: 7812496038623515921} + m_Layer: 5 + m_Name: FunMeter + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5884054962017161911 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1247685834992216397} + 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: 8802990707360688558} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 5, y: 0} + m_SizeDelta: {x: -10, y: 30} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &968757470911926827 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1247685834992216397} + m_CullTransparentMesh: 0 +--- !u!114 &7812496038623515921 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1247685834992216397} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.2003901, g: 1, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Texture: {fileID: 2800000, guid: 4ba8bbbba9bde8846b81aed533f02ac5, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!1 &1536973168977449449 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3965881083143910201} + m_Layer: 5 + m_Name: FunTexts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3965881083143910201 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1536973168977449449} + 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: 4531584877236580830} + m_Father: {fileID: 4910715999455506354} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1595478046579888527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 594860309237950776} + - component: {fileID: 1962875550112426600} + - component: {fileID: 4391485460155157709} + m_Layer: 5 + m_Name: DamageBonus + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &594860309237950776 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1595478046579888527} + 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: 7485172030629334178} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -88.6, y: -24.2} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1962875550112426600 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1595478046579888527} + m_CullTransparentMesh: 0 +--- !u!114 &4391485460155157709 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1595478046579888527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 12800000, guid: f3ca06d8c094ade4180b1ebe0cecdf54, type: 3} + m_FontSize: 25 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 0 + m_MaxSize: 50 + m_Alignment: 2 + m_AlignByGeometry: 1 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +100% +--- !u!1 &3126872621518873612 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3795192971480655897} + - component: {fileID: 6580283125280535873} + - component: {fileID: 1607369273573891622} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3795192971480655897 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3126872621518873612} + 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: 8802990707360688558} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 5, y: 0} + m_SizeDelta: {x: -10, y: 30} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &6580283125280535873 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3126872621518873612} + m_CullTransparentMesh: 0 +--- !u!114 &1607369273573891622 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3126872621518873612} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.23584908, g: 0.23584908, b: 0.23584908, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Texture: {fileID: 2800000, guid: 4ba8bbbba9bde8846b81aed533f02ac5, type: 3} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 --- !u!1 &3311208437654835705 GameObject: m_ObjectHideFlags: 0 @@ -12,6 +350,8 @@ GameObject: - component: {fileID: 5164300839620245461} - component: {fileID: 8426549979394133340} - component: {fileID: 7397271445291880048} + - component: {fileID: 540882401639379656} + - component: {fileID: 3806237922719029712} m_Layer: 5 m_Name: HUD m_TagString: Untagged @@ -29,7 +369,10 @@ RectTransform: 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: [] + m_Children: + - {fileID: 8802990707360688558} + - {fileID: 7485172030629334178} + - {fileID: 3965881083143910201} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -98,3 +441,146 @@ MonoBehaviour: m_BlockingMask: serializedVersion: 2 m_Bits: 4294967295 +--- !u!114 &540882401639379656 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3311208437654835705} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5edc23d433b5bb14482eeb7c302264a2, type: 3} + m_Name: + m_EditorClassIdentifier: + PlayerFun: {fileID: 0} + FunMeter: {fileID: 7812496038623515921} + DamageTextGore: {fileID: 4391485460155157709} + DamageTextFun: {fileID: 2245787847809376028} +--- !u!114 &3806237922719029712 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3311208437654835705} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f0e0f5d3262bb6a48877a37eb3e05eb9, type: 3} + m_Name: + m_EditorClassIdentifier: + GoreObject: {fileID: 8440319295527082093} + CensoredObject: {fileID: 1536973168977449449} +--- !u!1 &5159878213919589737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8802990707360688558} + - component: {fileID: 7080727182636881399} + - component: {fileID: 6199761578390386744} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8802990707360688558 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5159878213919589737} + 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: 3795192971480655897} + - {fileID: 5884054962017161911} + m_Father: {fileID: 4910715999455506354} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -22.5} + m_SizeDelta: {x: 0, y: 45} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7080727182636881399 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5159878213919589737} + m_CullTransparentMesh: 0 +--- !u!114 &6199761578390386744 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5159878213919589737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8440319295527082093 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7485172030629334178} + m_Layer: 5 + m_Name: GoreTexts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7485172030629334178 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8440319295527082093} + 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: 594860309237950776} + m_Father: {fileID: 4910715999455506354} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index fef4114..0ce842f 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -354,7 +354,7 @@ Rigidbody2D: m_Simulated: 1 m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 - m_Mass: 0.0001 + m_Mass: 10 m_LinearDrag: 0 m_AngularDrag: 0 m_GravityScale: 0 diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 07149e9..b7bc3af 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -1330,12 +1330,38 @@ MonoBehaviour: type: 3} m_PrefabInstance: {fileID: 370761184} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 370761186} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0eb42a731c31b5f49a58e1045b654e3e, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &370761186 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8489029732530782804, guid: 14a47f86f9e45da45863a81716f2378b, + type: 3} + m_PrefabInstance: {fileID: 370761184} + m_PrefabAsset: {fileID: 0} +--- !u!114 &370761187 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 370761186} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c0a7560055c54ab479467ce5b1c7cfcd, type: 3} + m_Name: + m_EditorClassIdentifier: + Player: {fileID: 370761185} + MaxFun: 100 + FunDegradeSpeed: 5 + StandingStillMultiplier: 1.5 + WeaponFun: 20 + EnemyExplosionFun: 2 + FurnitureExplosionFun: 1 + DebugAdd10Fun: 0 --- !u!1 &397489490 GameObject: m_ObjectHideFlags: 0 @@ -2594,73 +2620,7 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &1878201189 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1878201192} - - component: {fileID: 1878201191} - - component: {fileID: 1878201190} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1878201190 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1878201189} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 ---- !u!114 &1878201191 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1878201189} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &1878201192 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1878201189} - 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: 0} - m_RootOrder: 9 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &6588012239102932552 +--- !u!1001 &1485325071 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -2710,7 +2670,7 @@ PrefabInstance: - target: {fileID: 4910715999455506354, guid: 75aac28ba4e17cc4d99ef646650a3d70, type: 3} propertyPath: m_RootOrder - value: 8 + value: 9 objectReference: {fileID: 0} - target: {fileID: 4910715999455506354, guid: 75aac28ba4e17cc4d99ef646650a3d70, type: 3} @@ -2777,24 +2737,81 @@ PrefabInstance: propertyPath: m_Pivot.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 540882401639379656, guid: 75aac28ba4e17cc4d99ef646650a3d70, + type: 3} + propertyPath: Player + value: + objectReference: {fileID: 370761185} + - target: {fileID: 540882401639379656, guid: 75aac28ba4e17cc4d99ef646650a3d70, + type: 3} + propertyPath: PlayerFun + value: + objectReference: {fileID: 370761187} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 75aac28ba4e17cc4d99ef646650a3d70, type: 3} ---- !u!1 &6588012239102932553 stripped +--- !u!1 &1878201189 GameObject: - m_CorrespondingSourceObject: {fileID: 3311208437654835705, guid: 75aac28ba4e17cc4d99ef646650a3d70, - type: 3} - m_PrefabInstance: {fileID: 6588012239102932552} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!114 &6588012239102932554 + serializedVersion: 6 + m_Component: + - component: {fileID: 1878201192} + - component: {fileID: 1878201191} + - component: {fileID: 1878201190} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1878201190 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6588012239102932553} + m_GameObject: {fileID: 1878201189} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5edc23d433b5bb14482eeb7c302264a2, type: 3} + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: - Player: {fileID: 370761185} + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1878201191 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1878201189} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &1878201192 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1878201189} + 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: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/HUDController.cs b/Assets/Scripts/HUDController.cs index bf9d5c5..0406df5 100644 --- a/Assets/Scripts/HUDController.cs +++ b/Assets/Scripts/HUDController.cs @@ -1,17 +1,51 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.UI; namespace Saltosion.OneWeapon { public class HUDController : MonoBehaviour { - public Player Player; + public PlayerFun PlayerFun; + public RawImage FunMeter; + + public Text DamageTextGore; + public Text DamageTextFun; void Start() { } void Update() { + float FunPercent = (PlayerFun.CurrentFun / PlayerFun.MaxFun); + Vector3 Scale = FunMeter.transform.localScale; + + Scale.x = FunPercent; + FunMeter.transform.localScale = Scale; + Rect UVRect = FunMeter.uvRect; + UVRect.width = FunPercent; + FunMeter.uvRect = UVRect; + + float FunLevel = Mathf.Floor(FunPercent * 6) / 6; + + Color Color = FunMeter.color; + Color.g = FunLevel; + Color.r = 1 - FunLevel; + FunMeter.color = Color; + + int FunPercentNumber = (int)Mathf.Round(PlayerFun.CurrentDamageBoost * 100); + string Text = "+" + FunPercentNumber + "%"; + DamageTextGore.text = Text; + DamageTextFun.text = Text; + + Color GoreColor = DamageTextGore.color; + GoreColor.g = 1 - PlayerFun.CurrentDamageBoost; + GoreColor.b = 1 - PlayerFun.CurrentDamageBoost; + DamageTextGore.color = GoreColor; + + Color FunColor = DamageTextFun.color; + FunColor.b = 1 - PlayerFun.CurrentDamageBoost; + DamageTextFun.color = FunColor; } } diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 15159e7..b490230 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -24,9 +24,9 @@ namespace Saltosion.OneWeapon { private Vector2 GunLocation = new Vector2(0, -0.6f); private Vector3 GunRotation = new Vector3(0, 0, -90); - void Start() { - - } + public bool IsMoving { + private set; get; + } = false; void Update() { float X = Input.GetAxis("Horizontal"); @@ -83,10 +83,11 @@ namespace Saltosion.OneWeapon { if (Direction.magnitude > 0.05) { BodyAnim.SetFloat("Speed", 1); HeadAnim.SetFloat("Speed", 1); - + IsMoving = true; } else { BodyAnim.SetFloat("Speed", 0); HeadAnim.SetFloat("Speed", 0); + IsMoving = false; } bool Shoot = Input.GetButtonDown("Shoot"); diff --git a/Assets/Scripts/PlayerFun.cs b/Assets/Scripts/PlayerFun.cs new file mode 100644 index 0000000..6049891 --- /dev/null +++ b/Assets/Scripts/PlayerFun.cs @@ -0,0 +1,60 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Saltosion.OneWeapon { + public class PlayerFun : MonoBehaviour { + + public Player Player; + + public float MaxFun = 100; + public float FunDegradeSpeed = 5; + public float StandingStillMultiplier = 1.5f; + + public float WeaponFun = 20; + public float EnemyExplosionFun = 2f; + public float FurnitureExplosionFun = 1f; + + public float CurrentFun { private set; get; } + + public bool DebugAdd10Fun = false; + + public float CurrentDamageBoost { private set; get; } + + void Start() { + CurrentFun = MaxFun; + } + + void Update() { + float Delta = FunDegradeSpeed * Time.deltaTime; + if (!Player.IsMoving) { + Delta *= StandingStillMultiplier; + } + float NewFun = CurrentFun - Delta; + + if (DebugAdd10Fun) { + NewFun += 10; + DebugAdd10Fun = false; + } + + CurrentFun = Mathf.Clamp(NewFun, 0, MaxFun); + + CurrentDamageBoost = Mathf.Floor((CurrentFun / 100) * 12) / 12; + } + + public void ReceiveNewWeapon() { + float NewFun = CurrentFun + WeaponFun; + CurrentFun = Mathf.Min(MaxFun, NewFun); + } + + public void Explosion(bool isFurniture) { + float NewFun = CurrentFun; + if (isFurniture) { + NewFun += FurnitureExplosionFun; + } else { + NewFun += EnemyExplosionFun; + } + CurrentFun = Mathf.Min(MaxFun, NewFun); + } + } +} diff --git a/Assets/Scripts/PlayerFun.cs.meta b/Assets/Scripts/PlayerFun.cs.meta new file mode 100644 index 0000000..38ad5d8 --- /dev/null +++ b/Assets/Scripts/PlayerFun.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c0a7560055c54ab479467ce5b1c7cfcd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: