fixes to berry harvesting

- berry harvester appears on bush tiles
- change berry resource for food instead
- some structural change to reduce bugs
This commit is contained in:
Felix Boucher 2023-11-12 18:26:36 -05:00
parent 2a2f0a5a66
commit 7dba305d30
36 changed files with 416 additions and 327 deletions

View File

@ -245,3 +245,7 @@ MonoBehaviour:
_position: {x: 0, y: 0} _position: {x: 0, y: 0}
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
_waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2} _waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
_startPopulation: 5
_startFood: 50
_startWood: 0
_startRock: 0

View File

@ -197,3 +197,7 @@ MonoBehaviour:
_position: {x: 0, y: 0} _position: {x: 0, y: 0}
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
_waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2} _waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
_startPopulation: 5
_startFood: 50
_startWood: 0
_startRock: 0

View File

@ -195,3 +195,7 @@ MonoBehaviour:
_position: {x: 0, y: 0} _position: {x: 0, y: 0}
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
_waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2} _waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
_startPopulation: 5
_startFood: 50
_startWood: 0
_startRock: 0

View File

@ -225,3 +225,7 @@ MonoBehaviour:
_position: {x: 0, y: 0} _position: {x: 0, y: 0}
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
_waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2} _waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
_startPopulation: 5
_startFood: 50
_startWood: 0
_startRock: 0

View File

@ -181,6 +181,8 @@ MonoBehaviour:
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
- _key: Spawners - _key: Spawners
_tiles: _tiles:
- _tile: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
_position: {x: -6, y: -1, z: 0}
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2} - _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
_position: {x: -1, y: -3, z: 0} _position: {x: -1, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2} - _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
@ -201,3 +203,7 @@ MonoBehaviour:
_position: {x: 0, y: 0} _position: {x: 0, y: 0}
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
_waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2} _waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
_startPopulation: 5
_startFood: 50
_startWood: 0
_startRock: 0

View File

@ -164,6 +164,10 @@ MonoBehaviour:
_position: {x: -7, y: 1, z: 0} _position: {x: -7, y: 1, z: 0}
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2} - _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
_position: {x: -6, y: 1, z: 0} _position: {x: -6, y: 1, z: 0}
- _tile: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
_position: {x: -5, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
_position: {x: -5, y: -1, z: 0}
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2} - _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
_position: {x: -5, y: 1, z: 0} _position: {x: -5, y: 1, z: 0}
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2} - _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
@ -203,3 +207,7 @@ MonoBehaviour:
_position: {x: 0, y: 0} _position: {x: 0, y: 0}
_scale: {x: 1, y: 1} _scale: {x: 1, y: 1}
_waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2} _waveConfig: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
_startPopulation: 5
_startFood: 50
_startWood: 0
_startRock: 0

View File

@ -17,6 +17,8 @@ public class DatabaseEditor : Editor
{ {
var targ = target as Database; var targ = target as Database;
targ.ScriptableObjects.Clear();
targ.Prefabs.Clear();
foreach (var folder in targ.Folders) foreach (var folder in targ.Folders)
{ {
var path = AssetDatabase.GetAssetPath(folder); var path = AssetDatabase.GetAssetPath(folder);

View File

@ -424,7 +424,9 @@ MonoBehaviour:
_resource: 0 _resource: 0
- _harvesterPrefab: {fileID: 6962989255644195630} - _harvesterPrefab: {fileID: 6962989255644195630}
_resource: 1 _resource: 1
_resourceChoice: 1 - _harvesterPrefab: {fileID: 7670155643566295935, guid: 717a063ebb684a748b9f40cac33fab52, type: 3}
_resource: 3
_resourceNodeType: 1
--- !u!114 &557712884815233717 --- !u!114 &557712884815233717
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1025,9 +1025,11 @@ MonoBehaviour:
_resource: 2 _resource: 2
- _harvesterPrefab: {fileID: 6962989255644195630, guid: 8b50d9afb3bbd204d8dfea3d64f13fa2, type: 3} - _harvesterPrefab: {fileID: 6962989255644195630, guid: 8b50d9afb3bbd204d8dfea3d64f13fa2, type: 3}
_resource: 0 _resource: 0
- _harvesterPrefab: {fileID: 7670155643566295935} - _harvesterPrefab: {fileID: 6962989255644195630, guid: 02eb2d787f58e9943a0cb46d0b13e6b8, type: 3}
_resource: 1 _resource: 1
_resourceChoice: 1 - _harvesterPrefab: {fileID: 7670155643566295935}
_resource: 3
_resourceNodeType: 3
--- !u!114 &967491981311779556 --- !u!114 &967491981311779556
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -407,7 +407,7 @@ MonoBehaviour:
_hp: 0 _hp: 0
_speed: 0 _speed: 0
_attack_damage: 0 _attack_damage: 0
_attack_interval: 2 _attack_interval: 0
_harvesterResourcePairs: _harvesterResourcePairs:
- _harvesterPrefab: {fileID: 5157279992115123224} - _harvesterPrefab: {fileID: 5157279992115123224}
_resource: 2 _resource: 2
@ -415,7 +415,9 @@ MonoBehaviour:
_resource: 0 _resource: 0
- _harvesterPrefab: {fileID: 6962989255644195630, guid: 02eb2d787f58e9943a0cb46d0b13e6b8, type: 3} - _harvesterPrefab: {fileID: 6962989255644195630, guid: 02eb2d787f58e9943a0cb46d0b13e6b8, type: 3}
_resource: 1 _resource: 1
_resourceChoice: 2 - _harvesterPrefab: {fileID: 7670155643566295935, guid: 717a063ebb684a748b9f40cac33fab52, type: 3}
_resource: 3
_resourceNodeType: 2
--- !u!114 &4198250345843206422 --- !u!114 &4198250345843206422
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -508,6 +508,8 @@ MonoBehaviour:
_resource: 0 _resource: 0
- _harvesterPrefab: {fileID: 6962989255644195630, guid: 02eb2d787f58e9943a0cb46d0b13e6b8, type: 3} - _harvesterPrefab: {fileID: 6962989255644195630, guid: 02eb2d787f58e9943a0cb46d0b13e6b8, type: 3}
_resource: 1 _resource: 1
- _harvesterPrefab: {fileID: 7670155643566295935, guid: 717a063ebb684a748b9f40cac33fab52, type: 3}
_resource: 3
_resourceChoice: 0 _resourceChoice: 0
--- !u!114 &8773193872037819055 --- !u!114 &8773193872037819055
MonoBehaviour: MonoBehaviour:

View File

@ -1,221 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6962989255644195630
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6962989255644195631}
- component: {fileID: 6072713849781841816}
- component: {fileID: -1491803373025033585}
- component: {fileID: 2238237770060079311}
- component: {fileID: 3600016298306940116}
m_Layer: 0
m_Name: yieldBerry
m_TagString: Resource
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6962989255644195631
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -6.61, y: -0.638, z: 1.8112363}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6962989256011107500}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1839735485 &6072713849781841816
Tilemap:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_Enabled: 0
m_Tiles: {}
m_AnimatedTiles: {}
m_TileAssetArray: []
m_TileSpriteArray: []
m_TileMatrixArray: []
m_TileColorArray: []
m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Origin: {x: 0, y: 0, z: 0}
m_Size: {x: 0, y: 0, z: 1}
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
m_TileOrientation: 0
m_TileOrientationMatrix:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
--- !u!50 &-1491803373025033585
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!61 &2238237770060079311
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.05, y: 0.02}
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.3, y: 0.46}
m_EdgeRadius: 0
--- !u!114 &3600016298306940116
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989255644195630}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9dd6bad38b516d64e8e23a5822ca37bb, type: 3}
m_Name:
m_EditorClassIdentifier:
_resourceChoice: 3
_endPosition: {x: -2, y: 5}
--- !u!1 &6962989256011107503
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6962989256011107500}
- component: {fileID: 6962989256011107501}
m_Layer: 0
m_Name: sprite
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6962989256011107500
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989256011107503}
m_LocalRotation: {x: 0, y: -0, z: 0, w: -1}
m_LocalPosition: {x: 0.0259, y: 0.01, z: 0}
m_LocalScale: {x: 0.5394133, y: 0.56488746, z: 0.9686}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6962989255644195631}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 360}
--- !u!212 &6962989256011107501
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6962989256011107503}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
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: 4
m_Sprite: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, 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.06, y: 1.69}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View File

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

View File

@ -1687,6 +1687,158 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: LevelManager value: LevelManager
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _folders.Array.size
value: 4
objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.size
value: 34
objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _folders.Array.data[2]
value:
objectReference: {fileID: 102900000, guid: 73ca1afa7b0f7dd4ea39f69cf74f8370, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _folders.Array.data[3]
value:
objectReference: {fileID: 102900000, guid: 53e5218fbb04cbd478369e415d099bdb, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[22]
value:
objectReference: {fileID: 3688217365857929929, guid: b116bc5489ed8524da52c4dbc835640e, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[23]
value:
objectReference: {fileID: 6208366596957312446, guid: 9b9c2b61b2a2928458af5f15c009b8c4, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[24]
value:
objectReference: {fileID: 3028288566889208744, guid: 02daecb0115395844b4932445d039051, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[25]
value:
objectReference: {fileID: 80204295746100150, guid: 1be769d6ef642314b8846bed35e7297c, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[26]
value:
objectReference: {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[27]
value:
objectReference: {fileID: 2230360378425099702, guid: ece16a59d4dca2246817fbb1b23f17ba, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[28]
value:
objectReference: {fileID: 7670155643566295935, guid: 717a063ebb684a748b9f40cac33fab52, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[29]
value:
objectReference: {fileID: 4897909026855453892, guid: 3918c7d48763f184a92c7d61380ca258, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[30]
value:
objectReference: {fileID: 8433619855353240514, guid: bc81e2a1e8b64884692701c2892f62a4, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[31]
value:
objectReference: {fileID: 3409838768749337993, guid: 096f5f6b487dccb41a48faf69f87fae9, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[32]
value:
objectReference: {fileID: 1388419617042242061, guid: 4a2f48781c26ad247b697aa368358f88, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[33]
value:
objectReference: {fileID: 6962989255644195630, guid: f74ea22a786d3c34cbb77e7522a360f8, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.size
value: 21
objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[3]
value:
objectReference: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[4]
value:
objectReference: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[5]
value:
objectReference: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[6]
value:
objectReference: {fileID: 11400000, guid: a6e34739c9325da4cac4fbaea30d052c, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[7]
value:
objectReference: {fileID: 11400000, guid: d37561e153d6a6448a03839488fdec5e, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[8]
value:
objectReference: {fileID: 11400000, guid: 7a1313e5c16e74c4ba11a8114b9fd786, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[9]
value:
objectReference: {fileID: 11400000, guid: b501f7eea1fdfb843853bcba5b30533a, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[10]
value:
objectReference: {fileID: 11400000, guid: 0a9c94eb38c575948992453fc29bcede, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[11]
value:
objectReference: {fileID: 11400000, guid: 458348dd169e806459b7449b7e157d64, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[12]
value:
objectReference: {fileID: 11400000, guid: f5a11cb6d0d324b47b493042c7615112, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[13]
value:
objectReference: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[14]
value:
objectReference: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[15]
value:
objectReference: {fileID: 11400000, guid: 5f47d74ebc4a8fe439ac6a4fe9ec436f, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[16]
value:
objectReference: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[17]
value:
objectReference: {fileID: 11400000, guid: ec229632b369eb746a30dbfafe3de373, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[18]
value:
objectReference: {fileID: 11400000, guid: 21b0f85f7c746974db1e72f2df646f5d, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[19]
value:
objectReference: {fileID: 11400000, guid: 4c72177270b51eb46872d1665e3a097e, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[20]
value:
objectReference: {fileID: 11400000, guid: d8140ae36f1b7fd4fb1a57ab3dc69de4, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[21]
value:
objectReference: {fileID: 11400000, guid: d8140ae36f1b7fd4fb1a57ab3dc69de4, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[22]
value:
objectReference: {fileID: 11400000, guid: d8140ae36f1b7fd4fb1a57ab3dc69de4, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[23]
value:
objectReference: {fileID: 11400000, guid: d8140ae36f1b7fd4fb1a57ab3dc69de4, type: 2}
- target: {fileID: 3028288566889208750, guid: 02daecb0115395844b4932445d039051, type: 3} - target: {fileID: 3028288566889208750, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _gameScene propertyPath: _gameScene
value: Game value: Game

View File

@ -1204,6 +1204,166 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: LevelManager value: LevelManager
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.size
value: 32
objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _folders.Array.data[2]
value:
objectReference: {fileID: 102900000, guid: 53e5218fbb04cbd478369e415d099bdb, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[0]
value:
objectReference: {fileID: 3688217365857929929, guid: b116bc5489ed8524da52c4dbc835640e, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[1]
value:
objectReference: {fileID: 6962989255644195630, guid: 377c7275c0001cc47a6b8926ac57d573, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[2]
value:
objectReference: {fileID: 6962989255644195630, guid: 869a03bba705e8d4485aa73daad773dc, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[3]
value:
objectReference: {fileID: 1436362432952518814, guid: 8d56b160dedb7f84d830d749372fe8e8, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[4]
value:
objectReference: {fileID: 6208366596957312446, guid: 9b9c2b61b2a2928458af5f15c009b8c4, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[5]
value:
objectReference: {fileID: 3028288566889208744, guid: 02daecb0115395844b4932445d039051, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[6]
value:
objectReference: {fileID: 80204295746100150, guid: 1be769d6ef642314b8846bed35e7297c, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[7]
value:
objectReference: {fileID: 80204295746100150, guid: 5bbf0d85fa5bb3f4599da79f0a84e3a9, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[8]
value:
objectReference: {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[9]
value:
objectReference: {fileID: 5531237550998824024, guid: 6cd87b398e7a0e94580f4fcbe2fd310a, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[10]
value:
objectReference: {fileID: 6962989255644195630, guid: 9b40c232eddfd1b469bea688e3c970c0, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[11]
value:
objectReference: {fileID: 6962989255644195630, guid: e4a4754288971e949a74f90737193702, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[12]
value:
objectReference: {fileID: 2230360378425099702, guid: ece16a59d4dca2246817fbb1b23f17ba, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[13]
value:
objectReference: {fileID: 6962989255644195630, guid: 02eb2d787f58e9943a0cb46d0b13e6b8, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[14]
value:
objectReference: {fileID: 7670155643566295935, guid: 717a063ebb684a748b9f40cac33fab52, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[15]
value:
objectReference: {fileID: 5157279992115123224, guid: 85534a2d6c2add54d864073914646192, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[16]
value:
objectReference: {fileID: 6962989255644195630, guid: 8b50d9afb3bbd204d8dfea3d64f13fa2, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[17]
value:
objectReference: {fileID: 809914571062164693, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[18]
value:
objectReference: {fileID: 4897909026855453892, guid: 3918c7d48763f184a92c7d61380ca258, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[19]
value:
objectReference: {fileID: 8433619855353240514, guid: bc81e2a1e8b64884692701c2892f62a4, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[20]
value:
objectReference: {fileID: 4052934186652138539, guid: 8560e1f66d452b543a705c8a0f3e22fa, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[21]
value:
objectReference: {fileID: 3814095509541806390, guid: 9527f3a1482b90a48bb6c62acc70f986, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[22]
value:
objectReference: {fileID: 907652127959947826, guid: e20680474d73eee49836ff9cbc6d0b28, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[23]
value:
objectReference: {fileID: 907652127959947826, guid: afc444040d3adcf45a882e4882521f5e, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[24]
value:
objectReference: {fileID: 4817988606444742093, guid: 306211cf6348ac747a78d89bd72fca3e, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[25]
value:
objectReference: {fileID: 1893888152770301340, guid: eb25bde5e3c72d34fbc9095e2c83cdb4, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[26]
value:
objectReference: {fileID: 3409838768749337993, guid: 096f5f6b487dccb41a48faf69f87fae9, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[27]
value:
objectReference: {fileID: 1388419617042242061, guid: 4a2f48781c26ad247b697aa368358f88, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[28]
value:
objectReference: {fileID: 3405186844740662670, guid: 074c072b696214a4ba44ff66e9a7d9a6, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[29]
value:
objectReference: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[30]
value:
objectReference: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _prefabs.Array.data[31]
value:
objectReference: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.size
value: 8
objectReference: {fileID: 0}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[0]
value:
objectReference: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[1]
value:
objectReference: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[2]
value:
objectReference: {fileID: 11400000, guid: 15606c8c503e8164fb69178aa7016f58, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[3]
value:
objectReference: {fileID: 11400000, guid: 7568f730b2ba3754297a7612452482e2, type: 2}
- target: {fileID: 3028288566889208749, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: _scriptableObjects.Array.data[4]
value:
objectReference: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
- target: {fileID: 3028288566889208750, guid: 02daecb0115395844b4932445d039051, type: 3} - target: {fileID: 3028288566889208750, guid: 02daecb0115395844b4932445d039051, type: 3}
propertyPath: firstLevel propertyPath: firstLevel
value: value:

View File

@ -6,7 +6,7 @@ public class Harvester : Ally
{ {
[SerializeField] [Tooltip("helps choose the right skin for the harvester depending on resource")] [SerializeField] [Tooltip("helps choose the right skin for the harvester depending on resource")]
private List<HarvesterResourcePair> _harvesterResourcePairs; private List<HarvesterResourcePair> _harvesterResourcePairs;
protected ResourceChoice ResourceChoice => _resourceChoice; protected ResourceNodeType ResourceNodeType => _resourceNodeType;
public override Vector2 RangeMultiplier { get; } public override Vector2 RangeMultiplier { get; }
@ -19,7 +19,7 @@ public class Harvester : Ally
public override float AttackSpeedMultiplier { get; } public override float AttackSpeedMultiplier { get; }
[SerializeField] [SerializeField]
private ResourceChoice _resourceChoice; private ResourceNodeType _resourceNodeType;
public override sealed void Start() public override sealed void Start()
{ {
base.Start(); base.Start();
@ -36,16 +36,9 @@ public class Harvester : Ally
var tile = LevelManager.Instance.Get<ResourceTile>(t => t.Position == Position); var tile = LevelManager.Instance.Get<ResourceTile>(t => t.Position == Position);
if (tile == default) return; if (tile == default) return;
//get the resource of the tile we're on
var yieldPrefab = tile.YieldPrefab;
if (!yieldPrefab) return;
var resourceMaker = yieldPrefab.GetComponent<ResourceMaker>();
if (!resourceMaker) return;
//if we already have the right harvester for the resource, no need to change //if we already have the right harvester for the resource, no need to change
var resourceChoice = resourceMaker.ResourceChoice; var resourceChoice = tile.ResourceNodeType;
if (resourceChoice == this.ResourceChoice) return; if (resourceChoice == this.ResourceNodeType) return;
//get the right pair for the resource we're on //get the right pair for the resource we're on
var harvResPair = _harvesterResourcePairs.Find(hrp => hrp.Resource == resourceChoice); var harvResPair = _harvesterResourcePairs.Find(hrp => hrp.Resource == resourceChoice);

View File

@ -10,8 +10,8 @@ public class HarvesterResourcePair
[SerializeField] [SerializeField]
private GameObject _harvesterPrefab; private GameObject _harvesterPrefab;
[SerializeField] [SerializeField]
private ResourceChoice _resource; private ResourceNodeType _resource;
public GameObject HarvesterPrefab => _harvesterPrefab; public GameObject HarvesterPrefab => _harvesterPrefab;
public ResourceChoice Resource => _resource; public ResourceNodeType Resource => _resource;
} }

View File

@ -26,7 +26,8 @@ public class AnimationEntity : MonoBehaviour
} }
void Update() void Update()
{ {
if (!_animatorEntity) return;
if (_doSomething && _animatorEntity.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1f) if (_doSomething && _animatorEntity.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1f)
{ {
PlayIdleAnim(); PlayIdleAnim();

View File

@ -93,7 +93,7 @@ public abstract class DraggablePlaceholder : MonoBehaviour
{ {
return !LevelManager.Instance.Has<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position)) return !LevelManager.Instance.Has<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position))
&& _lvlBoundsCache.Contains(transform.position) && _lvlBoundsCache.Contains(transform.position)
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food, 0); && ResourceManager.Instance.EnoughFor(Rock, Wood, Food);
} }
/// <summary> /// <summary>

View File

@ -9,7 +9,11 @@ public class GameObjectPlacementButton : UnitPlacementButton
protected override bool CanPlace() protected override bool CanPlace()
{ {
var isBuilding = _prefab.GetComponent<Building>(); var isBuilding = _prefab.GetComponent<Building>();
return ResourceManager.Instance.EnoughFor(_rock, _wood, _food, isBuilding ? 0 : GlobalConfig.Instance.Current.populationCostPerUnit) && _button.enabled && _canSpawn; var defaultPopCost = GlobalConfig.Instance.Current.populationCostPerUnit;
var hasEnoughPopulation = isBuilding || ResourceManager.Instance.EnoughPopulationFor(defaultPopCost);
return ResourceManager.Instance.EnoughFor(_rock, _wood, _food)
&& hasEnoughPopulation
&& _button.enabled && _canSpawn;
} }
protected override DraggablePlaceholder Place() protected override DraggablePlaceholder Place()

View File

@ -12,8 +12,11 @@ public class ObjectPlaceholder : DraggablePlaceholder
var objsOnPosition = LevelManager.Instance.GetAll<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position)); var objsOnPosition = LevelManager.Instance.GetAll<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position));
var positionIsCollidable = objsOnPosition.Exists(obj => obj.IsCollidable); var positionIsCollidable = objsOnPosition.Exists(obj => obj.IsCollidable);
var defaultUnitCost = GlobalConfig.Instance.Current.populationCostPerUnit;
return !positionIsCollidable return !positionIsCollidable
&& _lvlBoundsCache.Contains(transform.position) && _lvlBoundsCache.Contains(transform.position)
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food, Prefab.GetComponent<Building>() ? 0 : 1); && ResourceManager.Instance.EnoughFor(Rock, Wood, Food)
&& (Prefab.GetComponent<Building>()
|| ResourceManager.Instance.EnoughPopulationFor(defaultUnitCost));
} }
} }

View File

@ -8,7 +8,7 @@ public class TilePlacementButton : UnitPlacementButton
protected override bool CanPlace() protected override bool CanPlace()
{ {
return ResourceManager.Instance.EnoughFor(_rock, _wood, _food, 0) && _button.enabled && _canSpawn; return ResourceManager.Instance.EnoughFor(_rock, _wood, _food) && _button.enabled && _canSpawn;
} }
protected override DraggablePlaceholder Place() protected override DraggablePlaceholder Place()

View File

@ -2,9 +2,15 @@ public class Enum
{ {
public enum ResourceChoice public enum ResourceChoice
{ {
Rock, Rock = 0,
Wood, Wood = 1,
Food, Food = 2
Berry
}; };
public enum ResourceNodeType
{
Rock = 0,
Forest = 1,
Farm = 2,
BerryBush = 3
}
} }

View File

@ -37,7 +37,7 @@ public class Database : SingletonBehaviour<Database>
public void Add(T element) => elements.Add(element); public void Add(T element) => elements.Add(element);
public void Clear() => elements.Clear();
public IEnumerator<T> GetEnumerator() public IEnumerator<T> GetEnumerator()
{ {
return elements.GetEnumerator(); return elements.GetEnumerator();

View File

@ -21,6 +21,11 @@ public class WaveObserver : Singleton<WaveObserver>
_copyConstantSpawn = new List<int>(); _copyConstantSpawn = new List<int>();
_copyGroupSpawn = new List<GroupList>(); _copyGroupSpawn = new List<GroupList>();
_groupSpawnTimers = new List<float>(); _groupSpawnTimers = new List<float>();
if (!_levelConfig)
{
Debug.LogError("level config was null");
return;
}
foreach (EnemyType enemy in _levelConfig.ConstantSpawn) foreach (EnemyType enemy in _levelConfig.ConstantSpawn)
{ {
_copyConstantSpawn.Add(enemy.Count); _copyConstantSpawn.Add(enemy.Count);

View File

@ -101,9 +101,4 @@ public class LoadingManager : MonoBehaviour
{ {
SceneManager.UnloadSceneAsync(gameObject.scene.name); SceneManager.UnloadSceneAsync(gameObject.scene.name);
} }
} }

View File

@ -46,7 +46,6 @@ public class ResourceMaker : MonoBehaviour
if (_isPlaying) if (_isPlaying)
{ {
var amount = GlobalConfig.Instance.Current.harvestAmount;
_timePassed += Time.deltaTime; _timePassed += Time.deltaTime;
float duration = _timePassed / _desiredTime; float duration = _timePassed / _desiredTime;
duration = duration * duration * (3.0f - 2.0f * duration); duration = duration * duration * (3.0f - 2.0f * duration);
@ -54,26 +53,16 @@ public class ResourceMaker : MonoBehaviour
if(Vector2.Distance(transform.position,_endPosition) < 0.001f) if(Vector2.Distance(transform.position,_endPosition) < 0.001f)
{ {
_isPlaying = false; _isPlaying = false;
switch (_resourceChoice)
{
case Enum.ResourceChoice.Rock:
_resourceManagerInstance.RockAmount = amount;
break;
case Enum.ResourceChoice.Wood:
_resourceManagerInstance.WoodAmount = amount;
break;
case Enum.ResourceChoice.Food:
_resourceManagerInstance.FoodAmount = amount;
break;
case Enum.ResourceChoice.Berry:
_resourceManagerInstance.BerryAmount = amount;
break;
}
Destroy(gameObject); Destroy(gameObject);
} }
} }
} }
void OnDestroy()
{
AddResourceToInventory(GlobalConfig.Instance.Current.harvestAmount);
}
public void AddResourceToInventory(int amount) public void AddResourceToInventory(int amount)
{ {
switch (_resourceChoice) switch (_resourceChoice)

View File

@ -116,11 +116,14 @@ public class ResourceManager : Singleton<ResourceManager>
} }
} }
public bool EnoughFor(int rock, int wood, int food = 0, int population = 1) public bool EnoughFor(int rock, int wood, int food = 0)
{ {
return _rockAmount >= rock return _rockAmount >= rock
&& _woodAmount >= wood && _woodAmount >= wood
&& _foodAmount >= food && _foodAmount >= food;
&& _currentPopulation + population <= _maximumPopulation; }
public bool EnoughPopulationFor(int population = 1)
{
return _currentPopulation + population <= _maximumPopulation;
} }
} }

View File

@ -8,7 +8,10 @@ public class ResourceTile : LevelTile
[SerializeField] [SerializeField]
[Tooltip("the prefab of the currency that will be spawned when mining this resource")] [Tooltip("the prefab of the currency that will be spawned when mining this resource")]
private GameObject _yieldPrefab; private GameObject _yieldPrefab;
[SerializeField]
private Enum.ResourceNodeType _resourceNodeType;
public Enum.ResourceNodeType ResourceNodeType => _resourceNodeType;
public GameObject YieldPrefab => _yieldPrefab; public GameObject YieldPrefab => _yieldPrefab;
private string YieldPrefabName => _yieldPrefab.name; private string YieldPrefabName => _yieldPrefab.name;

View File

@ -70,7 +70,6 @@ public class WorldMapManager : MonoBehaviour
public void CallLevelWorld1(int levelToCall) public void CallLevelWorld1(int levelToCall)
{ {
string levelToGet = "1-" + levelToCall;
if (_buttonList[levelToCall - 1].GetComponent<Image>().sprite.name != "worldmap_level_locked") if (_buttonList[levelToCall - 1].GetComponent<Image>().sprite.name != "worldmap_level_locked")
{ {
PlayerPrefs.SetString(LoadingManager.SceneToLoad, _gameScene); PlayerPrefs.SetString(LoadingManager.SceneToLoad, _gameScene);

View File

@ -87,16 +87,6 @@ Tilemap:
m_GameObject: {fileID: 5890485537825364348} m_GameObject: {fileID: 5890485537825364348}
m_Enabled: 1 m_Enabled: 1
m_Tiles: m_Tiles:
- first: {x: -1, y: -4, z: 0}
second:
serializedVersion: 2
m_TileIndex: 8
m_TileSpriteIndex: 8
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 0
- first: {x: -1, y: -3, z: 0} - first: {x: -1, y: -3, z: 0}
second: second:
serializedVersion: 2 serializedVersion: 2
@ -215,7 +205,7 @@ Tilemap:
m_Data: {fileID: 11400000, guid: 7568f730b2ba3754297a7612452482e2, type: 2} m_Data: {fileID: 11400000, guid: 7568f730b2ba3754297a7612452482e2, type: 2}
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 11400000, guid: 15606c8c503e8164fb69178aa7016f58, type: 2} m_Data: {fileID: 11400000, guid: 15606c8c503e8164fb69178aa7016f58, type: 2}
- m_RefCount: 2 - m_RefCount: 1
m_Data: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2} m_Data: {fileID: 11400000, guid: 3723ba09738ef6245947ae3ba7978b21, type: 2}
m_TileSpriteArray: m_TileSpriteArray:
- m_RefCount: 1 - m_RefCount: 1
@ -234,10 +224,10 @@ Tilemap:
m_Data: {fileID: 21300000, guid: 5cf7447a03096c04ead18f1855f01cd7, type: 3} m_Data: {fileID: 21300000, guid: 5cf7447a03096c04ead18f1855f01cd7, type: 3}
- m_RefCount: 1 - m_RefCount: 1
m_Data: {fileID: 21300000, guid: 8354a544f4ca3514e87d40d2de9afaee, type: 3} m_Data: {fileID: 21300000, guid: 8354a544f4ca3514e87d40d2de9afaee, type: 3}
- m_RefCount: 2 - m_RefCount: 1
m_Data: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, type: 3} m_Data: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, type: 3}
m_TileMatrixArray: m_TileMatrixArray:
- m_RefCount: 11 - m_RefCount: 10
m_Data: m_Data:
e00: 1 e00: 1
e01: 0 e01: 0
@ -256,7 +246,7 @@ Tilemap:
e32: 0 e32: 0
e33: 1 e33: 1
m_TileColorArray: m_TileColorArray:
- m_RefCount: 11 - m_RefCount: 10
m_Data: {r: 1, g: 1, b: 1, a: 1} m_Data: {r: 1, g: 1, b: 1, a: 1}
m_TileObjectToInstantiateArray: [] m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1 m_AnimationFrameRate: 1
@ -331,7 +321,7 @@ TilemapRenderer:
m_Mode: 0 m_Mode: 0
m_DetectChunkCullingBounds: 0 m_DetectChunkCullingBounds: 0
m_MaskInteraction: 0 m_MaskInteraction: 0
--- !u!114 &8094062243660986082 --- !u!114 &70335294776359290
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}

View File

@ -15,4 +15,5 @@ MonoBehaviour:
_sprite: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, type: 3} _sprite: {fileID: 21300000, guid: 22cdcbd5df3efd74fa4d119fc5836708, type: 3}
_isCollidable: 0 _isCollidable: 0
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3} _yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
_randomPositionConfig: 0.5 _resourceNodeType: 3
_randomPositionConfig: 0.25

View File

@ -15,5 +15,5 @@ MonoBehaviour:
_sprite: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3} _sprite: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3}
_isCollidable: 0 _isCollidable: 0
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3} _yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
_yieldDuration: 5 _resourceNodeType: 2
_randomPositionConfig: 0.25 _randomPositionConfig: 0.25

View File

@ -15,5 +15,5 @@ MonoBehaviour:
_sprite: {fileID: 21300000, guid: 43582b3c6b60fd144bc56d8ab3b14349, type: 3} _sprite: {fileID: 21300000, guid: 43582b3c6b60fd144bc56d8ab3b14349, type: 3}
_isCollidable: 0 _isCollidable: 0
_yieldPrefab: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3} _yieldPrefab: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3}
_yieldDuration: 5 _resourceNodeType: 1
_randomPositionConfig: 0.5 _randomPositionConfig: 0.5

View File

@ -1,19 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84b05f2a26f63da46a1028488482d079, type: 3}
m_Name: Meat
m_EditorClassIdentifier:
_sprite: {fileID: 21300000, guid: b1e6b8ebeb2e25f4f8c5de93a31dd6a2, type: 3}
_isCollidable: 0
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
_yieldDuration: 5
_randomPositionConfig: 0.5

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a19b3b6859986b449aac7484e064097a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant: