Commit 3ce0d6eb authored by Tommé Nöll's avatar Tommé Nöll
Browse files
parents 00b545f9 91008069
...@@ -30,7 +30,10 @@ public abstract class Character : MonoBehaviour, VariableSoundPlayer.SoundOwner ...@@ -30,7 +30,10 @@ public abstract class Character : MonoBehaviour, VariableSoundPlayer.SoundOwner
public VariableSoundPlayer.ActivateSoundDelegate activateSound { get; set; } = delegate{}; public VariableSoundPlayer.ActivateSoundDelegate activateSound { get; set; } = delegate{};
public bool getGroundStatus()
{
return isGrounded;
}
void Awake() void Awake()
{ {
rigidbody = GetComponent<Rigidbody2D>(); rigidbody = GetComponent<Rigidbody2D>();
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
public class InputManager : MonoBehaviour public class InputManager : MonoBehaviour
{ {
public Animator animator;
[SerializeField] private Player player = null; [SerializeField] private Player player = null;
[SerializeField] private UI_SceneManager scene = null; [SerializeField] private UI_SceneManager scene = null;
[SerializeField] private RopeSystem ropesys = null; [SerializeField] private RopeSystem ropesys = null;
...@@ -21,6 +22,16 @@ public class InputManager : MonoBehaviour ...@@ -21,6 +22,16 @@ public class InputManager : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (Input.GetButton("Horizontal"))
{
animator.SetFloat("speed", 1F);
}
if (Input.GetButtonUp("Horizontal"))
{
animator.SetFloat("speed", 0F);
}
if (Input.GetButtonDown("Cancel")) if (Input.GetButtonDown("Cancel"))
{ {
scene.TogglePause(); scene.TogglePause();
...@@ -30,11 +41,25 @@ public class InputManager : MonoBehaviour ...@@ -30,11 +41,25 @@ public class InputManager : MonoBehaviour
{ {
return; return;
} }
if (Input.GetButtonDown("Jump")) if (Input.GetButtonDown("Jump"))
{ {
animator.SetBool("isJumping", true);
jump = true; jump = true;
} }
if (Input.GetButton("Jump"))
{
animator.SetBool("isJumping", true);
jump = true;
}
if (player.getGroundStatus())
{
animator.SetBool("isJumping", false);
}
if (Input.GetButtonDown("Attack")) if (Input.GetButtonDown("Attack"))
{ {
attack = true; attack = true;
......
...@@ -140,6 +140,8 @@ public class RopeSystem : MonoBehaviour, VariableSoundPlayer.SoundOwner ...@@ -140,6 +140,8 @@ public class RopeSystem : MonoBehaviour, VariableSoundPlayer.SoundOwner
if (hit.collider.GetComponentInParent<PullableObject>() != null) if (hit.collider.GetComponentInParent<PullableObject>() != null)
{ {
ropeAttached = true; ropeAttached = true;
ropePositions.Add(hit.point);
wrapPointsLookup.Add(hit.point, 0);
springJoint.enabled = true; springJoint.enabled = true;
springJoint.distance = Vector2.Distance(playerPosition, hit.point); springJoint.distance = Vector2.Distance(playerPosition, hit.point);
springJoint.connectedBody = hit.collider.GetComponentInParent<Rigidbody2D>(); springJoint.connectedBody = hit.collider.GetComponentInParent<Rigidbody2D>();
......
Supports Markdown
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