diff --git a/Assets/Scripts/AsteroidSpawner.cs b/Assets/Scripts/AsteroidSpawner.cs
index f837b34..f915a1e 100644
--- a/Assets/Scripts/AsteroidSpawner.cs
+++ b/Assets/Scripts/AsteroidSpawner.cs
@@ -51,8 +51,6 @@ public class AsteroidSpawner : TimerFunctionsClass
}
-
-
//Cooldown untill next random spawn
SetTimer(NextSpawnTime, SpawnAsteroidEvent);
StartTimer();
diff --git a/Assets/Scripts/Astronaut.cs b/Assets/Scripts/Astronaut.cs
index 0beaf1b..e37c886 100644
--- a/Assets/Scripts/Astronaut.cs
+++ b/Assets/Scripts/Astronaut.cs
@@ -13,7 +13,8 @@ public class Astronaut : MonoBehaviour {
public GameObject SpriteDash;
public float Width;
-
+ public float DashTime = 0.4f; //Temps de l'animation et rate limiting
+ private float lastDashTime = 0f;
public float StepTime;
public float JumpSpeed;
public float Gravity;
@@ -185,7 +186,7 @@ public class Astronaut : MonoBehaviour {
float movement = PlanetUtilities.GetDisplacementAngle(Speed * -x, height) * Time.deltaTime;
//Debug.Log("Moving! - " + height);
//Debug.Log("Daaa - " + movement);
- float newTheta = theta + movement;
+ float newTheta = (360 + theta + movement) % 360; // angle positif
float newHeight = GetGroundRadius(newTheta);
if (newHeight > height)
@@ -210,9 +211,14 @@ public class Astronaut : MonoBehaviour {
public void Dash()
{
- if (_state >= AstronautState.Ejecting)
- return;
+
+ if (Time.time < DashTime + lastDashTime)
+ return;
+
+ if (_state >= AstronautState.Ejecting)
+ return;
+ lastDashTime = Time.time;
planet.PushWedge(this.theta);
}
diff --git a/Assets/Scripts/AstronautController.cs b/Assets/Scripts/AstronautController.cs
index 0492100..ecd56b0 100644
--- a/Assets/Scripts/AstronautController.cs
+++ b/Assets/Scripts/AstronautController.cs
@@ -51,8 +51,11 @@ public class AstronautController : MonoBehaviour {
if (input.Ranges.ContainsKey("Dash"))
{
- if(input.Ranges["Dash"] > 0.8f)
- _astronaut.Dash();
+ if (input.Ranges["Dash"] > 0.8f)
+ {
+ _astronaut.Dash();
+ }
+
}
}
diff --git a/Assets/Scripts/PlanetManager.cs b/Assets/Scripts/PlanetManager.cs
index 9bf9861..ad5f38e 100644
--- a/Assets/Scripts/PlanetManager.cs
+++ b/Assets/Scripts/PlanetManager.cs
@@ -213,7 +213,7 @@ public class PlanetManager : MonoBehaviour
///
public Wedge GetWedgeFromTheta(float thetaPlayerX)
{
- return wedges[GetWedgeIndex(thetaPlayerX)];
+ return wedges[GetWedgeIndex(thetaPlayerX % 360)];
}
///