Implement LevelData progression
This commit is contained in:
parent
391af7efb2
commit
de3ea0e294
65 changed files with 135 additions and 295 deletions
|
@ -1,6 +1,7 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b7e3d2e65cd1840089ccdb548a440e87
|
guid: 9707b5b706df4460bbc6cda55152ee98
|
||||||
PrefabImporter:
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
8
Assets/DevMocks/Resources/DevMocks.meta
Normal file
8
Assets/DevMocks/Resources/DevMocks.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f1b9b3e206dfd47df84c2567ac76022b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,174 +0,0 @@
|
||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!1 &2899889047683555164
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 6637306046394798484}
|
|
||||||
- component: {fileID: 2675033481556760561}
|
|
||||||
- component: {fileID: 5245497846486186022}
|
|
||||||
- component: {fileID: 7475857772367562264}
|
|
||||||
m_Layer: 8
|
|
||||||
m_Name: bman_destructible_wall2exp
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &6637306046394798484
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2899889047683555164}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 3.96, y: -1.07, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 0}
|
|
||||||
m_Children:
|
|
||||||
- {fileID: 1878121175747991472}
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!50 &2675033481556760561
|
|
||||||
Rigidbody2D:
|
|
||||||
serializedVersion: 4
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2899889047683555164}
|
|
||||||
m_BodyType: 2
|
|
||||||
m_Simulated: 1
|
|
||||||
m_UseFullKinematicContacts: 0
|
|
||||||
m_UseAutoMass: 0
|
|
||||||
m_Mass: 1
|
|
||||||
m_LinearDrag: 0
|
|
||||||
m_AngularDrag: 0.05
|
|
||||||
m_GravityScale: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_Interpolate: 0
|
|
||||||
m_SleepingMode: 1
|
|
||||||
m_CollisionDetection: 0
|
|
||||||
m_Constraints: 0
|
|
||||||
--- !u!61 &5245497846486186022
|
|
||||||
BoxCollider2D:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2899889047683555164}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Density: 1
|
|
||||||
m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_UsedByEffector: 0
|
|
||||||
m_UsedByComposite: 0
|
|
||||||
m_Offset: {x: 0.51631534, y: 0.55982304}
|
|
||||||
m_SpriteTilingProperty:
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
pivot: {x: 0, y: 0}
|
|
||||||
oldSize: {x: 0, y: 0}
|
|
||||||
newSize: {x: 0, y: 0}
|
|
||||||
adaptiveTilingThreshold: 0
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 0.9673693, y: 0.98912334}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!114 &7475857772367562264
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2899889047683555164}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: b30e7124fcdf4e1f92fc7dd42d8c7298, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!1 &5530905156088972342
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1878121175747991472}
|
|
||||||
- component: {fileID: 2525467942923604880}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Sprite
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &1878121175747991472
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5530905156088972342}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: -0.34, y: -0.15, z: 0}
|
|
||||||
m_LocalScale: {x: 1.724866, y: 1.7598268, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 6637306046394798484}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!212 &2525467942923604880
|
|
||||||
SpriteRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 5530905156088972342}
|
|
||||||
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: 2c89c5592e07249fd8d1f49c0e5a125e, 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
|
|
Binary file not shown.
Before Width: | Height: | Size: 373 B |
|
@ -1,99 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 98d73a0d91287d34ea2ede695d239f4f
|
|
||||||
TextureImporter:
|
|
||||||
fileIDToRecycleName: {}
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 9
|
|
||||||
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: -1
|
|
||||||
aniso: -1
|
|
||||||
mipBias: -100
|
|
||||||
wrapU: 1
|
|
||||||
wrapV: 1
|
|
||||||
wrapW: 1
|
|
||||||
nPOTScale: 0
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 1
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 6
|
|
||||||
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: 2
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
- serializedVersion: 2
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites: []
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID: 62b1ac1cb6a320140ac9bd5e9b091023
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
spritePackingTag:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
pSDShowRemoveMatteOption: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -63,12 +63,6 @@ MonoBehaviour:
|
||||||
startPosition: {fileID: 0}
|
startPosition: {fileID: 0}
|
||||||
indestructibleWallPrefab: {fileID: 5996206011854593075, guid: 84b92ac1e96d940bda97d1b1125887d7,
|
indestructibleWallPrefab: {fileID: 5996206011854593075, guid: 84b92ac1e96d940bda97d1b1125887d7,
|
||||||
type: 3}
|
type: 3}
|
||||||
destructibleWallPrefabs:
|
|
||||||
- {fileID: 4177940729222266681, guid: da559e681f8d34d58bb5f3457045664a, type: 3}
|
|
||||||
- {fileID: 8729402555587492036, guid: 7e54504f1e1de4334be2e6a115b838c2, type: 3}
|
|
||||||
enemiesPrefab:
|
|
||||||
- {fileID: 4346602752014574748, guid: e719de70e335f4e49ae40cc6731309d4, type: 3}
|
|
||||||
- {fileID: 7795087027144463245, guid: fe8fb4e4a7e127648b306469b723d81e, type: 3}
|
|
||||||
--- !u!114 &6316647355651322741
|
--- !u!114 &6316647355651322741
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -81,7 +75,3 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: e64481d2e18e4b6ca4f22926a5061450, type: 3}
|
m_Script: {fileID: 11500000, guid: e64481d2e18e4b6ca4f22926a5061450, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
upgradePrefabs:
|
|
||||||
- {fileID: 4242909486338491383, guid: c0bd5085d71f847b19df326a2fbcf069, type: 3}
|
|
||||||
- {fileID: 7385886653159515755, guid: ba0e1f9d79914426ba805d871bcad311, type: 3}
|
|
||||||
- {fileID: 2377911311221568072, guid: 6d6a8eb6810cd4483a761f7b02fff67f, type: 3}
|
|
27
Assets/Scripts/src/Helpers/PrefabAtlas.cs
Normal file
27
Assets/Scripts/src/Helpers/PrefabAtlas.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace src.Helpers
|
||||||
|
{
|
||||||
|
public static class PrefabAtlas
|
||||||
|
{
|
||||||
|
/* Snow Walls */
|
||||||
|
public static readonly GameObject DestructibleHighSnow =
|
||||||
|
Resources.Load<GameObject>("Walls/destructible_high_snow");
|
||||||
|
public static readonly GameObject DestructibleSnow =
|
||||||
|
Resources.Load<GameObject>("Walls/destructible_snow");
|
||||||
|
public static readonly GameObject IndestructibleWoodCrate =
|
||||||
|
Resources.Load<GameObject>("Walls/indestructible_crate");
|
||||||
|
|
||||||
|
/* Upgrades */
|
||||||
|
public static readonly GameObject SpeedIncreaseUpgrade =
|
||||||
|
Resources.Load<GameObject>("DevMocks/SpeedUpgrade");
|
||||||
|
public static readonly GameObject BombsIncreaseUpgrade =
|
||||||
|
Resources.Load<GameObject>("DevMocks/BombsUpgrade");
|
||||||
|
public static readonly GameObject FlamesIncreaseUpgrade =
|
||||||
|
Resources.Load<GameObject>("DevMocks/FlameUpgrade");
|
||||||
|
|
||||||
|
/* Enemies */
|
||||||
|
public static readonly GameObject GreenEnemy = Resources.Load<GameObject>("DevMocks/Dumber");
|
||||||
|
public static readonly GameObject RedEnemy = Resources.Load<GameObject>("DevMocks/Dumb");
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/src/Helpers/PrefabAtlas.cs.meta
Normal file
3
Assets/Scripts/src/Helpers/PrefabAtlas.cs.meta
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7b381249f5dc4f8f972d66f5d6296478
|
||||||
|
timeCreated: 1564336008
|
3
Assets/Scripts/src/Level.meta
Normal file
3
Assets/Scripts/src/Level.meta
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: daae435e61b34b42a62a266cf7d71824
|
||||||
|
timeCreated: 1564331113
|
55
Assets/Scripts/src/Level/LevelData.cs
Normal file
55
Assets/Scripts/src/Level/LevelData.cs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
using src.Helpers;
|
||||||
|
|
||||||
|
namespace src.Level
|
||||||
|
{
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace src.Level
|
||||||
|
{
|
||||||
|
public struct LevelData
|
||||||
|
{
|
||||||
|
public int levelNumber;
|
||||||
|
public Count destructibleWallCount;
|
||||||
|
public Count upgradeCount;
|
||||||
|
public Count enemyCount;
|
||||||
|
public GameObject[] enemiesPrefab;
|
||||||
|
public GameObject[] upgradesPrefab;
|
||||||
|
public GameObject[] destructibleWallsPrefab;
|
||||||
|
public GameObject[] indestructibleWallsPrefab;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class LevelResource
|
||||||
|
{
|
||||||
|
private static readonly GameObject[] AllUpgrades =
|
||||||
|
{PrefabAtlas.FlamesIncreaseUpgrade, PrefabAtlas.BombsIncreaseUpgrade, PrefabAtlas.SpeedIncreaseUpgrade};
|
||||||
|
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 =
|
||||||
|
{
|
||||||
|
new LevelData
|
||||||
|
{
|
||||||
|
levelNumber = 1,
|
||||||
|
destructibleWallCount = new Count(150, 250),
|
||||||
|
upgradeCount = new Count(0, 5),
|
||||||
|
enemyCount = new Count(20, 50),
|
||||||
|
enemiesPrefab = new[] {PrefabAtlas.GreenEnemy, PrefabAtlas.RedEnemy},
|
||||||
|
upgradesPrefab = AllUpgrades,
|
||||||
|
destructibleWallsPrefab = SnowWallsDestructible,
|
||||||
|
indestructibleWallsPrefab = SnowWallsIndestructible
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return data from level data, if it overflows, reset index.
|
||||||
|
*/
|
||||||
|
public static LevelData GetLevelData(int level)
|
||||||
|
{
|
||||||
|
return LevelData[level % LevelData.Length];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/src/Level/LevelData.cs.meta
Normal file
3
Assets/Scripts/src/Level/LevelData.cs.meta
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c1fa3937b5264f67b7151b31ab8a70ec
|
||||||
|
timeCreated: 1564331120
|
|
@ -1,12 +1,13 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using src.Base;
|
using src.Base;
|
||||||
using src.Helpers;
|
using src.Helpers;
|
||||||
|
using src.Level.src.Level;
|
||||||
|
using src.Managers;
|
||||||
using src.Wall;
|
using src.Wall;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
namespace src.Managers
|
namespace src.Level
|
||||||
{
|
{
|
||||||
public class LevelManager : GameplayComponent
|
public class LevelManager : GameplayComponent
|
||||||
{
|
{
|
||||||
|
@ -30,12 +31,12 @@ namespace src.Managers
|
||||||
|
|
||||||
/* Used to group spawned objects */
|
/* Used to group spawned objects */
|
||||||
public Transform boardHolder;
|
public Transform boardHolder;
|
||||||
|
|
||||||
/* Holds the starting position of the player */
|
/* Holds the starting position of the player */
|
||||||
public Transform startPosition;
|
public Transform startPosition;
|
||||||
|
/* Holds references to prefabs for the specified level. */
|
||||||
public GameObject indestructibleWallPrefab;
|
public GameObject indestructibleWallPrefab;
|
||||||
public GameObject[] destructibleWallPrefabs;
|
private GameObject[] _destructibleWallPrefabs;
|
||||||
public GameObject[] enemiesPrefab;
|
private GameObject[] _enemiesPrefab;
|
||||||
|
|
||||||
/* Specifies how many objects we want per level. */
|
/* Specifies how many objects we want per level. */
|
||||||
private Count _destructibleWallCount = new Count(150, 350);
|
private Count _destructibleWallCount = new Count(150, 350);
|
||||||
|
@ -55,6 +56,15 @@ namespace src.Managers
|
||||||
/* Singletons */
|
/* Singletons */
|
||||||
private GameStateManager _gameStateManager = GameStateManager.Instance;
|
private GameStateManager _gameStateManager = GameStateManager.Instance;
|
||||||
|
|
||||||
|
public void SetLevelData(LevelData levelData)
|
||||||
|
{
|
||||||
|
_destructibleWallCount = levelData.destructibleWallCount;
|
||||||
|
_upgradesCount = levelData.upgradeCount;
|
||||||
|
_enemyCount = levelData.enemyCount;
|
||||||
|
_enemiesPrefab = levelData.enemiesPrefab;
|
||||||
|
_destructibleWallPrefabs = levelData.destructibleWallsPrefab;
|
||||||
|
}
|
||||||
|
|
||||||
/* Modifies walls from _destructibleWalls in order to setup upgrades*/
|
/* Modifies walls from _destructibleWalls in order to setup upgrades*/
|
||||||
private void SetupSpawnables()
|
private void SetupSpawnables()
|
||||||
{
|
{
|
||||||
|
@ -151,7 +161,7 @@ namespace src.Managers
|
||||||
private void PlaceDestructibleTile(Vector3 position)
|
private void PlaceDestructibleTile(Vector3 position)
|
||||||
{
|
{
|
||||||
DebugHelper.LogVerbose($"PlaceDestructibleTile: x:{position.x} y:{position.y}");
|
DebugHelper.LogVerbose($"PlaceDestructibleTile: x:{position.x} y:{position.y}");
|
||||||
var randomWall = destructibleWallPrefabs.ChoseRandom();
|
var randomWall = _destructibleWallPrefabs.ChoseRandom();
|
||||||
var instance = Instantiate(randomWall, position, Quaternion.identity);
|
var instance = Instantiate(randomWall, position, Quaternion.identity);
|
||||||
_destructibleWalls.Add(instance);
|
_destructibleWalls.Add(instance);
|
||||||
instance.transform.SetParent(boardHolder);
|
instance.transform.SetParent(boardHolder);
|
||||||
|
@ -194,7 +204,7 @@ namespace src.Managers
|
||||||
private bool PlaceEnemy(Vector3 position)
|
private bool PlaceEnemy(Vector3 position)
|
||||||
{
|
{
|
||||||
DebugHelper.LogVerbose($"PlaceEnemy: x:{position.x} y:{position.y}");
|
DebugHelper.LogVerbose($"PlaceEnemy: x:{position.x} y:{position.y}");
|
||||||
var randomEnemy = enemiesPrefab.ChoseRandom();
|
var randomEnemy = _enemiesPrefab.ChoseRandom();
|
||||||
var instance = Instantiate(randomEnemy, position, Quaternion.identity);
|
var instance = Instantiate(randomEnemy, position, Quaternion.identity);
|
||||||
_enemies.Add(instance);
|
_enemies.Add(instance);
|
||||||
instance.transform.SetParent(boardHolder);
|
instance.transform.SetParent(boardHolder);
|
|
@ -1,5 +1,8 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using src.Ammo;
|
||||||
using src.Helpers;
|
using src.Helpers;
|
||||||
|
using src.Level;
|
||||||
|
using src.Level.src.Level;
|
||||||
using src.Player;
|
using src.Player;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
@ -48,7 +51,11 @@ namespace src.Managers
|
||||||
|
|
||||||
private void StartLevel()
|
private void StartLevel()
|
||||||
{
|
{
|
||||||
|
var levelData = LevelResource.GetLevelData(_gameStateManager.Level);
|
||||||
StartCoroutine(PreInitGame());
|
StartCoroutine(PreInitGame());
|
||||||
|
_levelManager.SetLevelData(levelData);
|
||||||
|
_upgradeManager.SetLevelData(levelData);
|
||||||
|
|
||||||
_levelManager.InitLevel();
|
_levelManager.InitLevel();
|
||||||
_playerController.Respawn();
|
_playerController.Respawn();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using src.Base;
|
using src.Base;
|
||||||
using src.Helpers;
|
using src.Helpers;
|
||||||
|
using src.Level.src.Level;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace src.Managers
|
namespace src.Managers
|
||||||
|
@ -10,7 +11,7 @@ namespace src.Managers
|
||||||
{
|
{
|
||||||
public static UpgradeManager Instance;
|
public static UpgradeManager Instance;
|
||||||
private List<GameObject> _unclaimedUpgrades = new List<GameObject>();
|
private List<GameObject> _unclaimedUpgrades = new List<GameObject>();
|
||||||
public GameObject[] upgradePrefabs;
|
private GameObject[] _upgradePrefabs;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
@ -24,9 +25,14 @@ namespace src.Managers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLevelData(LevelData levelData)
|
||||||
|
{
|
||||||
|
_upgradePrefabs = levelData.upgradesPrefab;
|
||||||
|
}
|
||||||
|
|
||||||
public GameObject GetUpgradePrefab()
|
public GameObject GetUpgradePrefab()
|
||||||
{
|
{
|
||||||
return upgradePrefabs.ChoseRandom();
|
return _upgradePrefabs.ChoseRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register unclaimed upgrades so then can be destroyed on level changed or other events. */
|
/* Register unclaimed upgrades so then can be destroyed on level changed or other events. */
|
||||||
|
|
Loading…
Reference in a new issue