mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
corrigé bug dashing et angle négatif (trouvais pas l'index des plateaux)
This commit is contained in:
parent
119ae969c3
commit
4d6094b40f
@ -51,8 +51,6 @@ public class AsteroidSpawner : TimerFunctionsClass
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Cooldown untill next random spawn
|
||||
SetTimer(NextSpawnTime, SpawnAsteroidEvent);
|
||||
StartTimer();
|
||||
|
||||
@ -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 (Time.time < DashTime + lastDashTime)
|
||||
return;
|
||||
|
||||
if (_state >= AstronautState.Ejecting)
|
||||
return;
|
||||
|
||||
lastDashTime = Time.time;
|
||||
planet.PushWedge(this.theta);
|
||||
}
|
||||
|
||||
|
||||
@ -52,8 +52,11 @@ public class AstronautController : MonoBehaviour {
|
||||
if (input.Ranges.ContainsKey("Dash"))
|
||||
{
|
||||
if (input.Ranges["Dash"] > 0.8f)
|
||||
{
|
||||
_astronaut.Dash();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void HandlePlayerButtons(MappedInput input)
|
||||
|
||||
@ -213,7 +213,7 @@ public class PlanetManager : MonoBehaviour
|
||||
/// <returns></returns>
|
||||
public Wedge GetWedgeFromTheta(float thetaPlayerX)
|
||||
{
|
||||
return wedges[GetWedgeIndex(thetaPlayerX)];
|
||||
return wedges[GetWedgeIndex(thetaPlayerX % 360)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user