Compare commits

...

2 Commits

Author SHA1 Message Date
Djelal BOUDJI
0c2ac9639f feat: update first level json + gantt diagram 2025-03-31 10:41:32 +02:00
djelalb
aa6401f6bc
bugfix/fix-ship (#49)
Co-authored-by: Djelal BOUDJI <djelal@gmail.com>
2025-03-31 09:57:45 +02:00
6 changed files with 1540 additions and 131 deletions

View File

@ -5,70 +5,49 @@
"elements": [
{
"type": "Spike",
"x": -9.0,
"x": -9.5,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallSpike",
"x": 0.20000004768371583,
"y": -3.4000000953674318,
"x": 2.5999999046325685,
"y": -3.4100000858306886,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 1.0,
"x": 3.4000000953674318,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 7.0,
"x": 11.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 8.0,
"x": 11.850000381469727,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 9.0,
"x": 12.850000381469727,
"y": -3.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 10.800000190734864,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 12.5,
"y": -3.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 12.5,
"y": -2.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 14.199999809265137,
"x": 14.449999809265137,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
@ -87,122 +66,731 @@
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 17.649999618530275,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 16.0,
"x": 19.049999237060548,
"y": -3.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 19.049999237060548,
"y": -2.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 19.049999237060548,
"y": -1.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 25.0,
"x": 28.5,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 26.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 42.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 43.70000076293945,
"x": 29.299999237060548,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 36.0,
"y": -3.0,
"scaleX": 2.0,
"x": 35.599998474121097,
"y": -3.0999999046325685,
"scaleX": 1.2000000476837159,
"scaleY": 0.15000000596046449
},
{
"type": "KillZone",
"x": 39.810001373291019,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 49.70000076293945,
"y": -3.0,
"scaleX": 2.0,
"x": 44.04999923706055,
"y": -3.0999999046325685,
"scaleX": 1.2000000476837159,
"scaleY": 0.15000000596046449
},
{
"type": "Spike",
"x": 44.099998474121097,
"y": -2.4200000762939455,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 48.25,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 52.45000076293945,
"y": -2.9000000953674318,
"scaleX": 1.2000000476837159,
"scaleY": 0.23000000417232514
},
{
"type": "Spike",
"x": 52.5,
"y": -2.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 58.0,
"y": -1.2000000476837159,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 61.5,
"y": 0.4000000059604645,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 65.0,
"y": 2.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 68.5,
"y": 3.5999999046325685,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 72.0,
"y": 5.199999809265137,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 56.38999938964844,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 58.22999954223633,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 60.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 61.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 62.79999923706055,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 64.5999984741211,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 66.5999984741211,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 68.19999694824219,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 69.9000015258789,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 71.69999694824219,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 73.5,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 81.94000244140625,
"y": 0.5199999809265137,
"scaleX": 3.0,
"scaleY": 1.559999942779541
},
{
"type": "ObstacleBlock",
"x": 97.30999755859375,
"y": 0.03999999910593033,
"scaleX": 3.0,
"scaleY": 1.3799999952316285
},
{
"type": "ObstacleBlock",
"x": 112.66999816894531,
"y": 0.5199999809265137,
"scaleX": 3.0,
"scaleY": 1.559999942779541
},
{
"type": "ObstacleBlock",
"x": 128.0500030517578,
"y": -0.6499999761581421,
"scaleX": 3.0,
"scaleY": 1.1100000143051148
},
{
"type": "Spike",
"x": 77.6500015258789,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 49.70000076293945,
"y": -2.200000047683716,
"x": 78.44999694824219,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 79.30999755859375,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 80.16000366210938,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 84.4800033569336,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 85.2699966430664,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 86.16000366210938,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 86.94999694824219,
"y": 4.829999923706055,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 95.87000274658203,
"y": 5.75,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 96.68000030517578,
"y": 5.75,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 97.5199966430664,
"y": 5.75,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 98.36000061035156,
"y": 5.75,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 78.54000091552735,
"y": 5.900000095367432,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 79.56999969482422,
"y": 5.900000095367432,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 85.33999633789063,
"y": 5.900000095367432,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 86.36000061035156,
"y": 5.900000095367432,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 95.8499984741211,
"y": 5.179999828338623,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 96.68000030517578,
"y": 5.179999828338623,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 97.5199966430664,
"y": 5.179999828338623,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 98.36000061035156,
"y": 5.179999828338623,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 119.94999694824219,
"y": 4.860000133514404,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 120.87000274658203,
"y": 2.509999990463257,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 55.70000076293945,
"x": 136.5,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 57.400001525878909,
"x": 138.1999969482422,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 139.89999389648438,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 141.60000610351563,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 143.3000030517578,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 145.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 146.6999969482422,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 148.39999389648438,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 150.10000610351563,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 151.8000030517578,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 153.5,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 155.1999969482422,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 156.89999389648438,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 158.60000610351563,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 160.3000030517578,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 162.0,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 163.6999969482422,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 165.39999389648438,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 167.10000610351563,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 168.8000030517578,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "KillZone",
"x": 170.5,
"y": -3.200000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 138.5,
"y": 2.0399999618530275,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 139.33999633789063,
"y": 2.0399999618530275,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 140.17999267578126,
"y": 2.0399999618530275,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 141.02000427246095,
"y": 2.0399999618530275,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 143.3000030517578,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 144.13999938964845,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 144.97999572753907,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 145.82000732421876,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 146.66000366210938,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 147.5,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 148.33999633789063,
"y": 0.8899999856948853,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 150.4199981689453,
"y": -0.3100000023841858,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 151.25,
"y": -0.3100000023841858,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 151.0800018310547,
"y": -0.3100000023841858,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 152.91000366210938,
"y": -0.3100000023841858,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 153.74000549316407,
"y": -0.3100000023841858,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 156.6999969482422,
"y": 1.2999999523162842,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 160.1999969482422,
"y": 2.9000000953674318,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 163.8000030517578,
"y": 4.5,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 167.3000030517578,
"y": 6.099999904632568,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 170.8000030517578,
"y": 7.699999809265137,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 174.3000030517578,
"y": 9.300000190734864,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 141.0,
"y": 2.609999895095825,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 148.3300018310547,
"y": 1.4700000286102296,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "Spike",
"x": 174.30999755859376,
"y": 9.859999656677246,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "ObstacleBlock",
"x": 63.400001525878909,
"y": -2.299999952316284,
"scaleX": 2.0,
"scaleY": 0.5
"x": 186.27999877929688,
"y": 0.5199999809265137,
"scaleX": 5.328000068664551,
"scaleY": 1.559999942779541
},
{
"type": "Spike",
"x": 63.400001525878909,
"y": -0.699999988079071,
"scaleX": -1.0,
"scaleY": -1.0
"type": "ObstacleBlock",
"x": 188.19000244140626,
"y": 11.899999618530274,
"scaleX": 4.590000152587891,
"scaleY": 1.559999942779541
},
{
"type": "SmallObstacleBlock",
"x": 71.80000305175781,
"y": -0.10000000149011612,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 75.69999694824219,
"y": 1.399999976158142,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 79.5999984741211,
"y": 2.700000047683716,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 83.5,
"y": 4.0,
"scaleX": -1.0,
"scaleY": -1.0
},
{
"type": "SmallObstacleBlock",
"x": 87.4000015258789,
"y": 5.300000190734863,
"type": "ShipPortal",
"x": 199.6999969482422,
"y": 5.929999828338623,
"scaleX": -1.0,
"scaleY": -1.0
}

View File

@ -72,7 +72,7 @@ TextureImporter:
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxTextureSize: 1024
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1

View File

@ -381,6 +381,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
playerObject: {fileID: 1267397455}
normalMinYFollow: 2
shipMinYFollow: 6
--- !u!1 &521952199
GameObject:
m_ObjectHideFlags: 0
@ -565,13 +567,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 725779773}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: 0.96696675, w: 0.25490257}
m_LocalPosition: {x: 0.19, y: -0.64, z: -10}
m_LocalRotation: {x: -0, y: -0, z: 0.9750753, w: 0.2218744}
m_LocalPosition: {x: 0, y: -0.52, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1267397458}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 150.464}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 154.362}
--- !u!199 &725779775
ParticleSystemRenderer:
serializedVersion: 6
@ -657,8 +659,8 @@ ParticleSystem:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 725779773}
serializedVersion: 8
lengthInSec: 5
simulationSpeed: 1
lengthInSec: 1
simulationSpeed: 1.3
stopAction: 0
cullingMode: 0
ringBufferMode: 0
@ -732,7 +734,7 @@ ParticleSystem:
startLifetime:
serializedVersion: 2
minMaxState: 0
scalar: 5
scalar: 0.5
minScalar: 5
maxCurve:
serializedVersion: 2
@ -785,7 +787,7 @@ ParticleSystem:
startSpeed:
serializedVersion: 2
minMaxState: 0
scalar: 20
scalar: 5
minScalar: 5
maxCurve:
serializedVersion: 2
@ -872,8 +874,8 @@ ParticleSystem:
m_NumAlphaKeys: 2
minGradient:
serializedVersion: 2
key0: {r: 0.6528301, g: 0.6320044, b: 0.4865432, a: 1}
key1: {r: 0.82641506, g: 0.73513323, b: 0, a: 1}
key0: {r: 0.6906728, g: 0.81325835, b: 0.8415094, a: 1}
key1: {r: 0, g: 0.5758081, b: 0.827451, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
@ -1280,15 +1282,15 @@ ParticleSystem:
ShapeModule:
serializedVersion: 6
enabled: 1
type: 4
type: 0
angle: 20
length: 5
boxThickness: {x: 0, y: 0, z: 0}
radiusThickness: 1
radiusThickness: 0
donutRadius: 0.2
m_Position: {x: 0, y: 0, z: 0}
m_Rotation: {x: 0, y: 0, z: 0}
m_Scale: {x: 1, y: 1, z: 1}
m_Position: {x: -0.000021252421, y: 0.000042931977, z: 0}
m_Rotation: {x: -0, y: 0, z: 0.6191988}
m_Scale: {x: 0.99999994, y: 0.99999994, z: 1}
placementMode: 0
m_MeshMaterialIndex: 0
m_MeshNormalOffset: 0
@ -1367,7 +1369,7 @@ ParticleSystem:
sphericalDirectionAmount: 0
randomPositionAmount: 0
radius:
value: 5
value: 1
mode: 0
spread: 0
speed:

View File

@ -6,34 +6,51 @@ 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;
private const float RotationTransitionDuration = 0.5f;
public void Update(Player player)
{
player.RigidBody.linearVelocity = new Vector2(HorizontalSpeed, player.RigidBody.linearVelocity.y);
if (player.HasStarted && Input.GetKey(JumpKey))
bool jumpPressed = Input.GetKey(JumpKey);
if (player.HasStarted && jumpPressed)
{
Jump(player);
if (Input.GetKeyDown(JumpKey))
{
player.Transform.rotation = Quaternion.Euler(0, 0, UpperAngle);
}
else
{
player.Transform.rotation = Quaternion.Euler(0, 0, UpperAngle);
}
}
else
{
float currentAngle = GetCurrentZAngle(player);
float t = Mathf.Clamp01(Time.deltaTime / RotationTransitionDuration);
float interpolationFactor = Mathf.Sin(t * (Mathf.PI / 2));
float newAngle = Mathf.Lerp(currentAngle, LowerAngle, interpolationFactor);
player.Transform.rotation = Quaternion.Euler(0, 0, newAngle);
}
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);
if (player.Particle.gameObject.activeSelf)
{
player.Particle.gameObject.SetActive(false);
}
}
private void UpdateParticlePositionAndRotation(Player player)
private float GetCurrentZAngle(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);
float angle = player.Transform.rotation.eulerAngles.z;
if (angle > 180f)
angle -= 360f;
return angle;
}
private void Jump(Player player)
@ -56,7 +73,7 @@ public class ShipGameMode : IGameMode
return;
}
float currentAngle = player.Transform.rotation.eulerAngles.z;
float currentAngle = GetCurrentZAngle(player);
float shortestAngle = Mathf.DeltaAngle(currentAngle, 0);
player.Transform.rotation = Quaternion.RotateTowards(player.Transform.rotation, Quaternion.Euler(0, 0, 0), Mathf.Abs(shortestAngle));
}

View File

@ -3,7 +3,8 @@ using UnityEngine;
public class PlayerCamera : MonoBehaviour
{
public GameObject playerObject;
public const float MIN_Y_FOLLOW = 2.0f;
public float normalMinYFollow = 2.0f;
public float shipMinYFollow = 6.0f;
private float initialY;
private void Start()
@ -13,9 +14,16 @@ public class PlayerCamera : MonoBehaviour
private void Update()
{
float targetY = initialY;
Player player = playerObject.GetComponent<Player>();
if (playerObject.transform.position.y > MIN_Y_FOLLOW)
float minYFollow = normalMinYFollow;
if (player.CurrentGameMode is ShipGameMode)
{
minYFollow = shipMinYFollow;
}
float targetY = initialY;
if (playerObject.transform.position.y > minYFollow)
{
targetY = playerObject.transform.position.y;
}

File diff suppressed because one or more lines are too long