Commit 33686b56 authored by Sebastian Frey's avatar Sebastian Frey

SuperMario-Jump hinzugefügt

parent f0377d2b
......@@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 52145075018362291}
- component: {fileID: 52145075018362284}
- component: {fileID: 52145075018362287}
m_Layer: 0
m_Layer: 10
m_Name: Player
m_TagString: Player
m_Icon: {fileID: 0}
......@@ -119,6 +119,8 @@ MonoBehaviour:
m_GroundedOffset: {x: 0, y: -1}
m_SecondsWaitToJump: 0.5
m_MaxJumpCount: 1
m_fallMultiplier: 2.5
m_lowJumpMultiplier: 2
OnLandEvent:
m_PersistentCalls:
m_Calls: []
......
......@@ -402,7 +402,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 392034771}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.5, y: -0.25, z: 0}
m_LocalPosition: {x: 1.25, y: -0.25, z: 0}
m_LocalScale: {x: 1, y: 0.5, z: 1}
m_Children: []
m_Father: {fileID: 1876157337}
......@@ -806,7 +806,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
cooldown: 3
volleySize: 1
launchPower: 20
launchPower: 10
attackSpeed: 0.1
shotSpawn: {fileID: 392034772}
elementalAttack: {fileID: 7588789901055592565, guid: c916ffaff3c476b448f67d9d827b3e7e,
......@@ -823,13 +823,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 83eb4399ff535ee4cbc76de3b8a32e46, type: 3}
m_Name:
m_EditorClassIdentifier:
cooldown: 2
Cooldown: 0
volleySize: 10
launchPower: 20
attackSpeed: 0.1
shotSpawn: {fileID: 1992150795}
elementalAttack: {fileID: 1870586037468468, guid: 61411254df3161c4e81f6c0a4f2cd33c,
type: 3}
fireBall: {fileID: 0}
--- !u!114 &1876157329
MonoBehaviour:
m_ObjectHideFlags: 0
......
......@@ -16,6 +16,8 @@ public class MovementController : MonoBehaviour {
[SerializeField] private Vector2 m_GroundedOffset = Vector2.zero;
[SerializeField] private float m_SecondsWaitToJump = 0.3f;
[SerializeField] private int m_MaxJumpCount = 1;
[SerializeField] private float m_fallMultiplier = 2.5f;
[SerializeField] private float m_lowJumpMultiplier = 2.0f;
private bool m_Grounded; // Whether or not the player is grounded.
private bool m_Airborn;
......@@ -89,10 +91,19 @@ public class MovementController : MonoBehaviour {
// Add a vertical force to the player.
m_Grounded = false;
m_TempJumpCount--;
m_Rigidbody2D.AddForce (new Vector2 (0f, m_JumpForce));
//m_Rigidbody2D.AddForce (new Vector2 (0f, m_JumpForce));
m_Rigidbody2D.velocity = Vector2.up * m_JumpForce;
StartCoroutine(Wait(m_SecondsWaitToJump));
}
}
if (m_Rigidbody2D.velocity.y < 0)
{
m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_fallMultiplier - 1) * Time.deltaTime;
} else if (m_Rigidbody2D.velocity.y > 0 && !Input.GetButton("Jump"))
{
m_Rigidbody2D.velocity += Vector2.up * Physics2D.gravity.y * (m_lowJumpMultiplier - 1) * Time.deltaTime;
}
}
private IEnumerator Wait(float s)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment