mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
Player movement - functional
This commit is contained in:
parent
3abe330df1
commit
ffb6237071
@ -200,23 +200,15 @@ public class Astronaut : MonoBehaviour {
|
||||
|
||||
public void Move(float x, float y)
|
||||
{
|
||||
Vector3 pos = transform.position;
|
||||
pos.z = 0;
|
||||
|
||||
float playerX, playerY;
|
||||
PlanetUtilities.Spheric2Cartesian(theta, height, out playerX, out playerY);
|
||||
PlanetUtilities.Spheric2Cartesian(theta - 108, height, out playerX, out playerY);
|
||||
|
||||
Debug.Log(theta);
|
||||
//Vector3 v =
|
||||
Vector3 pos = new Vector3(playerX, playerY);
|
||||
|
||||
Vector3 dirV = Vector3.Cross(pos, Vector3.up).normalized;
|
||||
Vector3 dirV = Vector3.Cross(pos, Vector3.forward).normalized;
|
||||
float proj = Vector3.Dot(new Vector3(x, y, 0), dirV);
|
||||
//Debug.Log(proj / Time.deltaTime);
|
||||
|
||||
Debug.Log(dirV);
|
||||
|
||||
//float move = proj / Time.deltaTime; //Mathf.Abs(proj) < 0.1 ? 0 : proj;
|
||||
float move = x;
|
||||
float move = proj;
|
||||
|
||||
if (State >= AstronautState.Ejecting )
|
||||
return;
|
||||
@ -237,11 +229,10 @@ public class Astronaut : MonoBehaviour {
|
||||
if (State < AstronautState.Dashing)
|
||||
{
|
||||
if (-0.2 < move && move < 0.2) return;
|
||||
//Debug.Log(x + " " + Speed + " " + height);
|
||||
|
||||
float movement = PlanetUtilities.GetDisplacementAngle(Speed * -move, height) * Time.deltaTime;
|
||||
//Debug.Log("Moving! - " + height);
|
||||
//Debug.Log("Daaa - " + movement);
|
||||
float newTheta = (360 + theta + movement) % 360; // angle positif
|
||||
|
||||
float newTheta = Repeat(theta + movement, 360);
|
||||
|
||||
float newHeight = GetGroundRadius(newTheta);
|
||||
if (newHeight > height)
|
||||
@ -257,15 +248,10 @@ public class Astronaut : MonoBehaviour {
|
||||
//TODO arreter mouvement lateral
|
||||
State=AstronautState.Idle;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Jump()
|
||||
{
|
||||
Debug.Log("Jump!");
|
||||
|
||||
|
||||
|
||||
if (State == AstronautState.Jumping)
|
||||
{
|
||||
Dash();
|
||||
@ -278,9 +264,10 @@ public class Astronaut : MonoBehaviour {
|
||||
else if (State >= AstronautState.Ejecting)
|
||||
return;
|
||||
|
||||
if (!grounded) return;
|
||||
|
||||
_astronautAnimator.Jump(); // deja dans le property get/set
|
||||
|
||||
if (!grounded) return;
|
||||
vSpeed = JumpSpeed;
|
||||
grounded = false;
|
||||
State = AstronautState.Jumping;
|
||||
|
||||
@ -277,8 +277,7 @@ public class PlanetManager : MonoBehaviour
|
||||
/// <returns></returns>
|
||||
public Wedge GetWedgeFromTheta(float thetaPlayerX)
|
||||
{
|
||||
print(GetWedgeIndex((thetaPlayerX)%360));
|
||||
return wedges[GetWedgeIndex((thetaPlayerX) % 360)];
|
||||
return wedges[GetWedgeIndex((360 + thetaPlayerX) % 360)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -453,6 +453,10 @@ Prefab:
|
||||
propertyPath: EjectSpinSpeed
|
||||
value: 10
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 154602, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user