Changed animation strings to hashes, added IPoolable interface, upgrade pool system

Change generation of obstacles
Now all the important objects is cointained by pools
This commit is contained in:
VladimirPirozhenko 2022-08-09 22:23:49 +03:00
parent c7a0ad0f90
commit 4fa18a41a0
41 changed files with 64302 additions and 98 deletions

View File

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

View File

@ -215,6 +215,31 @@ AnimatorStateTransition:
m_InterruptionSource: 0 m_InterruptionSource: 0
m_OrderedInterruption: 1 m_OrderedInterruption: 1
m_CanTransitionToSelf: 1 m_CanTransitionToSelf: 1
--- !u!1101 &-1211456918577112825
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Dead
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1911143521455995842}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 0
--- !u!91 &9100000 --- !u!91 &9100000
AnimatorController: AnimatorController:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -273,6 +298,32 @@ AnimatorController:
m_IKPass: 0 m_IKPass: 0
m_SyncedLayerAffectsTiming: 0 m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
--- !u!1102 &1911143521455995842
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Falling Back Death
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: f878d1ad12b950a48aa23c9cfd223c34, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &4002842131677403910 --- !u!1101 &4002842131677403910
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -371,8 +422,12 @@ AnimatorStateMachine:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -5661746514038728207} m_State: {fileID: -5661746514038728207}
m_Position: {x: 520, y: -10, z: 0} m_Position: {x: 520, y: -10, z: 0}
- serializedVersion: 1
m_State: {fileID: 1911143521455995842}
m_Position: {x: 280, y: -70, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions:
- {fileID: -1211456918577112825}
m_EntryTransitions: [] m_EntryTransitions: []
m_StateMachineTransitions: {} m_StateMachineTransitions: {}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []

View File

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 44334f10651a6b949aa54d1ab90b321d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
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: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
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: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

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

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: ec5e532e7b683864a86c7519e18cce3c
ModelImporter:
serializedVersion: 21300
internalIDToNameTable:
- first:
74: -203655887218126122
second: mixamo.com
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 1
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 3
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 1
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 1
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 1e6c43dacf9536b498bf52f9e6505ebd
ModelImporter:
serializedVersion: 21300
internalIDToNameTable:
- first:
74: -203655887218126122
second: mixamo.com
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 1
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 3
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 1
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 3
humanoidOversampling: 1
avatarSetup: 1
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -27,7 +27,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 96461661196881973} m_GameObject: {fileID: 96461661196881973}
m_LocalRotation: {x: 0, y: -1, z: 0, w: 0} m_LocalRotation: {x: 0, y: -1, z: 0, w: 0}
m_LocalPosition: {x: -4.2953286, y: 0.162, z: -4.2997} m_LocalPosition: {x: -6.2953286, y: 0.162, z: -4.2997}
m_LocalScale: {x: 1, y: 1.4, z: 4.0053} m_LocalScale: {x: 1, y: 1.4, z: 4.0053}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -219,7 +219,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 562623238776548450} m_GameObject: {fileID: 562623238776548450}
m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653} m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653}
m_LocalPosition: {x: 6.0000043, y: 0.0000013908, z: 2.8377} m_LocalPosition: {x: 4.0000043, y: 0.0000013908, z: 2.8377}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -384,7 +384,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 831280777384614076} m_GameObject: {fileID: 831280777384614076}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.954, y: 4.01, z: 2.9138} m_LocalPosition: {x: -3.954, y: 4.01, z: 2.9138}
m_LocalScale: {x: 1, y: 1, z: 4.0053} m_LocalScale: {x: 1, y: 1, z: 4.0053}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -649,7 +649,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1711497923749520810} m_GameObject: {fileID: 1711497923749520810}
m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653} m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653}
m_LocalPosition: {x: 1.9999998, y: 0, z: 10.848} m_LocalPosition: {x: -0.00000023841858, y: 0, z: 10.848}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -767,7 +767,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1904789675920767352} m_GameObject: {fileID: 1904789675920767352}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 1.9999995, y: 0, z: 2.8299994} m_LocalPosition: {x: -0.00000047683716, y: 0, z: 2.8299994}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -866,7 +866,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1930304146026479431} m_GameObject: {fileID: 1930304146026479431}
m_LocalRotation: {x: -0.5, y: 0.5, z: 0.5, w: 0.5} m_LocalRotation: {x: -0.5, y: 0.5, z: 0.5, w: 0.5}
m_LocalPosition: {x: 14.8, y: 2.41, z: 5.17} m_LocalPosition: {x: 12.8, y: 2.41, z: 5.17}
m_LocalScale: {x: 1, y: 1, z: 0.6666667} m_LocalScale: {x: 1, y: 1, z: 0.6666667}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -964,7 +964,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2225319013170844455} m_GameObject: {fileID: 2225319013170844455}
m_LocalRotation: {x: 0.70710653, y: 0.00000011520227, z: 0.70710707, w: -0.0000001152023} m_LocalRotation: {x: 0.70710653, y: 0.00000011520227, z: 0.70710707, w: -0.0000001152023}
m_LocalPosition: {x: 6.000003, y: 4.000005, z: 2.8378} m_LocalPosition: {x: 4.000003, y: 4.000005, z: 2.8378}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1120,7 +1120,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3231417360219244859} m_GameObject: {fileID: 3231417360219244859}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: -2.0000005, y: 0, z: 2.829999} m_LocalPosition: {x: -4.0000005, y: 0, z: 2.829999}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -1218,7 +1218,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3950509452734738241} m_GameObject: {fileID: 3950509452734738241}
m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653} m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653}
m_LocalPosition: {x: 2.0000052, y: 0, z: 2.8377} m_LocalPosition: {x: 0.0000052452087, y: 0, z: 2.8377}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1374,7 +1374,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4965981231653170154} m_GameObject: {fileID: 4965981231653170154}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 6.074, y: 4.01, z: 2.9138} m_LocalPosition: {x: 4.074, y: 4.01, z: 2.9138}
m_LocalScale: {x: 1, y: 1, z: 4.0053} m_LocalScale: {x: 1, y: 1, z: 4.0053}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1652,7 +1652,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5613211205116673037} m_GameObject: {fileID: 5613211205116673037}
m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653} m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653}
m_LocalPosition: {x: -1.9999971, y: -0.0000013908, z: 2.8377} m_LocalPosition: {x: -3.9999971, y: -0.0000013908, z: 2.8377}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1722,7 +1722,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5613211205116686397} m_GameObject: {fileID: 5613211205116686397}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2, y: 0, z: -0.74} m_LocalPosition: {x: 0, y: 0, z: -0.74}
m_LocalScale: {x: 1, y: 1.5, z: 1} m_LocalScale: {x: 1, y: 1.5, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1776,6 +1776,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<Begin>k__BackingField: {fileID: 8331850446012945034} <Begin>k__BackingField: {fileID: 8331850446012945034}
<End>k__BackingField: {fileID: 8960787494111689333} <End>k__BackingField: {fileID: 8960787494111689333}
gridRowCount: 10
--- !u!1 &5613211205116689287 --- !u!1 &5613211205116689287
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1802,7 +1803,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5613211205116689287} m_GameObject: {fileID: 5613211205116689287}
m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653} m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653}
m_LocalPosition: {x: 8.000002, y: 0.0000021855, z: 2.8378} m_LocalPosition: {x: 6.000002, y: 0.0000021855, z: 2.8378}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -1961,7 +1962,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5613211205116841543} m_GameObject: {fileID: 5613211205116841543}
m_LocalRotation: {x: 0.70710653, y: 0.00000011520227, z: 0.70710707, w: -0.0000001152023} m_LocalRotation: {x: 0.70710653, y: 0.00000011520227, z: 0.70710707, w: -0.0000001152023}
m_LocalPosition: {x: -1.9999986, y: 4.0000024, z: 2.8377} m_LocalPosition: {x: -3.9999986, y: 4.0000024, z: 2.8377}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -2539,7 +2540,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5613211205116871863} m_GameObject: {fileID: 5613211205116871863}
m_LocalRotation: {x: -5.6843412e-14, y: 0.70710653, z: 0.00000023040471, w: 0.70710707} m_LocalRotation: {x: -5.6843412e-14, y: 0.70710653, z: 0.00000023040471, w: 0.70710707}
m_LocalPosition: {x: -3.9999986, y: -0.0000019868, z: 2.8377} m_LocalPosition: {x: -5.9999986, y: -0.0000019868, z: 2.8377}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -2783,7 +2784,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5757616955125662940} m_GameObject: {fileID: 5757616955125662940}
m_LocalRotation: {x: -0.5, y: -0.5, z: -0.5, w: 0.5} m_LocalRotation: {x: -0.5, y: -0.5, z: -0.5, w: 0.5}
m_LocalPosition: {x: -9.66, y: 3.04, z: 7.5} m_LocalPosition: {x: -11.66, y: 3.04, z: 7.5}
m_LocalScale: {x: 1, y: 1, z: 0.6666667} m_LocalScale: {x: 1, y: 1, z: 0.6666667}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -2881,7 +2882,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6334208404480944107} m_GameObject: {fileID: 6334208404480944107}
m_LocalRotation: {x: 0.70710653, y: 0.00000011520227, z: 0.70710707, w: -0.0000001152023} m_LocalRotation: {x: 0.70710653, y: 0.00000011520227, z: 0.70710707, w: -0.0000001152023}
m_LocalPosition: {x: 2.0000029, y: 4, z: 2.8377} m_LocalPosition: {x: 0.000002861023, y: 4, z: 2.8377}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -2953,7 +2954,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6796968398226518802} m_GameObject: {fileID: 6796968398226518802}
m_LocalRotation: {x: 0, y: -1, z: 0, w: 0} m_LocalRotation: {x: 0, y: -1, z: 0, w: 0}
m_LocalPosition: {x: 8.28, y: 0.162, z: -4.2997} m_LocalPosition: {x: 6.2799997, y: 0.162, z: -4.2997}
m_LocalScale: {x: 1, y: 1.4, z: 4.0053} m_LocalScale: {x: 1, y: 1.4, z: 4.0053}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -3240,7 +3241,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6906897417619726006} m_GameObject: {fileID: 6906897417619726006}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.08, y: 4.01, z: 2.9138} m_LocalPosition: {x: 0.07999992, y: 4.01, z: 2.9138}
m_LocalScale: {x: 1, y: 1, z: 4.0053} m_LocalScale: {x: 1, y: 1, z: 4.0053}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -3337,7 +3338,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7319247709792706288} m_GameObject: {fileID: 7319247709792706288}
m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653} m_LocalRotation: {x: 0.00000023040471, y: -0.70710707, z: 4.618527e-14, w: 0.70710653}
m_LocalPosition: {x: 2, y: 0, z: -5.1729} m_LocalPosition: {x: 0, y: 0, z: -5.1729}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -3371,7 +3372,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8368511245192407899} m_GameObject: {fileID: 8368511245192407899}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 5.9999995, y: 0, z: 2.83} m_LocalPosition: {x: 3.9999995, y: 0, z: 2.83}
m_LocalScale: {x: 4.0053, y: 1, z: 1} m_LocalScale: {x: 4.0053, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []

File diff suppressed because it is too large Load Diff

View File

@ -1308,6 +1308,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<Begin>k__BackingField: {fileID: 4986045466033343642} <Begin>k__BackingField: {fileID: 4986045466033343642}
<End>k__BackingField: {fileID: 2340129150570236126} <End>k__BackingField: {fileID: 2340129150570236126}
gridRowCount: 10
--- !u!1 &1193770462775183973 --- !u!1 &1193770462775183973
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -307,7 +307,7 @@ BoxCollider:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2468247842154696319} m_GameObject: {fileID: 2468247842154696319}
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 1
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 3.3514357, y: 1, z: 1.3116827} m_Size: {x: 3.3514357, y: 1, z: 1.3116827}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b415c01b13507f49b7c23b9a06148a9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6347578780605603610
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6347578780605603612}
- component: {fileID: 6347578780605603613}
m_Layer: 0
m_Name: ChunkPool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6347578780605603612
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6347578780605603610}
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: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &6347578780605603613
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6347578780605603610}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3}
m_Name:
m_EditorClassIdentifier:
<Capacity>k__BackingField: 20
prefab: {fileID: -8446043830258454905, guid: 378b62e0e298e0642abc436c57f8825a, type: 3}
spawner: {fileID: 0}

View File

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

View File

@ -152,7 +152,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 13e6eeecbe6be7e448121b1729686a08, type: 3} m_Script: {fileID: 11500000, guid: 13e6eeecbe6be7e448121b1729686a08, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<LaneWidth>k__BackingField: 6 <LaneWidth>k__BackingField: 4
laneCount: 3 laneCount: 3
--- !u!4 &106057763 --- !u!4 &106057763
Transform: Transform:
@ -407,7 +407,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3eafc00aae1f6b74891927f3360acd11, type: 3} m_Script: {fileID: 11500000, guid: 3eafc00aae1f6b74891927f3360acd11, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
obstaclePrefab: {fileID: -2344530007010565835, guid: dd64cf90044eea341a44470119043683, type: 3}
LaneSystem: {fileID: 106057762} LaneSystem: {fileID: 106057762}
gridColumns: 5
<ObstaclePools>k__BackingField:
- {fileID: 1910831858}
--- !u!1 &1541274382 --- !u!1 &1541274382
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -487,7 +491,7 @@ MonoBehaviour:
spawnDelay: 5 spawnDelay: 5
chunkGenerator: {fileID: 1125063958} chunkGenerator: {fileID: 1125063958}
chunkPool: {fileID: 2025791532} chunkPool: {fileID: 2025791532}
--- !u!1 &2025791531 --- !u!1 &1910831857
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -495,45 +499,55 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 2025791533} - component: {fileID: 1910831859}
- component: {fileID: 2025791532} - component: {fileID: 1910831858}
m_Layer: 0 m_Layer: 0
m_Name: ChunkPool m_Name: BoxAndBarrelsObstaclePool
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!114 &2025791532 --- !u!114 &1910831858
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2025791531} m_GameObject: {fileID: 1910831857}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3} m_Script: {fileID: 11500000, guid: 1290664e863a3d34596917f255587b4c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
<Capacity>k__BackingField: 20 <Capacity>k__BackingField: 30
prefab: {fileID: -8446043830258454905, guid: 378b62e0e298e0642abc436c57f8825a, type: 3} prefab: {fileID: -2344530007010565835, guid: dd64cf90044eea341a44470119043683, type: 3}
spawner: {fileID: 1872880027} --- !u!4 &1910831859
--- !u!4 &2025791533
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2025791531} m_GameObject: {fileID: 1910831857}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2025791532 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
m_PrefabInstance: {fileID: 6347578781539172145}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 506813849e0819640b461c8c8c8331b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &2249596435903131709 stripped --- !u!4 &2249596435903131709 stripped
Transform: Transform:
m_CorrespondingSourceObject: {fileID: 6873339892592015098, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3} m_CorrespondingSourceObject: {fileID: 6873339892592015098, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
@ -600,3 +614,68 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 01fa89ab9028c864b8560621b7d51f50, type: 3}
--- !u!1001 &6347578781539172145
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 6347578780605603610, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_Name
value: ChunkPool
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603612, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: prefab
value:
objectReference: {fileID: 7423857566743054097, guid: 9b90fe6584244f945a5cf4bfffd577c7, type: 3}
- target: {fileID: 6347578780605603613, guid: f1719db018a1324408d90c8d16384871, type: 3}
propertyPath: spawner
value:
objectReference: {fileID: 1872880027}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f1719db018a1324408d90c8d16384871, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5222042de9f204c4e957c6f9751bcff4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,9 +4,20 @@ using UnityEngine;
public static class RandomExtentions public static class RandomExtentions
{ {
public static bool IsEmpty<T>(this List<T> list)
{
return list.Count == 0 ? true : false;
}
public static T GetRandomElement<T>(this List<T> list) public static T GetRandomElement<T>(this List<T> list)
{ {
return list[Random.Range(0, list.Count)]; return list[Random.Range(0, list.Count)];
} }
public static bool GetRandomElement<T>(this List<T> list, out T element)
{
element = default(T);
if (list.IsEmpty())
return false;
element = list[Random.Range(0, list.Count)];
return true;
}
} }

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8e1ed4f33777bdd4983d5561b1f47a35
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2f4db8c4fe9d9ff4ba7ddd651102dcdb guid: 4d090d5d1f498694295ca089f41ac4bd
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 582e175196e55fa448354c86384b3c19 guid: 047d01680e1795b449b9df2738021331
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: eb80cc0c16ecf014d91cf9778cce5499 guid: f074f90b920b2b443b4ea90f974fab5b
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -7,39 +7,38 @@ interface IObstacle
public void Impact(); public void Impact();
} }
[RequireComponent(typeof(BoxCollider))] [RequireComponent(typeof(BoxCollider))]
//[RequireComponent(typeof(Renderer))]
public class Obstacle : MonoBehaviour,IObstacle,IDamageDealer,IResettable public class Obstacle : MonoBehaviour,IObstacle,IDamageDealer,IResettable,IPoolable<Obstacle>
{ {
public BoxCollider Collider { get; private set; } public BoxCollider Collider { get; private set; }
public BasePool<Obstacle> OwningPool { private get; set; }
//private Renderer defaultRenderer;
//private Renderer obstacleRenderer;
private void Awake() private void Awake()
{ {
Collider = GetComponent<BoxCollider>(); Collider = GetComponent<BoxCollider>();
//defaultRenderer = GetComponent<Renderer>();
//obstacleRenderer = defaultRenderer;
} }
public void ResetToDefault() public void ResetToDefault()
{ {
//if (obstacleRenderer.material.color != defaultRenderer.material.color) transform.localPosition = Vector3.zero;
// obstacleRenderer.material.color = defaultRenderer.material.color; transform.position = Vector3.zero;
//gameObject.transform.localRotation = Quaternion.identity; transform.rotation = Quaternion.identity;
//gameObject.transform.localScale = Vector3.one; gameObject.transform.SetParent(OwningPool.transform);
// gameObject.transform.localPosition = Vector3.zero; ReturnToPool();
gameObject.SetActive(false);
gameObject.transform.SetParent(null);
} }
public void Impact() public void Impact()
{ {
//obstacleRenderer.material.color = Color.red; ResetToDefault();
gameObject.SetActive(false);
} }
public void DealDamage(IDamageable target, int amount) public void DealDamage(IDamageable target, int amount)
{ {
target.TakeDamage(amount); target.TakeDamage(amount);
} }
public void ReturnToPool()
{
OwningPool.ReturnToPool(this);
}
} }
public class Turret : MonoBehaviour, IObstacle, IDamageDealer, IResettable public class Turret : MonoBehaviour, IObstacle, IDamageDealer, IResettable

View File

@ -5,11 +5,11 @@ using UnityEngine;
public class PlayerAnimator public class PlayerAnimator
{ {
private Animator animator; private Animator animator;
private string runningAnimStr = "Run"; //HASH private int runningHash = Animator.StringToHash("Run");
private string deadAnimStr = "Dead"; private int deadHash = Animator.StringToHash("Dead");
private string jumpAnimStr = "Jump"; private int jumpHash = Animator.StringToHash("Jump");
private string slideAnimStr = "Slide"; private int slideHash = Animator.StringToHash("Slide");
private string idleAnimStr = "Idle"; private int idleHash = Animator.StringToHash("Idle");
public PlayerAnimator(Animator animator) public PlayerAnimator(Animator animator)
{ {
@ -18,22 +18,22 @@ public class PlayerAnimator
} }
public void SetRunState(bool isRunning) public void SetRunState(bool isRunning)
{ {
animator?.SetBool(runningAnimStr, isRunning); animator?.SetBool(runningHash, isRunning);
} }
public void SetJumpState(bool isJumping) public void SetJumpState(bool isJumping)
{ {
animator?.SetBool(jumpAnimStr, isJumping); animator?.SetBool(jumpHash, isJumping);
} }
public void SetDeadState(bool isDead) public void SetDeadState(bool isDead)
{ {
animator?.SetBool(deadAnimStr, isDead); animator?.SetBool(deadHash, isDead);
} }
public void SetSlideState(bool isSliding) public void SetSlideState(bool isSliding)
{ {
animator?.SetBool(slideAnimStr, isSliding); animator?.SetBool(slideHash, isSliding);
} }
public void SetIdleState(bool isIdle) public void SetIdleState(bool isIdle)
{ {
animator?.SetBool(idleAnimStr, isIdle); animator?.SetBool(idleHash, isIdle);
} }
} }

View File

@ -4,9 +4,10 @@ using UnityEngine;
public class ChunkGenerationFromPrefab //: IChunkGenerationStrategy public class ChunkGenerationFromPrefab //: IChunkGenerationStrategy
{ {
[SerializeField] private readonly List<Chunk> chunks = new List<Chunk>();
public void Generate() public void Generate()
{ {
// throw new System.NotImplementedException();
} }
} }

View File

@ -9,11 +9,10 @@ public class ChunkGenerator : MonoBehaviour
[SerializeField] private LaneSystem LaneSystem; [SerializeField] private LaneSystem LaneSystem;
[SerializeField] private int gridColumns; [SerializeField] private int gridColumns;
public CoinPool CoinPool { get; private set; } public CoinPool CoinPool { get; private set; }
public ObstaclePool ObstaclePool { get; private set; } [field: SerializeField] public List<ObstaclePool> ObstaclePools { get; private set; }
private void Awake() private void Awake()
{ {
//obstacleSize = obstaclePrefab.GetComponent<BoxCollider>().size; //obstacleSize = obstaclePrefab.GetComponent<BoxCollider>().size;
//coinSize = coinPrefab.GetComponent<BoxCollider>().size; //coinSize = coinPrefab.GetComponent<BoxCollider>().size;
//CoinPool = GetComponent<CoinPool>(); //CoinPool = GetComponent<CoinPool>();
@ -23,21 +22,12 @@ public class ChunkGenerator : MonoBehaviour
} }
public Chunk Generate(Chunk chunkToFill) public Chunk Generate(Chunk chunkToFill)
{ {
var obstacle = Instantiate(obstaclePrefab); //var obstacle = Instantiate(obstaclePrefab);
List<Vector3> gridPositions = new List<Vector3>(); var obstaclePool = ObstaclePools.GetRandomElement();
foreach (var lane in LaneSystem.Lanes) var obstacle = obstaclePool.GetFromPool();
{
float lanePosition = lane * LaneSystem.LaneWidth;
for (int i = 0; i < gridColumns; i++)
{
Vector3 gridPosition = new Vector3(lanePosition,0, i * obstacle.Collider.size.z);
gridPositions.Add(gridPosition);
}
}
chunkToFill.Obstacles.Add(obstacle); chunkToFill.Obstacles.Add(obstacle);
obstacle.transform.SetParent(chunkToFill.transform, false); obstacle.transform.SetParent(chunkToFill.transform, true);
obstacle.transform.localPosition = gridPositions.GetRandomElement(); obstacle.transform.localPosition = chunkToFill.GridPositions.GetRandomElement();
//// int randomChunkPrefab = Random.Range(0, chunkPrefabs.Count); //// int randomChunkPrefab = Random.Range(0, chunkPrefabs.Count);
////Chunk chunk = Instantiate(chunkPrefabs[randomChunkPrefab], new Vector3(), new Quaternion()); ////Chunk chunk = Instantiate(chunkPrefabs[randomChunkPrefab], new Vector3(), new Quaternion());
//Obstacle obstacle = ObstaclePool.GetFromPool();//chunkToFill.ObstaclePool.Get(); //Obstacle obstacle = ObstaclePool.GetFromPool();//chunkToFill.ObstaclePool.Get();

View File

@ -5,18 +5,21 @@ using UnityEngine;
public enum EDirection { NORTH, SOUTH, EAST, WEST } public enum EDirection { NORTH, SOUTH, EAST, WEST }
[RequireComponent(typeof(BoxCollider))] [RequireComponent(typeof(BoxCollider))]
public abstract class Chunk : MonoBehaviour, IResettable public abstract class Chunk : MonoBehaviour, IResettable,IPoolable<Chunk>
{ {
protected ChunkSpawner spawner; protected ChunkSpawner spawner;
[field: SerializeField] public Transform Begin { get; private set; } [field: SerializeField] public Transform Begin { get; private set; }
[field: SerializeField] public Transform End { get; private set; } [field: SerializeField] public Transform End { get; private set; }
[SerializeField] private int gridRowCount;
public List<Coin> Coins { get; private set; } public List<Coin> Coins { get; private set; }
public List<Obstacle> Obstacles { get; private set; } public List<Obstacle> Obstacles { get; private set; }
public BoxCollider Collider { get; private set; } public BoxCollider Collider { get; private set; }
public EDirection Direction { get; protected set; } public EDirection Direction { get; protected set; }
public BasePool<Chunk> OwningPool { private get; set; }
public readonly List<Vector3> GridPositions = new List<Vector3>();
virtual public void Init(ChunkSpawner spawner) virtual public void Init(ChunkSpawner spawner)
{ {
this.spawner = spawner; this.spawner = spawner;
@ -25,7 +28,25 @@ public abstract class Chunk : MonoBehaviour, IResettable
{ {
Collider = GetComponent<BoxCollider>(); Collider = GetComponent<BoxCollider>();
Coins = new List<Coin>(); Coins = new List<Coin>();
Obstacles = new List<Obstacle>(); Obstacles = new List<Obstacle>();
InitializeGrid();
}
private void InitializeGrid()
{
float chunkLength = (End.position - Begin.position).magnitude;
float rowLength = chunkLength / gridRowCount;
foreach (var lane in LaneSystem.Instance.Lanes)
{
float lanePosition = lane * LaneSystem.Instance.LaneWidth;
for (int i = 0; i < gridRowCount; i++)
{
Vector3 gridPosition = new Vector3(lanePosition, 0, i * rowLength);
GridPositions.Add(gridPosition);
}
}
} }
public void ResetToDefault() public void ResetToDefault()
@ -38,22 +59,20 @@ public abstract class Chunk : MonoBehaviour, IResettable
{ {
if (other.TryGetComponent(out Player player)) if (other.TryGetComponent(out Player player))
{ {
//OnChunkPassed?.Invoke(this);
spawner.DelayedReturnToPool(this); spawner.DelayedReturnToPool(this);
spawner.Spawn(); spawner.Spawn();
} }
} }
//public bool IsOnCooldown()
//{
// return spawnCooldown > timeSinceLastSpawn ? true : false;
//}
public void ChangeTransformBasedOnPreviousChunk(Chunk previousChunk) public void ChangeTransformBasedOnPreviousChunk(Chunk previousChunk)
{ {
ChangeDirectionBasedOnPreviousChunk(previousChunk); ChangeDirectionBasedOnPreviousChunk(previousChunk);
ChangePositionBasedOnPreviousChunk(previousChunk); ChangePositionBasedOnPreviousChunk(previousChunk);
ChangeRotationBasedOnPreviousChunk(previousChunk); ChangeRotationBasedOnPreviousChunk(previousChunk);
} }
abstract public void ChangeDirectionBasedOnPreviousChunk(Chunk previousChunk); abstract public void ChangeDirectionBasedOnPreviousChunk(Chunk previousChunk);
private void ChangePositionBasedOnPreviousChunk(Chunk previousChunk) private void ChangePositionBasedOnPreviousChunk(Chunk previousChunk)
{ {
float diffBetweenBeginAndCenter = Begin.localPosition.z; float diffBetweenBeginAndCenter = Begin.localPosition.z;
@ -92,4 +111,9 @@ public abstract class Chunk : MonoBehaviour, IResettable
break; break;
} }
} }
public void ReturnToPool()
{
OwningPool.ReturnToPool(this);
}
} }

View File

@ -4,6 +4,7 @@ using UnityEngine;
public class LaneSystem : MonoBehaviour,IResettable public class LaneSystem : MonoBehaviour,IResettable
{ {
static public LaneSystem Instance { get; private set; }
[field: SerializeField] public float LaneWidth { get; private set; } [field: SerializeField] public float LaneWidth { get; private set; }
[SerializeField] private int laneCount; [SerializeField] private int laneCount;
@ -17,6 +18,7 @@ public class LaneSystem : MonoBehaviour,IResettable
private void Awake() private void Awake()
{ {
Instance = this;
Lanes = new List<int>(laneCount); Lanes = new List<int>(laneCount);
bool isLanesEven = laneCount % 2 == 0; bool isLanesEven = laneCount % 2 == 0;
if (isLanesEven) if (isLanesEven)

View File

@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
public class BasePool<T> : MonoBehaviour where T : MonoBehaviour public class BasePool<T> : MonoBehaviour where T : MonoBehaviour,IPoolable<T>
{ {
[field: SerializeField] public int Capacity { get; private set; } [field: SerializeField] public int Capacity { get; private set; }
[SerializeField] private T prefab; [SerializeField] private T prefab;
@ -16,6 +16,7 @@ public class BasePool<T> : MonoBehaviour where T : MonoBehaviour
T instance = Instantiate(prefab); T instance = Instantiate(prefab);
instance.gameObject.SetActive(false); instance.gameObject.SetActive(false);
instance.transform.SetParent(gameObject.transform, false); instance.transform.SetParent(gameObject.transform, false);
instance.OwningPool = this;
return instance; return instance;
} }

View File

@ -27,7 +27,6 @@ public class ChunkPool : BasePool<Chunk>
chunk.Coins.Clear(); chunk.Coins.Clear();
foreach (var obstacle in chunk.Obstacles) foreach (var obstacle in chunk.Obstacles)
{ {
obstacle.transform.SetParent(null);
obstacle.ResetToDefault(); obstacle.ResetToDefault();
} }
chunk.Obstacles.Clear(); chunk.Obstacles.Clear();

View File

@ -0,0 +1,8 @@

using UnityEngine;
public interface IPoolable<T> where T : MonoBehaviour,IPoolable<T>
{
public BasePool<T> OwningPool { set; }
public void ReturnToPool();
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2abb11f088e64c4488227070b7765d68
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,7 +12,7 @@ public class ObjectPool<T> : IEnumerable<T> where T : MonoBehaviour
private Action<T> actionOnRelease; private Action<T> actionOnRelease;
private List<T> pool; private List<T> pool;
private List<T> inactiveElements;
public ObjectPool(Func<T> actionOnCreate, Action<T> actionOnGet, Action<T> actionOnRelease, int initialCapacity) public ObjectPool(Func<T> actionOnCreate, Action<T> actionOnGet, Action<T> actionOnRelease, int initialCapacity)
{ {
Capacity = initialCapacity; Capacity = initialCapacity;
@ -80,14 +80,17 @@ public class ObjectPool<T> : IEnumerable<T> where T : MonoBehaviour
element = null; element = null;
return false; return false;
} }
public List<T> GetInactiveElements() public List<T> GetInactiveElements()
{ {
return pool.FindAll(obj => !obj.gameObject.activeInHierarchy); return pool.FindAll(obj => !obj.gameObject.activeInHierarchy);
} }
public List<T> GetActiveElements() public List<T> GetActiveElements()
{ {
return pool.FindAll(obj => obj.gameObject.activeInHierarchy); return pool.FindAll(obj => obj.gameObject.activeInHierarchy);
} }
public T ExpandPool() public T ExpandPool()
{ {
var obj = actionOnCreate(); var obj = actionOnCreate();
@ -95,6 +98,7 @@ public class ObjectPool<T> : IEnumerable<T> where T : MonoBehaviour
pool.Add(obj); pool.Add(obj);
return obj; return obj;
} }
public void ReturnToPool(T obj) public void ReturnToPool(T obj)
{ {
if (obj == null) if (obj == null)
@ -105,6 +109,7 @@ public class ObjectPool<T> : IEnumerable<T> where T : MonoBehaviour
} }
return; return;
} }
public IEnumerator<T> GetEnumerator() public IEnumerator<T> GetEnumerator()
{ {
return pool.GetEnumerator(); return pool.GetEnumerator();

View File

@ -1,5 +1,7 @@
using System; using System;
using UnityEngine; using UnityEngine;
public class ObstaclePool : BasePool<Chunk> public class ObstaclePool : BasePool<Obstacle>
{ } {
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 35b79b54978109946b1feaeb0cbd14a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
public static class PoolPrefabCreator
{
private const string POOL_PREFAB_PATH = "Assets/Prefabs/Pools/";
//[MenuItem("Tools/Prefab/CreatePoolPrefabFromSelected")]
//private static void CreatePoolPrefab()
//{
// GameObject loadedPrefab = PrefabUtility.GetPrefabInstanceHandle(Selection.activeObject) as GameObject;
// if ((Selection.activeObject as GameObject).TryGetComponent(out IPoolable<loadedPrefab as MonoBehaviour> poolable))
// {
// MonoBehaviour mono = poolable as MonoBehaviour;
// GameObject instance = PrefabUtility.InstantiatePrefab(mono) as GameObject;
// MonoBehaviour poolGameObject = new GameObject().AddComponent<BasePool<MonoBehaviour>>();
// var poolComponent = poolGameObject.GetComponent<BasePool<MonoBehaviour>>();
// //poolGameObject.
// //if (OnCreateRequest != null)
// // return OnCreateRequest();
// //var t = typeof(T);
// //if (typeof(Component).IsAssignableFrom(t))
// // return (new GameObject(t.Name)).AddComponent<T>();
// //return System.Activator.CreateInstance<T>();
// var pool = PrefabUtility.InstantiatePrefab(poolComponent);
// PrefabUtility.SaveAsPrefabAsset(pool as GameObject, POOL_PREFAB_PATH);
// }
// //= new List<Image>(loadedPrefab.GetComponent<Image>());
// // = PrefabUtility.InstantiatePrefab(Selection.activeObject as GameObject);
// //BasePool<MonoBehaviour> pool = GameObject.Instantiate();
//}
//[MenuItem("Tools/Prefab/CreatePoolPrefabFromSelected", true)]
//private static bool ValidateInstantiatePrefab()
//{
// GameObject go = Selection.activeObject as GameObject;
// if (go == null)
// return false;
// return PrefabUtility.IsPartOfPrefabAsset(go);
//}
}
#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a274b7bec54ceab4cb23781963b348c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: