Implement Speed, Bombs and Flames upgrade

This commit is contained in:
Denis-Cosmin Nutiu 2019-06-23 15:15:37 +03:00
parent ae09d98a3b
commit 70a977ac09
18 changed files with 453 additions and 13 deletions

View file

@ -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:

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6d6a8eb6810cd4483a761f7b02fff67f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ba0e1f9d79914426ba805d871bcad311
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c0bd5085d71f847b19df326a2fbcf069
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -37,5 +37,10 @@ namespace src.Base
{
DebugHelper.LogInfo("Player hit by enemy");
}
public void IncreaseSpeed(float speed)
{
movementSpeed += speed;
}
}
}

View file

@ -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);

View file

@ -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<LevelManager>();
_upgradeManager = GetComponent<UpgradeManager>();
_bombsUtilManager = BombsUtilManager.Instance;
InitGame();
}
@ -33,6 +35,11 @@ namespace src.Managers
return _upgradeManager;
}
public BombsUtilManager GetBombsUtilManager()
{
return _bombsUtilManager;
}
private void InitGame()
{
_levelManager.InitLevel();

View file

@ -0,0 +1,11 @@
namespace src.Upgrade
{
public class BombFlamesUpgrade : UpgradeBase
{
public override void PerformUpgrade()
{
var bombManager = gameManager.GetBombsUtilManager();
bombManager.IncreasePower();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 94153367f2364ab38597c8f4a6521909
timeCreated: 1561283550

View file

@ -0,0 +1,11 @@
namespace src.Upgrade
{
public class BombPlacementUpgrade : UpgradeBase
{
public override void PerformUpgrade()
{
var bombManager = gameManager.GetBombsUtilManager();
bombManager.IncreaseAllowedBombs();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7fd512904859421b9f2b6420aa955d9a
timeCreated: 1561283568

View file

@ -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<PlayerController>();
player.IncreaseSpeed(.5f);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0b8c723aa8c7476789cbee67fcadfbef
timeCreated: 1561283202

View file

@ -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!");
}
}
}

View file

@ -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);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: be2063b5b2df4c0b884f11a7ee5e3380
timeCreated: 1561283281