Pull request #49: added population mechanic
Merge in CGD/gather-and-defend from prog/population to main * commit '6778880d5fed0d60c92f48995e62eca289bfaec3': reset resources for real each level loading oops forgot some staging population mechanic with art
This commit is contained in:
commit
96d9b0fd7b
43
Assets/Animations/UI/Population.controller
Normal file
43
Assets/Animations/UI/Population.controller
Normal file
@ -0,0 +1,43 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Population
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters: []
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: 1119129972874969774}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1107 &1119129972874969774
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates: []
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: 0}
|
||||
8
Assets/Animations/UI/Population.controller.meta
Normal file
8
Assets/Animations/UI/Population.controller.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59612d82f66d9124490ce6f04715580e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Art/Sprites/House.png
Normal file
BIN
Assets/Art/Sprites/House.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5c46c86f0bc20847ba28d9f215cce42
|
||||
guid: 02ca532612c0cbf4a93c2c0924622b8b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@ -33,7 +33,7 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
@ -47,7 +47,7 @@ TextureImporter:
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 10
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
@ -70,7 +70,7 @@ TextureImporter:
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
BIN
Assets/Art/Sprites/UI/exclamation_mark_red.png
Normal file
BIN
Assets/Art/Sprites/UI/exclamation_mark_red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
147
Assets/Art/Sprites/UI/exclamation_mark_red.png.meta
Normal file
147
Assets/Art/Sprites/UI/exclamation_mark_red.png.meta
Normal file
@ -0,0 +1,147 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fea1db9bc5faa374aa53ce0b06001f7e
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Art/Sprites/UI/hud_population_background.png
Normal file
BIN
Assets/Art/Sprites/UI/hud_population_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
147
Assets/Art/Sprites/UI/hud_population_background.png.meta
Normal file
147
Assets/Art/Sprites/UI/hud_population_background.png.meta
Normal file
@ -0,0 +1,147 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7c98c8c0fc5156468f7db050c29ea12
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
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
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 211 KiB |
BIN
Assets/Nuage.png
BIN
Assets/Nuage.png
Binary file not shown.
|
Before Width: | Height: | Size: 922 B |
197
Assets/Prefabs/House.prefab
Normal file
197
Assets/Prefabs/House.prefab
Normal file
@ -0,0 +1,197 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2993317045666078873
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1903134349826740869}
|
||||
- component: {fileID: 8050872027781041876}
|
||||
m_Layer: 0
|
||||
m_Name: sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1903134349826740869
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2993317045666078873}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3583371971866016829}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &8050872027781041876
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2993317045666078873}
|
||||
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: 364159097
|
||||
m_SortingLayer: 1
|
||||
m_SortingOrder: 4
|
||||
m_Sprite: {fileID: 21300000, guid: 02ca532612c0cbf4a93c2c0924622b8b, 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.59, y: 1.47}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &6208366596957312446
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3583371971866016829}
|
||||
- component: {fileID: 1993481641639217671}
|
||||
- component: {fileID: 2188414223676668191}
|
||||
- component: {fileID: 6208366596957312445}
|
||||
- component: {fileID: 6252103591577139412}
|
||||
m_Layer: 0
|
||||
m_Name: House
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3583371971866016829
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6208366596957312446}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1903134349826740869}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &1993481641639217671
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6208366596957312446}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
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: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!50 &2188414223676668191
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6208366596957312446}
|
||||
m_BodyType: 0
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1000000
|
||||
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!114 &6208366596957312445
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6208366596957312446}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2c66f72e2c09df040a9196ed782233d6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_hp: 10
|
||||
_speed: 0
|
||||
_attack_damage: 0
|
||||
_attack_interval: 0
|
||||
--- !u!114 &6252103591577139412
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6208366596957312446}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52b5039c6ed892a42b71ae16566ae511, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
7
Assets/Prefabs/House.prefab.meta
Normal file
7
Assets/Prefabs/House.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b9c2b61b2a2928458af5f15c009b8c4
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -118,7 +118,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 80, y: 40}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652127959947831
|
||||
CanvasRenderer:
|
||||
|
||||
@ -131,7 +131,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 80, y: 40}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652127959947831
|
||||
CanvasRenderer:
|
||||
|
||||
@ -1,5 +1,140 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &409105697323999132
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8641445880760147988}
|
||||
- component: {fileID: 7656322991203279577}
|
||||
- component: {fileID: 217791848456698108}
|
||||
m_Layer: 5
|
||||
m_Name: txt_amount
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8641445880760147988
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 409105697323999132}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2412408510912601678}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -51.5, y: 40.48}
|
||||
m_SizeDelta: {x: 100, y: 27.8896}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7656322991203279577
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 409105697323999132}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &217791848456698108
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 409105697323999132}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 0
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 34
|
||||
m_fontSizeBase: 34
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 1
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0.21078491, y: 5, z: -0.123336785, w: 5}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &809914569680790702
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -244,7 +379,7 @@ RectTransform:
|
||||
- {fileID: 809914569680790701}
|
||||
- {fileID: 809914570792234435}
|
||||
m_Father: {fileID: 809914571062164692}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -731,7 +866,7 @@ RectTransform:
|
||||
- {fileID: 809914570287003955}
|
||||
- {fileID: 809914570011997493}
|
||||
m_Father: {fileID: 809914571062164692}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -911,6 +1046,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2412408510912601678}
|
||||
- {fileID: 809914569973156332}
|
||||
- {fileID: 809914571517447036}
|
||||
- {fileID: 809914570630650134}
|
||||
@ -934,9 +1070,11 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 3ced676faf99a7648b5650ee8a1c60bd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_populationRegularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
_rockText: {fileID: 809914570011997492}
|
||||
_woodText: {fileID: 809914569794438656}
|
||||
_foodText: {fileID: 809914570792234434}
|
||||
_populationText: {fileID: 0}
|
||||
--- !u!114 &809914571062164691
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1072,7 +1210,7 @@ RectTransform:
|
||||
- {fileID: 809914571449911857}
|
||||
- {fileID: 809914569794438657}
|
||||
m_Father: {fileID: 809914571062164692}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -1087,3 +1225,126 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 809914571517447037}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1037075848710928212
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2412408510912601678}
|
||||
- component: {fileID: 8623690113323122241}
|
||||
m_Layer: 5
|
||||
m_Name: Pop
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2412408510912601678
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1037075848710928212}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7922697153830287068}
|
||||
- {fileID: 8641445880760147988}
|
||||
m_Father: {fileID: 809914571062164692}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 170, y: 99}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8623690113323122241
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1037075848710928212}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &3811472721276476290
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7922697153830287068}
|
||||
- component: {fileID: 5865368559936172676}
|
||||
- component: {fileID: 7359902538423767507}
|
||||
m_Layer: 5
|
||||
m_Name: img_hudBackground
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7922697153830287068
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3811472721276476290}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2412408510912601678}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 170, y: 99}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5865368559936172676
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3811472721276476290}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7359902538423767507
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3811472721276476290}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: f7c98c8c0fc5156468f7db050c29ea12, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -9,16 +9,14 @@ public class Ally : Entity
|
||||
public override float HpMultiplier => GlobalConfig.Instance.Current.allyLifeMultiplier;
|
||||
public override Vector2 RangeMultiplier => GlobalConfig.Instance.Current.allyRangeMultiplier;
|
||||
public override float SpeedMultiplier => GlobalConfig.Instance.Current.allySpeedMultiplier;
|
||||
public float PopulationCost => GlobalConfig.Instance.Current.populationCostPerUnit;
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if(IsEnemyDetected) {
|
||||
if (IsEnemyDetected)
|
||||
{
|
||||
AttackEnemy();
|
||||
}
|
||||
|
||||
@ -38,4 +36,14 @@ public class Ally : Entity
|
||||
AttackSpeedWait += Time.deltaTime;
|
||||
}
|
||||
|
||||
public override void LevelStart()
|
||||
{
|
||||
base.LevelStart();
|
||||
ResourceManager.Instance.CurrentPopulation += PopulationCost;
|
||||
}
|
||||
public override void LevelDestroy()
|
||||
{
|
||||
base.LevelDestroy();
|
||||
ResourceManager.Instance.CurrentPopulation -= PopulationCost;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,17 +5,4 @@ using UnityEngine;
|
||||
public class Building : Ally
|
||||
{
|
||||
|
||||
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//do something
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using static Enum;
|
||||
|
||||
public class Harvester : Entity
|
||||
public class Harvester : Ally
|
||||
{
|
||||
[SerializeField] [Tooltip("helps choose the right skin for the harvester depending on resource")]
|
||||
private List<HarvesterResourcePair> _harvesterResourcePairs;
|
||||
|
||||
14
Assets/Scripts/Ally/House.cs
Normal file
14
Assets/Scripts/Ally/House.cs
Normal file
@ -0,0 +1,14 @@
|
||||
public class House : Building
|
||||
{
|
||||
public float PopulationGiven => GlobalConfig.Instance.Current.populationGivenPerHouse;
|
||||
public override void LevelStart()
|
||||
{
|
||||
ResourceManager.Instance.MaximumPopulation += PopulationGiven;
|
||||
base.LevelStart();
|
||||
}
|
||||
public override void LevelDestroy()
|
||||
{
|
||||
ResourceManager.Instance.MaximumPopulation -= PopulationGiven;
|
||||
base.LevelDestroy();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Ally/House.cs.meta
Normal file
11
Assets/Scripts/Ally/House.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c66f72e2c09df040a9196ed782233d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -93,7 +93,7 @@ public abstract class DraggablePlaceholder : MonoBehaviour
|
||||
{
|
||||
return !LevelManager.Instance.Has<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position))
|
||||
&& _lvlBoundsCache.Contains(transform.position)
|
||||
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food);
|
||||
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -5,6 +5,13 @@ public class GameObjectPlacementButton : UnitPlacementButton
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _prefab;
|
||||
|
||||
protected override bool CanPlace()
|
||||
{
|
||||
var isBuilding = _prefab.GetComponent<Building>();
|
||||
return ResourceManager.Instance.EnoughFor(_rock, _wood, _food, isBuilding ? 0 : GlobalConfig.Instance.Current.populationCostPerUnit) && _button.enabled && _canSpawn;
|
||||
}
|
||||
|
||||
protected override DraggablePlaceholder Place()
|
||||
{
|
||||
var instance = Instantiate(_prefab);
|
||||
@ -15,9 +22,12 @@ public class GameObjectPlacementButton : UnitPlacementButton
|
||||
if(detectComp) detectionRect = _prefab.GetComponentInChildren<Detection>().DetectionRectangle;
|
||||
|
||||
//strip the object
|
||||
foreach (var r_body in instance.transform.GetAllComponents<Rigidbody2D>()) Destroy(r_body);
|
||||
foreach (var coll in instance.transform.GetAllComponents<Collider2D>()) Destroy(coll);
|
||||
foreach (var script in instance.transform.GetAllComponents<MonoBehaviour>()) Destroy(script);
|
||||
foreach (var r_body in instance.transform.GetAllComponents<Rigidbody2D>())
|
||||
Destroy(r_body);
|
||||
foreach (var coll in instance.transform.GetAllComponents<Collider2D>())
|
||||
Destroy(coll);
|
||||
foreach (var script in instance.transform.GetAllComponents<MonoBehaviour>())
|
||||
Destroy(script);
|
||||
|
||||
var placeholder = instance.AddComponent<ObjectPlaceholder>();
|
||||
|
||||
@ -26,7 +36,6 @@ public class GameObjectPlacementButton : UnitPlacementButton
|
||||
//assign outline material to all renderers of the placeholder
|
||||
foreach (var rend in instance.transform.GetAllComponents<SpriteRenderer>())
|
||||
{
|
||||
|
||||
var color = rend.color;
|
||||
color.a = 0.6f;
|
||||
rend.color = color;
|
||||
|
||||
@ -14,6 +14,6 @@ public class ObjectPlaceholder : DraggablePlaceholder
|
||||
|
||||
return !positionIsCollidable
|
||||
&& _lvlBoundsCache.Contains(transform.position)
|
||||
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food);
|
||||
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food, Prefab.GetComponent<Building>() ? 0 : 1);
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,6 @@ public class TilePlaceholder : DraggablePlaceholder
|
||||
public LevelTile Tile { get; set; }
|
||||
public override void Place()
|
||||
{
|
||||
|
||||
LevelManager.Instance.DynamicTilemap.SetTile(Vector3Int.RoundToInt(transform.position), Tile);
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using Codice.CM.Client.Differences;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -5,6 +6,12 @@ using UnityEngine;
|
||||
public class TilePlacementButton : UnitPlacementButton
|
||||
{
|
||||
public LevelTile tile;
|
||||
|
||||
protected override bool CanPlace()
|
||||
{
|
||||
return ResourceManager.Instance.EnoughFor(_rock, _wood, _food, 0) && _button.enabled && _canSpawn;
|
||||
}
|
||||
|
||||
protected override DraggablePlaceholder Place()
|
||||
{
|
||||
var instance = new GameObject(tile.name);
|
||||
|
||||
@ -5,7 +5,6 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using GatherAndDefend.Events;
|
||||
using static LevelManager;
|
||||
|
||||
[RequireComponent(typeof(Button))]
|
||||
public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
||||
@ -16,13 +15,13 @@ public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
||||
protected Sprite _detectionRangeSprite;
|
||||
|
||||
[SerializeField]
|
||||
private int _wood;
|
||||
protected int _wood;
|
||||
[SerializeField]
|
||||
private int _rock;
|
||||
protected int _rock;
|
||||
[SerializeField]
|
||||
private int _food;
|
||||
protected int _food;
|
||||
|
||||
private Button _button;
|
||||
protected Button _button;
|
||||
[SerializeField]
|
||||
private TMP_Text _foodLabel;
|
||||
[SerializeField]
|
||||
@ -30,10 +29,10 @@ public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
||||
[SerializeField]
|
||||
private TMP_Text _rockLabel;
|
||||
|
||||
private bool _canSpawn = false;
|
||||
protected bool _canSpawn = false;
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
{
|
||||
_button = GetComponent<Button>();
|
||||
|
||||
_button.enabled = false;
|
||||
@ -53,7 +52,8 @@ public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
||||
}
|
||||
protected virtual void Update()
|
||||
{
|
||||
_button.interactable = ResourceManager.Instance.EnoughFor(_rock, _wood, _food) && _button.enabled && _canSpawn;
|
||||
_button.interactable = CanPlace();
|
||||
|
||||
SetTextFor(_foodLabel, _food);
|
||||
SetTextFor(_rockLabel, _rock);
|
||||
SetTextFor(_woodLabel, _wood);
|
||||
@ -66,10 +66,12 @@ public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
if (!_button.interactable) return;
|
||||
|
||||
var placeholder = Place();
|
||||
placeholder.Rock = _rock;
|
||||
placeholder.Wood = _wood;
|
||||
placeholder.Food = _food;
|
||||
}
|
||||
protected abstract DraggablePlaceholder Place();
|
||||
protected abstract bool CanPlace();
|
||||
}
|
||||
|
||||
6
Assets/Scripts/Events/PopulationChangedEvent.cs
Normal file
6
Assets/Scripts/Events/PopulationChangedEvent.cs
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
using GatherAndDefend.Events;
|
||||
|
||||
class PopulationChangedEvent : EventBase
|
||||
{
|
||||
}
|
||||
11
Assets/Scripts/Events/PopulationChangedEvent.cs.meta
Normal file
11
Assets/Scripts/Events/PopulationChangedEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a47cdad2bd51834bbbea50627e72272
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5
Assets/Scripts/Events/ResourcesChangedEvent.cs
Normal file
5
Assets/Scripts/Events/ResourcesChangedEvent.cs
Normal file
@ -0,0 +1,5 @@
|
||||
using GatherAndDefend.Events;
|
||||
|
||||
public class ResourcesChangedEvent : EventBase
|
||||
{
|
||||
}
|
||||
11
Assets/Scripts/Events/ResourcesChangedEvent.cs.meta
Normal file
11
Assets/Scripts/Events/ResourcesChangedEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54e6189c39fc7e7479ed9e67fb363ee8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -23,6 +23,11 @@ public class GlobalConfigFile : ScriptableObject
|
||||
public float allySpeedMultiplier = 1;
|
||||
public Vector2 allyRangeMultiplier = Vector2.one;
|
||||
|
||||
[Header("Population")]
|
||||
public int basePopulation = 5;
|
||||
public int populationGivenPerHouse = 5;
|
||||
public int populationCostPerUnit = 1;
|
||||
public float populationWarningPercentage = 0.75f;
|
||||
|
||||
[Header("resources")]
|
||||
public float harvestDuration = 1;
|
||||
|
||||
@ -20,6 +20,20 @@ namespace GatherAndDefend.LevelEditor
|
||||
_data.Add(data);
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private int _startPopulation = 5;
|
||||
[SerializeField]
|
||||
private int _startFood = 50;
|
||||
[SerializeField]
|
||||
private int _startWood = 0;
|
||||
[SerializeField]
|
||||
private int _startRock = 0;
|
||||
public int StartPopulation => _startPopulation;
|
||||
public int StartFood => _startFood;
|
||||
public int StartWood => _startWood;
|
||||
public int StartRock => _startRock;
|
||||
|
||||
|
||||
public WaveConfig WaveConfig { get { return _waveConfig; } }
|
||||
|
||||
public IEnumerator<TilemapData> GetEnumerator()
|
||||
|
||||
@ -20,7 +20,7 @@ public class ClickBehavior : MonoBehaviour
|
||||
{
|
||||
foreach (Collider2D collider in resourceColliders)
|
||||
{
|
||||
collider.GetComponent<ResourceMaker>().GenerateResource();
|
||||
collider.GetComponent<ResourceMaker>().ClickOnResource();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@ public class ResourceMaker : MonoBehaviour
|
||||
private Enum.ResourceChoice _resourceChoice;
|
||||
private ResourceManager _resourceManagerInstance;
|
||||
[SerializeField]
|
||||
private bool _animate = true;
|
||||
[SerializeField]
|
||||
private Vector2 _endPosition;
|
||||
private Vector2 _startPosition;
|
||||
private Rigidbody2D _rigidbody;
|
||||
@ -21,6 +23,8 @@ public class ResourceMaker : MonoBehaviour
|
||||
private void Start()
|
||||
{
|
||||
_resourceManagerInstance = ResourceManager.Instance;
|
||||
if (!_animate) return;
|
||||
|
||||
_startPosition = transform.position;
|
||||
transform.position = new Vector2(transform.position.x, transform.position.y + 0.5f);
|
||||
_rigidbody = GetComponent<Rigidbody2D>();
|
||||
@ -33,6 +37,7 @@ public class ResourceMaker : MonoBehaviour
|
||||
/// </summary>
|
||||
private void Update()
|
||||
{
|
||||
if (!_animate) return;
|
||||
if (Vector2.Distance(transform.position, _startPosition) < 0.01f)
|
||||
{
|
||||
_rigidbody.gravityScale = 0.0f;
|
||||
@ -49,24 +54,29 @@ public class ResourceMaker : MonoBehaviour
|
||||
if(Vector2.Distance(transform.position,_endPosition) < 0.001f)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
AddResourceToInventory(amount);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateResource()
|
||||
public void AddResourceToInventory(int amount)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClickOnResource()
|
||||
{
|
||||
if (!_rigidbody) return;
|
||||
_isPlaying = true;
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
using GatherAndDefend.Events;
|
||||
using GatherAndDefend.LevelEditor;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
@ -7,18 +10,45 @@ public class ResourceManager : Singleton<ResourceManager>
|
||||
{
|
||||
private int _rockAmount = 0;
|
||||
private int _woodAmount = 0;
|
||||
private int _foodAmount = 50;
|
||||
private int _foodAmount = 0;
|
||||
|
||||
private float _currentPopulation;
|
||||
private float _maximumPopulation;
|
||||
|
||||
private const int MAX = int.MaxValue;
|
||||
private const int MIN = 0;
|
||||
|
||||
public ResourceManager()
|
||||
{
|
||||
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(InitializeResources);
|
||||
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Attach(ResetResources);
|
||||
}
|
||||
|
||||
private void ResetResources()
|
||||
{
|
||||
_rockAmount = 0;
|
||||
_woodAmount = 0;
|
||||
_foodAmount = 0;
|
||||
_currentPopulation = 0;
|
||||
_maximumPopulation = 0;
|
||||
}
|
||||
private void InitializeResources(Level level)
|
||||
{
|
||||
RockAmount = level.StartRock;
|
||||
WoodAmount = level.StartWood;
|
||||
FoodAmount = level.StartFood;
|
||||
CurrentPopulation = 0;
|
||||
MaximumPopulation = level.StartPopulation;
|
||||
}
|
||||
|
||||
public int RockAmount
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_rockAmount + value < MAX)
|
||||
if (value != _rockAmount)
|
||||
{
|
||||
_rockAmount += value;
|
||||
_rockAmount = Mathf.Clamp(value, MIN, MAX);
|
||||
EventAggregator.Instance.GetEvent<ResourcesChangedEvent>().Invoke();
|
||||
}
|
||||
}
|
||||
get { return _rockAmount; }
|
||||
@ -27,9 +57,10 @@ public class ResourceManager : Singleton<ResourceManager>
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_woodAmount + value < MAX)
|
||||
if (value != _woodAmount)
|
||||
{
|
||||
_woodAmount += value;
|
||||
_woodAmount = Mathf.Clamp(value, MIN, MAX);
|
||||
EventAggregator.Instance.GetEvent<ResourcesChangedEvent>().Invoke();
|
||||
}
|
||||
}
|
||||
get { return _woodAmount; }
|
||||
@ -38,27 +69,58 @@ public class ResourceManager : Singleton<ResourceManager>
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_foodAmount + value < MAX)
|
||||
if (value != _foodAmount)
|
||||
{
|
||||
_foodAmount += value;
|
||||
_foodAmount = value;
|
||||
EventAggregator.Instance.GetEvent<ResourcesChangedEvent>().Invoke();
|
||||
}
|
||||
}
|
||||
get { return _foodAmount; }
|
||||
}
|
||||
|
||||
public float CurrentPopulation
|
||||
{
|
||||
get => _currentPopulation;
|
||||
set
|
||||
{
|
||||
if (_currentPopulation != value)
|
||||
{
|
||||
_currentPopulation = value;
|
||||
EventAggregator.Instance.GetEvent<PopulationChangedEvent>().Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
public float MaximumPopulation
|
||||
{
|
||||
get => _maximumPopulation;
|
||||
set
|
||||
{
|
||||
if (_maximumPopulation != value)
|
||||
{
|
||||
_maximumPopulation = value;
|
||||
EventAggregator.Instance.GetEvent<PopulationChangedEvent>().Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(int rock, int wood, int food)
|
||||
{
|
||||
int oldRock = _rockAmount, oldWood = _woodAmount, oldFood = _foodAmount;
|
||||
_rockAmount = (_rockAmount - rock) < MIN ? MIN : _rockAmount - rock;
|
||||
_woodAmount = (_woodAmount - wood) < MIN ? MIN : _woodAmount - wood;
|
||||
_foodAmount = (_foodAmount - food) < MIN ? MIN : _foodAmount - food;
|
||||
|
||||
if (oldRock != _rockAmount || oldFood != _foodAmount || oldWood != _woodAmount)
|
||||
{
|
||||
EventAggregator.Instance.GetEvent<ResourcesChangedEvent>().Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnoughFor(int rock, int wood, int food = 0)
|
||||
public bool EnoughFor(int rock, int wood, int food = 0, int population = 1)
|
||||
{
|
||||
if (_rockAmount >= rock && _woodAmount >= wood && _foodAmount >= food)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return _rockAmount >= rock
|
||||
&& _woodAmount >= wood
|
||||
&& _foodAmount >= food
|
||||
&& _currentPopulation + population <= _maximumPopulation;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,30 +2,75 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using GatherAndDefend.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Gère l'affichage des resources
|
||||
/// </summary>
|
||||
public class ResourceText : MonoBehaviour
|
||||
{
|
||||
private Color _populationCriticalColor = Color.red;
|
||||
private Color _populationWarningColor = Color.yellow;
|
||||
private Color _populationRegularColor = Color.white;
|
||||
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _rockText;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _woodText;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _foodText;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _populationText;
|
||||
[SerializeField]
|
||||
private Image _populationCriticalIndicator;
|
||||
|
||||
private ResourceManager _resourceManager;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_resourceManager = ResourceManager.Instance;
|
||||
_populationCriticalIndicator.enabled = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
RefreshResources();
|
||||
RefreshPopulation();
|
||||
}
|
||||
void RefreshResources()
|
||||
{
|
||||
_rockText.text = _resourceManager.RockAmount.ToString();
|
||||
_woodText.text = _resourceManager.WoodAmount.ToString();
|
||||
_foodText.text = _resourceManager.FoodAmount.ToString();
|
||||
}
|
||||
void RefreshPopulation()
|
||||
{
|
||||
float current = _resourceManager.CurrentPopulation;
|
||||
float max = _resourceManager.MaximumPopulation;
|
||||
|
||||
_populationCriticalIndicator.enabled = current >= max;
|
||||
|
||||
var chosenColor = _populationRegularColor;
|
||||
if (current >= max)
|
||||
{
|
||||
chosenColor = _populationCriticalColor;
|
||||
_populationText.fontStyle = FontStyles.Bold;
|
||||
}
|
||||
else if (((float)current / (float)max) > GlobalConfig.Instance.Current.populationWarningPercentage)
|
||||
{
|
||||
chosenColor = _populationWarningColor;
|
||||
_populationText.fontStyle = FontStyles.Bold;
|
||||
}
|
||||
else
|
||||
{
|
||||
_populationText.fontStyle = 0;
|
||||
}
|
||||
var hexColor = $"#{ToHexString(chosenColor.r)}{ToHexString(chosenColor.g)}{ToHexString(chosenColor.b)}";
|
||||
_populationText.text = $"<color={hexColor}>{_resourceManager.CurrentPopulation}</color> / {_resourceManager.MaximumPopulation}";
|
||||
}
|
||||
string ToHexString(float colorValue)
|
||||
{
|
||||
return ((int)(255 * colorValue)).ToString("X2");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user