From 21fe05bdeeb3280f6e72fe308041c3e2aa98c786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Sat, 17 Aug 2019 11:45:15 +0300 Subject: [PATCH] Add new upgrade GoldenBomb: +1 bomb & +1 flame --- Assets/Resources/Ammo/FlameUpgrade.prefab | 13 -- .../Resources/Ammo/GoldenBombUpgrade.prefab | 121 ++++++++++++++++++ .../Ammo/GoldenBombUpgrade.prefab.meta | 7 + Assets/Scripts/src/Helpers/PrefabAtlas.cs | 2 + Assets/Scripts/src/Level/LevelData.cs | 10 +- .../Scripts/src/Upgrade/GoldenBombUpgrade.cs | 15 +++ .../src/Upgrade/GoldenBombUpgrade.cs.meta | 3 + 7 files changed, 155 insertions(+), 16 deletions(-) create mode 100644 Assets/Resources/Ammo/GoldenBombUpgrade.prefab create mode 100644 Assets/Resources/Ammo/GoldenBombUpgrade.prefab.meta create mode 100644 Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs create mode 100644 Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs.meta diff --git a/Assets/Resources/Ammo/FlameUpgrade.prefab b/Assets/Resources/Ammo/FlameUpgrade.prefab index 76b0346..cf52f2c 100644 --- a/Assets/Resources/Ammo/FlameUpgrade.prefab +++ b/Assets/Resources/Ammo/FlameUpgrade.prefab @@ -12,7 +12,6 @@ GameObject: - component: {fileID: 7037551310800415105} - component: {fileID: 7958292204112110464} - component: {fileID: 5334633105760309190} - - component: {fileID: 6293070509487257227} m_Layer: 0 m_Name: FlameUpgrade m_TagString: Untagged @@ -120,15 +119,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 94153367f2364ab38597c8f4a6521909, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &6293070509487257227 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7385886653159515755} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 94153367f2364ab38597c8f4a6521909, type: 3} - m_Name: - m_EditorClassIdentifier: diff --git a/Assets/Resources/Ammo/GoldenBombUpgrade.prefab b/Assets/Resources/Ammo/GoldenBombUpgrade.prefab new file mode 100644 index 0000000..12957c4 --- /dev/null +++ b/Assets/Resources/Ammo/GoldenBombUpgrade.prefab @@ -0,0 +1,121 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4467162782262204990 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5103883358052461890} + - component: {fileID: 3057588250431493961} + - component: {fileID: 234472779121130071} + - component: {fileID: 5391029322786980951} + m_Layer: 0 + m_Name: GoldenBombUpgrade + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5103883358052461890 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467162782262204990} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 226.39688, y: 753.2948, z: -16.29858} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &3057588250431493961 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467162782262204990} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 5b4a5aab9761a49faa85fef071ef948c, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &234472779121130071 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467162782262204990} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 13e9051b005746efb7e4ab749d62ad03, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!61 &5391029322786980951 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4467162782262204990} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0.5, y: 0.5} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 1, y: 1} + newSize: {x: 1, y: 1} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1, y: 1} + m_EdgeRadius: 0 diff --git a/Assets/Resources/Ammo/GoldenBombUpgrade.prefab.meta b/Assets/Resources/Ammo/GoldenBombUpgrade.prefab.meta new file mode 100644 index 0000000..f6a2186 --- /dev/null +++ b/Assets/Resources/Ammo/GoldenBombUpgrade.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f981d1f62161f491eb8e3806305c32a7 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/src/Helpers/PrefabAtlas.cs b/Assets/Scripts/src/Helpers/PrefabAtlas.cs index cd48e83..3ca7ae2 100644 --- a/Assets/Scripts/src/Helpers/PrefabAtlas.cs +++ b/Assets/Scripts/src/Helpers/PrefabAtlas.cs @@ -19,6 +19,8 @@ namespace src.Helpers Resources.Load("Ammo/BombUpgrade"); public static readonly GameObject FlamesIncreaseUpgrade = Resources.Load("Ammo/FlameUpgrade"); + public static readonly GameObject GoldenBombUpgrade = + Resources.Load("GoldenBombUpgrade/FlameUpgrade"); /* Enemies */ public static readonly GameObject GreenEnemy = Resources.Load("Enemies/SnowEnemyRandom"); diff --git a/Assets/Scripts/src/Level/LevelData.cs b/Assets/Scripts/src/Level/LevelData.cs index d105df2..7b227bc 100644 --- a/Assets/Scripts/src/Level/LevelData.cs +++ b/Assets/Scripts/src/Level/LevelData.cs @@ -2,7 +2,6 @@ using src.Helpers; namespace src.Level { - using System; using UnityEngine; namespace src.Level @@ -22,11 +21,16 @@ namespace src.Level public static class LevelResource { private static readonly GameObject[] AllUpgrades = - {PrefabAtlas.FlamesIncreaseUpgrade, PrefabAtlas.BombsIncreaseUpgrade, PrefabAtlas.SpeedIncreaseUpgrade}; + { + PrefabAtlas.FlamesIncreaseUpgrade, PrefabAtlas.BombsIncreaseUpgrade, PrefabAtlas.SpeedIncreaseUpgrade, + PrefabAtlas.GoldenBombUpgrade + }; + private static readonly GameObject[] SnowWallsDestructible = {PrefabAtlas.DestructibleSnow, PrefabAtlas.DestructibleHighSnow}; + private static readonly GameObject[] SnowWallsIndestructible = {PrefabAtlas.IndestructibleWoodCrate}; - + /* Used to store information about the level. */ private static readonly LevelData[] LevelData = { diff --git a/Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs b/Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs new file mode 100644 index 0000000..afb993e --- /dev/null +++ b/Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs @@ -0,0 +1,15 @@ +using src.Base; + +namespace src.Upgrade +{ + /* Adds one firepower and one bomb. */ + public class GoldenBombUpgrade : UpgradeBase + { + public override void PerformUpgrade() + { + var bombManager = GameManager.GetBombsUtilManager(); + bombManager.IncreaseAllowedBombs(); + bombManager.IncreasePower(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs.meta b/Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs.meta new file mode 100644 index 0000000..6a5b107 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/GoldenBombUpgrade.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 13e9051b005746efb7e4ab749d62ad03 +timeCreated: 1566031123 \ No newline at end of file