mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-24 02:20:58 +00:00
player movement - dash & eject
This commit is contained in:
parent
9468107334
commit
e755120ef0
@ -18,6 +18,8 @@ public class Astronaut : MonoBehaviour {
|
||||
public float JumpSpeed;
|
||||
public float Gravity;
|
||||
public float Speed;
|
||||
public float EjectSpeed;
|
||||
public float DashSpeed;
|
||||
|
||||
public PlanetManager planet;
|
||||
|
||||
@ -106,15 +108,27 @@ public class Astronaut : MonoBehaviour {
|
||||
if (!grounded)
|
||||
{
|
||||
height += vSpeed * delta;
|
||||
vSpeed -= Gravity * delta;
|
||||
if (State != AstronautState.Ejecting)
|
||||
vSpeed -= Gravity * delta;
|
||||
else
|
||||
vSpeed *= 0.98f;
|
||||
}
|
||||
|
||||
float radius = GetGroundRadius();
|
||||
if (grounded = (height <= radius))
|
||||
{
|
||||
if (State == AstronautState.Dashing)
|
||||
{
|
||||
planet.PushWedge(Repeat(theta,360));
|
||||
State = AstronautState.Idle;
|
||||
//TODO_SR Create dash impact here
|
||||
}
|
||||
|
||||
height = radius;
|
||||
if (State == AstronautState.Jumping)
|
||||
State = AstronautState.Idle;
|
||||
|
||||
vSpeed = 0f;
|
||||
}
|
||||
|
||||
UpdatePosition();
|
||||
@ -208,12 +222,25 @@ public class Astronaut : MonoBehaviour {
|
||||
{
|
||||
if (_state >= AstronautState.Ejecting)
|
||||
return;
|
||||
|
||||
State = AstronautState.Dashing;
|
||||
vSpeed = -DashSpeed;
|
||||
}
|
||||
|
||||
public void Eject()
|
||||
{
|
||||
State = AstronautState.Ejecting;
|
||||
vSpeed = EjectSpeed;
|
||||
grounded = false;
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString()))
|
||||
{
|
||||
Debug.Log("Clicked the button with an image");
|
||||
Eject();
|
||||
}
|
||||
}
|
||||
|
||||
/*IEnumerator WalkingStance()
|
||||
|
||||
@ -572,6 +572,14 @@ Prefab:
|
||||
propertyPath: Width
|
||||
value: 0.4
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||
propertyPath: EjectSpeed
|
||||
value: 15
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
|
||||
propertyPath: DashSpeed
|
||||
value: 12
|
||||
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