Compare commits

...

4 Commits

Author SHA1 Message Date
djelalb
58f774fc7e
feat: ship rotation (#47)
Co-authored-by: Djelal BOUDJI <djelal@gmail.com>
2025-03-17 18:29:15 +01:00
872772d3f0
feat: level progression (#46) 2025-03-17 18:28:27 +01:00
a9bd2a0048
feat: stats display (#45) 2025-03-17 11:49:34 +01:00
djelalb
28e56eeab7
feat: rocket mode (#44)
Co-authored-by: Djelal BOUDJI <djelal@gmail.com>
2025-03-17 11:49:13 +01:00
46 changed files with 3773 additions and 553 deletions

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: 2eeb2639073421549a957b59aa116784
TextureImporter:
internalIDToNameTable:
- first:
213: -799402021850825835
second: CubePortalLabelled_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: CubePortalLabelled_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 60
height: 106
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 59b3ad6b814f7e4f0800000000000000
internalID: -799402021850825835
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
CubePortalLabelled_0: -799402021850825835
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: e9bcb21c2aae82043a99ea5327800507
TextureImporter:
internalIDToNameTable:
- first:
213: 4275758854765845916
second: GravityPortalALabelled_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: GravityPortalALabelled_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 62
height: 100
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: c9d9c83460c865b30800000000000000
internalID: 4275758854765845916
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
GravityPortalALabelled_0: 4275758854765845916
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: 2dcef44df104b9e458e1f87a0e0c8e96
TextureImporter:
internalIDToNameTable:
- first:
213: -3032260323236093396
second: GravityPortalBLabelled_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: GravityPortalBLabelled_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 62
height: 100
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: c2260073d4f3be5d0800000000000000
internalID: -3032260323236093396
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
GravityPortalBLabelled_0: -3032260323236093396
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: b1045b8864d217948b2b89134b7f9b32
TextureImporter:
internalIDToNameTable:
- first:
213: -1834338360412052916
second: ShipPortalLabelled_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: ShipPortalLabelled_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 60
height: 106
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: c4264cddafe1b86e0800000000000000
internalID: -1834338360412052916
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
ShipPortalLabelled_0: -1834338360412052916
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/InGame/Ship.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

156
Assets/InGame/Ship.png.meta Normal file
View File

@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: b8a4f3964e9272742a5ce8da53101464
TextureImporter:
internalIDToNameTable:
- first:
213: -8820715720815460284
second: Ship_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: Ship_0
rect:
serializedVersion: 2
x: 5
y: 21
width: 152
height: 121
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 440471c39c5869580800000000000000
internalID: -8820715720815460284
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
Ship_0: -8820715720815460284
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,12 +6,16 @@
{
"type": "Spike",
"x": -6.684000015258789,
"y": -2.8970000743865969
"y": -2.8970000743865969,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": -3.059999942779541,
"y": -2.930000066757202
"y": -2.930000066757202,
"scaleX": -1.0,
"scaleY": -1.0
}
]
}

View File

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

View File

@ -0,0 +1,136 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8236514094695688791
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7955136512414772159}
- component: {fileID: 1668567854769530430}
- component: {fileID: 5116869396327480279}
m_Layer: 0
m_Name: CubePortal
m_TagString: CubePortal
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7955136512414772159
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8236514094695688791}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.39697838, y: -2.9654331, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &1668567854769530430
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8236514094695688791}
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_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: -799402021850825835, guid: 2eeb2639073421549a957b59aa116784, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.6, y: 1.06}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &5116869396327480279
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8236514094695688791}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.6, y: 1.06}
newSize: {x: 0.6, y: 1.06}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.6, y: 1.06}
m_EdgeRadius: 0

View File

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

View File

@ -0,0 +1,136 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1505402932241744518
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1476280284233210953}
- component: {fileID: 9002507961259566498}
- component: {fileID: 7811141053745772278}
m_Layer: 0
m_Name: ShipPortal
m_TagString: ShipPortal
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1476280284233210953
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1505402932241744518}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -11.48, y: -2.88, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &9002507961259566498
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1505402932241744518}
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_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: -1834338360412052916, guid: b1045b8864d217948b2b89134b7f9b32, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.6, y: 1.06}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &7811141053745772278
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1505402932241744518}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.6, y: 1.06}
newSize: {x: 0.6, y: 1.06}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.6, y: 1.06}
m_EdgeRadius: 0

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,156 @@
fileFormatVersion: 2
guid: 5cc2a94ea387e024a876d225efcfd7fb
TextureImporter:
internalIDToNameTable:
- first:
213: -5986989983176976689
second: BaseSquare_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: BaseSquare_0
rect:
serializedVersion: 2
x: 35
y: 23
width: 79
height: 79
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: fc61aeaa450f9eca0800000000000000
internalID: -5986989983176976689
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
BaseSquare_0: -5986989983176976689
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,143 @@
fileFormatVersion: 2
guid: 0eaa34404437fe54aaa454f7c0c88872
TextureImporter:
internalIDToNameTable:
- first:
213: -8820715720815460284
second: Ship_0
externalObjects: {}
serializedVersion: 13
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 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: 2
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
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: Ship_0
rect:
serializedVersion: 2
x: 5
y: 21
width: 152
height: 121
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 440471c39c5869580800000000000000
internalID: -8820715720815460284
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
Ship_0: -8820715720815460284
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -506,7 +506,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
@ -671,6 +671,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4c3543e79f987af40bbd4a51c0a334c3, type: 3}
m_Name:
m_EditorClassIdentifier:
levels: []
levelCurrent:
name:
musicName:
order: 0
elements: []
--- !u!4 &1832520163
Transform:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,8 @@
using UnityEngine;
public interface IGameMode
{
void Update(Player player);
void OnCollisionEnter(Player player, Collision2D collision);
void OnCollisionExit(Player player, Collision2D collision);
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 68e961c0b929a2a4d9e92b2f2bf9e197

View File

@ -0,0 +1,78 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class NormalGameMode : IGameMode
{
private const float HorizontalSpeed = 8.6f;
private const float JumpForce = 26.6581f;
private const KeyCode JumpKey = KeyCode.Space;
public void Update(Player player)
{
player.RigidBody.linearVelocity = new Vector2(HorizontalSpeed, player.RigidBody.linearVelocity.y);
if (player.HasStarted && player.IsColliding && Input.GetKey(JumpKey) && player.CanJump)
{
Jump(player);
}
if (!IsJumping(player))
{
AlignRotation(player);
player.Particle.gameObject.SetActive(true);
}
else
{
player.Particle.gameObject.SetActive(false);
player.Transform.Rotate(Vector3.back * 360 * Time.deltaTime);
}
UpdateParticlePositionAndRotation(player);
}
private void Jump(Player player)
{
player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0);
player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse);
player.LevelsLoader.IncreaseTotalJumps();
}
private bool IsJumping(Player player)
{
return !player.IsColliding;
}
private void AlignRotation(Player player)
{
Vector3 rotation = player.Transform.rotation.eulerAngles;
rotation.z = Mathf.Round(rotation.z / 90) * 90;
player.Transform.rotation = Quaternion.Euler(rotation);
}
private void UpdateParticlePositionAndRotation(Player player)
{
player.Particle.transform.position = player.Transform.position + new Vector3(-0.19f, -0.64f, -10);
player.Particle.transform.rotation = Quaternion.Euler(0, 0, 150.464f);
}
public void OnCollisionEnter(Player player, Collision2D collision)
{
player.IsColliding = true;
player.CanJump = true;
if (collision.gameObject.CompareTag("Kill"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
if (collision.gameObject.CompareTag("Win"))
{
SceneManager.LoadScene("SelectLevelScene");
}
}
public void OnCollisionExit(Player player, Collision2D collision)
{
player.IsColliding = false;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 222f727842e308847a028d3fce55d364

View File

@ -0,0 +1,68 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class ShipGameMode : IGameMode
{
private const float HorizontalSpeed = 8.6f;
private const float JumpForce = 26.6581f;
private const KeyCode JumpKey = KeyCode.Space;
private const float UpperAngle = 45f;
private const float LowerAngle = -45f;
private const float RotationLerpSpeed = 5f;
public void Update(Player player)
{
player.RigidBody.linearVelocity = new Vector2(HorizontalSpeed, player.RigidBody.linearVelocity.y);
if (player.HasStarted && Input.GetKey(JumpKey))
{
Jump(player);
}
float targetAngle = Input.GetKey(JumpKey) ? UpperAngle : LowerAngle;
float currentAngle = player.Transform.rotation.eulerAngles.z;
if (currentAngle > 180f)
currentAngle -= 360f;
float newAngle = Mathf.Lerp(currentAngle, targetAngle, RotationLerpSpeed * Time.deltaTime);
player.Transform.rotation = Quaternion.Euler(0, 0, newAngle);
UpdateParticlePositionAndRotation(player);
}
private void UpdateParticlePositionAndRotation(Player player)
{
player.Particle.transform.position = player.Transform.position + new Vector3(-0.19f, -0.64f, -10);
player.Particle.transform.rotation = Quaternion.Euler(0, 0, 150.464f);
}
private void Jump(Player player)
{
player.RigidBody.linearVelocity = new Vector2(player.RigidBody.linearVelocity.x, 0);
player.RigidBody.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse);
player.LevelsLoader.IncreaseTotalJumps();
}
public void OnCollisionEnter(Player player, Collision2D collision)
{
if (collision.gameObject.CompareTag("Kill"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
return;
}
if (collision.gameObject.CompareTag("Win"))
{
SceneManager.LoadScene("HomeScene");
return;
}
float currentAngle = player.Transform.rotation.eulerAngles.z;
float shortestAngle = Mathf.DeltaAngle(currentAngle, 0);
player.Transform.rotation = Quaternion.RotateTowards(player.Transform.rotation, Quaternion.Euler(0, 0, 0), Mathf.Abs(shortestAngle));
}
public void OnCollisionExit(Player player, Collision2D collision)
{
// rien pour l'instant
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 28b5f8f9214141740af5157d6b421677

View File

@ -16,9 +16,12 @@ public class LevelElement
[System.Serializable]
public class Level
{
public static readonly int LAST_X = 15;
public string JsonName { get; set; }
public int TotalJumps { get; set; }
public int TotalAttempts { get; set; }
public int ProgressionPercent { get; set; }
public int ProgressionPercentMax { get; set; }
public string name;
public string musicName;
@ -26,6 +29,20 @@ public class Level
public List<LevelElement> elements;
public float LastX
{
get
{
LevelElement lastElement = elements[^1];
float lastX = LAST_X;
if (lastElement != null)
{
lastX += lastElement.x;
}
return lastX;
}
}
public static Level CreateFromJSON(string jsonString)
{
return JsonUtility.FromJson<Level>(jsonString);

View File

@ -1,10 +1,12 @@
using UnityEngine;
using UnityEngine.UI;
using System.IO;
public class LevelLoader : MonoBehaviour
{
public LevelsLoader levelsLoader;
public AudioSource audioSource;
public Text progressionText;
private GameObject GetPrefab(string type)
{
@ -31,14 +33,7 @@ public class LevelLoader : MonoBehaviour
instance.transform.localScale = new Vector3(newScaleX, newScaleY, originalScale.z);
}
LevelElement lastElement = current.elements[^1];
float lastX = 15;
if (lastElement != null)
{
lastX += lastElement.x;
}
Instantiate(GetPrefab("WinnerWall"), new Vector3(lastX, 0, 0), Quaternion.Euler(0, 0, 90));
Instantiate(GetPrefab("WinnerWall"), new Vector3(current.LastX, 0, 0), Quaternion.Euler(0, 0, 90));
}
public void Start()
@ -52,6 +47,7 @@ public class LevelLoader : MonoBehaviour
public void Update()
{
Level current = levelsLoader.levelCurrent;
progressionText.text = current.ProgressionPercent + "%";
}
}

View File

@ -7,6 +7,7 @@ public class LevelStat
public int totalJumps;
public int totalAttempts;
public int progressionPercent;
public static LevelStat CreateFromJSON(string jsonString)
{

View File

@ -1,6 +1,7 @@
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System;
public class LevelsLoader : MonoBehaviour
{
@ -33,11 +34,14 @@ public class LevelsLoader : MonoBehaviour
level.JsonName = jsonTextFile.name;
level.TotalAttempts = 0;
level.TotalJumps = 0;
level.ProgressionPercent = 0;
level.ProgressionPercentMax = 0;
if (levelStatsMap.TryGetValue(level.JsonName, out LevelStat levelStat))
{
level.TotalJumps = levelStat.totalJumps;
level.TotalAttempts = levelStat.totalAttempts;
level.TotalJumps = levelStat.totalJumps;
level.ProgressionPercentMax = levelStat.progressionPercent;
}
else
{
@ -59,7 +63,8 @@ public class LevelsLoader : MonoBehaviour
{
JsonName = levelCurrent.JsonName,
totalJumps = levelCurrent.TotalJumps,
totalAttempts = levelCurrent.TotalAttempts
totalAttempts = levelCurrent.TotalAttempts,
progressionPercent = levelCurrent.ProgressionPercentMax,
};
string levelStatJson = JsonUtility.ToJson(levelStat, true) + "\n";
File.WriteAllText(Path.Combine(Application.dataPath, "Resources", "LevelsStats", levelCurrent.JsonName + ".json"), levelStatJson);
@ -88,4 +93,22 @@ public class LevelsLoader : MonoBehaviour
levelCurrent.TotalAttempts += 1;
SaveLevelCurrent();
}
public int CalculateCurrentProgressionPercent(Vector3 playerPosition)
{
float lastX = levelCurrent.LastX;
GameObject winnerWallPrefab = Resources.Load<GameObject>("Prefabs/WinnerWall");
float winnerWallWidth = winnerWallPrefab.GetComponent<Renderer>().bounds.size.x;
float marginError = 0.5f;
float totalDistance = lastX - (winnerWallWidth / 2) - marginError;
float rawPercentage = (playerPosition.x / totalDistance) * 100;
int clampedPercentage = Mathf.Clamp(Mathf.RoundToInt(rawPercentage), 0, 100);
levelCurrent.ProgressionPercent = clampedPercentage;
levelCurrent.ProgressionPercentMax = Math.Max(levelCurrent.ProgressionPercentMax, levelCurrent.ProgressionPercent);
SaveLevelCurrent();
return clampedPercentage;
}
}

View File

@ -0,0 +1,25 @@
using UnityEngine;
using UnityEngine.UI;
public class LevelProgression : MonoBehaviour
{
public Text levelProgressionText;
public LevelsLoader levelsLoader;
private string GetText()
{
return "Progression Max: " + levelsLoader.levelCurrent.ProgressionPercentMax + "%";
}
public void Start()
{
levelsLoader = GameObject.FindGameObjectWithTag("LevelsLoader").GetComponent<LevelsLoader>();
levelProgressionText.text = GetText();
}
public void Update()
{
levelProgressionText.text = GetText();
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f53ed5a09d2704999b0f112382f62309

View File

@ -0,0 +1,28 @@
using System;
using UnityEngine;
using UnityEngine.UI;
public class LevelTotalAttempts : MonoBehaviour
{
public Text levelTotalAttemptsText;
public LevelsLoader levelsLoader;
private string GetText()
{
int number = levelsLoader.levelCurrent.TotalAttempts;
FormattableString message = $"{number:N0}";
return "Total Attempts: " + FormattableString.Invariant(message);
}
public void Start()
{
levelsLoader = GameObject.FindGameObjectWithTag("LevelsLoader").GetComponent<LevelsLoader>();
levelTotalAttemptsText.text = GetText();
}
public void Update()
{
levelTotalAttemptsText.text = GetText();
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c2e1b06afdba22e2e801e20c56a99a30

View File

@ -0,0 +1,28 @@
using System;
using UnityEngine;
using UnityEngine.UI;
public class LevelTotalJumps : MonoBehaviour
{
public Text levelTotalJumpsText;
public LevelsLoader levelsLoader;
private string GetText()
{
int number = levelsLoader.levelCurrent.TotalJumps;
FormattableString message = $"{number:N0}";
return "Total Jumps: " + FormattableString.Invariant(message);
}
public void Start()
{
levelsLoader = GameObject.FindGameObjectWithTag("LevelsLoader").GetComponent<LevelsLoader>();
levelTotalJumpsText.text = GetText();
}
public void Update()
{
levelTotalJumpsText.text = GetText();
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 90096cf0341a3ac178de4db506d4205c

View File

@ -0,0 +1,33 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class PauseMenu : MonoBehaviour
{
public GameObject pauseMenu;
public GameObject pauseButton;
public LevelLoader levelLoader;
public void Pause()
{
Time.timeScale = 0;
levelLoader.audioSource.Pause();
pauseMenu.SetActive(true);
pauseButton.SetActive(false);
}
public void Home()
{
Time.timeScale = 1;
SceneManager.LoadScene("HomeScene");
}
public void Resume()
{
Time.timeScale = 1;
levelLoader.audioSource.Play();
pauseMenu.SetActive(false);
pauseButton.SetActive(true);
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fe007f250f006dae5b98ae5c5a87113b

View File

@ -1,101 +1,76 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using System.IO;
public class Player : MonoBehaviour
{
public Rigidbody2D rigidBody;
public GameObject playerObject;
public ParticleSystem particle;
public LevelsLoader levelsLoader;
public Rigidbody2D RigidBody { get; private set; }
public Transform Transform { get; private set; }
public ParticleSystem Particle { get; private set; }
public LevelsLoader LevelsLoader { get; private set; }
public SpriteRenderer SpriteRenderer { get; private set; }
public bool IsColliding { get; set; } = true;
public bool HasStarted { get; private set; } = false;
public bool CanJump { get; set; } = true;
public bool isColliding = true;
private bool hasStarted = false;
public IGameMode CurrentGameMode { get; set; }
private bool canJump = true;
public void Awake()
{
RigidBody = GetComponent<Rigidbody2D>();
Transform = transform;
Particle = GetComponentInChildren<ParticleSystem>();
SpriteRenderer = GetComponentInChildren<SpriteRenderer>();
LevelsLoader = GameObject.FindGameObjectWithTag("LevelsLoader").GetComponent<LevelsLoader>();
}
public void Start()
{
levelsLoader = GameObject.FindGameObjectWithTag("LevelsLoader").GetComponent<LevelsLoader>();
var mainModule = particle.main;
var mainModule = Particle.main;
mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
particle.transform.parent = null;
Particle.transform.parent = null;
Invoke(nameof(EnableInput), 0.1f);
CurrentGameMode = new NormalGameMode();
}
private void EnableInput()
{
hasStarted = true;
HasStarted = true;
}
public void Update()
{
rigidBody.linearVelocity = new Vector2(8.6f, rigidBody.linearVelocity.y);
if (hasStarted && isColliding && Input.GetKey(KeyCode.Space) && canJump)
{
Jump();
}
if (!IsJumping())
{
AlignRotation();
particle.gameObject.SetActive(true);
}
else
{
particle.gameObject.SetActive(false);
transform.Rotate(Vector3.back * 360 * Time.deltaTime);
}
UpdateParticlePositionAndRotation();
}
private void Jump()
{
rigidBody.linearVelocity = new Vector2(rigidBody.linearVelocity.x, 0);
rigidBody.AddForce(Vector2.up * 26.6581f, ForceMode2D.Impulse);
levelsLoader.IncreaseTotalJumps();
}
private bool IsJumping()
{
return !isColliding;
}
private void AlignRotation()
{
Vector3 rotation = transform.rotation.eulerAngles;
rotation.z = Mathf.Round(rotation.z / 90) * 90;
transform.rotation = Quaternion.Euler(rotation);
}
private void UpdateParticlePositionAndRotation()
{
particle.transform.position = transform.position + new Vector3(-0.19f, -0.64f, -10);
particle.transform.rotation = Quaternion.Euler(0, 0, 150.464f);
CurrentGameMode.Update(this);
LevelsLoader.CalculateCurrentProgressionPercent(transform.position);
}
public void OnCollisionEnter2D(Collision2D collision)
{
isColliding = true;
canJump = true;
if (collision.gameObject.CompareTag("Kill"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
if (collision.gameObject.CompareTag("Win"))
{
SceneManager.LoadScene("HomeScene");
}
CurrentGameMode.OnCollisionEnter(this, collision);
}
public void OnCollisionExit2D(Collision2D collision)
{
isColliding = false;
CurrentGameMode.OnCollisionExit(this, collision);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("ShipPortal"))
{
SpriteRenderer.sprite = Resources.Load<Sprite>("Shapes/Ship");
ChangeGameMode(new ShipGameMode());
}
else if (collision.CompareTag("CubePortal"))
{
SpriteRenderer.sprite = Resources.Load<Sprite>("Shapes/BaseSquare");
ChangeGameMode(new NormalGameMode());
}
}
public void ChangeGameMode(IGameMode newMode)
{
CurrentGameMode = newMode;
}
}

View File

@ -7,6 +7,7 @@ TagManager:
- Kill
- Win
- LevelsLoader
- LevelLoader
layers:
- Default
- TransparentFX