diff --git a/Assets/DevMocks/BombsUpgrade.prefab b/Assets/DevMocks/BombsUpgrade.prefab new file mode 100644 index 0000000..8dc626b --- /dev/null +++ b/Assets/DevMocks/BombsUpgrade.prefab @@ -0,0 +1,121 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2377911311221568072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7980903176349258245} + - component: {fileID: 6699440875015304414} + - component: {fileID: 7875732231624854186} + - component: {fileID: 7738746775589240714} + m_Layer: 0 + m_Name: BombsUpgrade + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7980903176349258245 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2377911311221568072} + 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: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &6699440875015304414 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2377911311221568072} + 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: 753e29d30d8044605aede9853c9308c7, type: 3} + m_Color: {r: 0.9485793, g: 0, 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!61 &7875732231624854186 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2377911311221568072} + 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 +--- !u!114 &7738746775589240714 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2377911311221568072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7fd512904859421b9f2b6420aa955d9a, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/DevMocks/BombsUpgrade.prefab.meta b/Assets/DevMocks/BombsUpgrade.prefab.meta new file mode 100644 index 0000000..c4e5efe --- /dev/null +++ b/Assets/DevMocks/BombsUpgrade.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6d6a8eb6810cd4483a761f7b02fff67f +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/DevMocks/FlameUpgrade.prefab b/Assets/DevMocks/FlameUpgrade.prefab new file mode 100644 index 0000000..3f00305 --- /dev/null +++ b/Assets/DevMocks/FlameUpgrade.prefab @@ -0,0 +1,108 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7385886653159515755 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 685382037628668327} + - component: {fileID: 7037551310800415105} + - component: {fileID: 7958292204112110464} + m_Layer: 0 + m_Name: FlameUpgrade + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &685382037628668327 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7385886653159515755} + 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: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7037551310800415105 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7385886653159515755} + 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: 753e29d30d8044605aede9853c9308c7, type: 3} + m_Color: {r: 1, g: 0.1812256, b: 0, 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!61 &7958292204112110464 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7385886653159515755} + 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/DevMocks/FlameUpgrade.prefab.meta b/Assets/DevMocks/FlameUpgrade.prefab.meta new file mode 100644 index 0000000..75482cd --- /dev/null +++ b/Assets/DevMocks/FlameUpgrade.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ba0e1f9d79914426ba805d871bcad311 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/DevMocks/SpeedUpgrade.prefab b/Assets/DevMocks/SpeedUpgrade.prefab new file mode 100644 index 0000000..5c56ba5 --- /dev/null +++ b/Assets/DevMocks/SpeedUpgrade.prefab @@ -0,0 +1,108 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4242909486338491383 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5958400204756161002} + - component: {fileID: 7382262205660184478} + - component: {fileID: 2747432428292150867} + m_Layer: 0 + m_Name: SpeedUpgrade + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5958400204756161002 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4242909486338491383} + 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: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7382262205660184478 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4242909486338491383} + 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: 753e29d30d8044605aede9853c9308c7, type: 3} + m_Color: {r: 0.97521883, g: 0.9811321, b: 0, 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!61 &2747432428292150867 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4242909486338491383} + 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/DevMocks/SpeedUpgrade.prefab.meta b/Assets/DevMocks/SpeedUpgrade.prefab.meta new file mode 100644 index 0000000..2d8acbc --- /dev/null +++ b/Assets/DevMocks/SpeedUpgrade.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c0bd5085d71f847b19df326a2fbcf069 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/src/Base/PlayerBase.cs b/Assets/Scripts/src/Base/PlayerBase.cs index 02823a1..2009d37 100644 --- a/Assets/Scripts/src/Base/PlayerBase.cs +++ b/Assets/Scripts/src/Base/PlayerBase.cs @@ -37,5 +37,10 @@ namespace src.Base { DebugHelper.LogInfo("Player hit by enemy"); } + + public void IncreaseSpeed(float speed) + { + movementSpeed += speed; + } } } \ No newline at end of file diff --git a/Assets/Scripts/src/Managers/BombsUtilManager.cs b/Assets/Scripts/src/Managers/BombsUtilManager.cs index 2091465..3935c5d 100644 --- a/Assets/Scripts/src/Managers/BombsUtilManager.cs +++ b/Assets/Scripts/src/Managers/BombsUtilManager.cs @@ -36,7 +36,7 @@ namespace src.Managers public void IncreaseAllowedBombs() { - if(AllowedBombs <= MaxAllowedBombs) + if (AllowedBombs <= MaxAllowedBombs) { AllowedBombs++; } @@ -44,7 +44,7 @@ namespace src.Managers public void PlaceBomb(Vector3 position) { - if(CanPlaceBomb(position)) + if (CanPlaceBomb(position)) { PlacedBombs++; _usedPosition.Add(position); @@ -53,7 +53,7 @@ namespace src.Managers public void RemoveBomb(Vector3 position) { - if(_usedPosition.Contains(position)) + if (_usedPosition.Contains(position)) { PlacedBombs--; _usedPosition.Remove(position); diff --git a/Assets/Scripts/src/Managers/GameManager.cs b/Assets/Scripts/src/Managers/GameManager.cs index 0ab7350..5f4ba61 100644 --- a/Assets/Scripts/src/Managers/GameManager.cs +++ b/Assets/Scripts/src/Managers/GameManager.cs @@ -7,6 +7,7 @@ namespace src.Managers public static GameManager Instance; private LevelManager _levelManager; private UpgradeManager _upgradeManager; + private BombsUtilManager _bombsUtilManager; public void Awake() { @@ -24,6 +25,7 @@ namespace src.Managers _levelManager = GetComponent(); _upgradeManager = GetComponent(); + _bombsUtilManager = BombsUtilManager.Instance; InitGame(); } @@ -33,6 +35,11 @@ namespace src.Managers return _upgradeManager; } + public BombsUtilManager GetBombsUtilManager() + { + return _bombsUtilManager; + } + private void InitGame() { _levelManager.InitLevel(); diff --git a/Assets/Scripts/src/Upgrade/BombFlamesUpgrade.cs b/Assets/Scripts/src/Upgrade/BombFlamesUpgrade.cs new file mode 100644 index 0000000..110f877 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/BombFlamesUpgrade.cs @@ -0,0 +1,11 @@ +namespace src.Upgrade +{ + public class BombFlamesUpgrade : UpgradeBase + { + public override void PerformUpgrade() + { + var bombManager = gameManager.GetBombsUtilManager(); + bombManager.IncreasePower(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/BombFlamesUpgrade.cs.meta b/Assets/Scripts/src/Upgrade/BombFlamesUpgrade.cs.meta new file mode 100644 index 0000000..b457338 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/BombFlamesUpgrade.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 94153367f2364ab38597c8f4a6521909 +timeCreated: 1561283550 \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/BombPlacementUpgrade.cs b/Assets/Scripts/src/Upgrade/BombPlacementUpgrade.cs new file mode 100644 index 0000000..3e7b770 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/BombPlacementUpgrade.cs @@ -0,0 +1,11 @@ +namespace src.Upgrade +{ + public class BombPlacementUpgrade : UpgradeBase + { + public override void PerformUpgrade() + { + var bombManager = gameManager.GetBombsUtilManager(); + bombManager.IncreaseAllowedBombs(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/BombPlacementUpgrade.cs.meta b/Assets/Scripts/src/Upgrade/BombPlacementUpgrade.cs.meta new file mode 100644 index 0000000..692bf64 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/BombPlacementUpgrade.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7fd512904859421b9f2b6420aa955d9a +timeCreated: 1561283568 \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/PlayerSpeedUpgrade.cs b/Assets/Scripts/src/Upgrade/PlayerSpeedUpgrade.cs new file mode 100644 index 0000000..7ec3ab4 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/PlayerSpeedUpgrade.cs @@ -0,0 +1,15 @@ +using src.Player; +using UnityEngine; + +namespace src.Upgrade +{ + public class PlayerSpeedUpgrade : UpgradeBase + { + public override void PerformUpgrade() + { + /* TODO: Refactor to use a player manager. */ + var player = GameObject.Find("Player").GetComponent(); + player.IncreaseSpeed(.5f); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/PlayerSpeedUpgrade.cs.meta b/Assets/Scripts/src/Upgrade/PlayerSpeedUpgrade.cs.meta new file mode 100644 index 0000000..56eef9e --- /dev/null +++ b/Assets/Scripts/src/Upgrade/PlayerSpeedUpgrade.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0b8c723aa8c7476789cbee67fcadfbef +timeCreated: 1561283202 \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/TestUpgrade.cs b/Assets/Scripts/src/Upgrade/TestUpgrade.cs index 55971cc..07fb37e 100644 --- a/Assets/Scripts/src/Upgrade/TestUpgrade.cs +++ b/Assets/Scripts/src/Upgrade/TestUpgrade.cs @@ -5,19 +5,11 @@ using UnityEngine; namespace src.Upgrade { - public class TestUpgrade : GameplayComponent, IUpgrade + public class TestUpgrade : UpgradeBase { public void PerformUpgrade() { - DebugHelper.LogError("Test upgrade works."); - } - - public void OnTriggerEnter2D(Collider2D other) - { - if (!other.CompareTag("Player")) return; - - DebugHelper.LogWarning("TestUpgrade WORKS!"); - Destroy(gameObject); + DebugHelper.LogWarning("Test upgrade works!"); } } } \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/UpgradeBase.cs b/Assets/Scripts/src/Upgrade/UpgradeBase.cs new file mode 100644 index 0000000..2286e75 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/UpgradeBase.cs @@ -0,0 +1,29 @@ +using src.Base; +using src.Interfaces; +using src.Managers; +using UnityEngine; + +namespace src.Upgrade +{ + public class UpgradeBase : GameplayComponent, IUpgrade + { + protected GameManager gameManager; + + public void Start() + { + gameManager = GameManager.Instance; + } + + public virtual void PerformUpgrade() + { + throw new System.NotImplementedException(); + } + + public void OnTriggerEnter2D(Collider2D other) + { + if (!other.CompareTag("Player")) return; + PerformUpgrade(); + Destroy(gameObject); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Upgrade/UpgradeBase.cs.meta b/Assets/Scripts/src/Upgrade/UpgradeBase.cs.meta new file mode 100644 index 0000000..5506814 --- /dev/null +++ b/Assets/Scripts/src/Upgrade/UpgradeBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: be2063b5b2df4c0b884f11a7ee5e3380 +timeCreated: 1561283281 \ No newline at end of file