change: Implemented more behavior for jump pads and make them repeatedly jumpable
This commit is contained in:
parent
9057a159c0
commit
f2132b471a
@ -15,8 +15,6 @@ public class Bouncepad : MonoBehaviour
|
|||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public float bounceForce = 20f;
|
public float bounceForce = 20f;
|
||||||
[SerializeField]
|
|
||||||
public float verticalMultiplier = 1.0f;
|
|
||||||
|
|
||||||
public Facing Direction()
|
public Facing Direction()
|
||||||
{
|
{
|
||||||
|
@ -296,25 +296,20 @@ public class PlayerBehavior : MonoBehaviour
|
|||||||
{
|
{
|
||||||
// Assign the player's velocity to zero so that the player can
|
// Assign the player's velocity to zero so that the player can
|
||||||
// bounce on the same jump pad
|
// bounce on the same jump pad
|
||||||
// this.playerController.RB.velocity = new Vector2(
|
this.playerController.RB.velocity = new Vector2(
|
||||||
// this.playerController.RB.velocity.x,
|
this.playerController.RB.velocity.x,
|
||||||
// 0
|
0
|
||||||
// );
|
);
|
||||||
this.playerController.RB.velocity = Vector2.zero;
|
|
||||||
Bouncepad pad = col.GetComponent<Bouncepad>();
|
Bouncepad pad = col.GetComponent<Bouncepad>();
|
||||||
switch (pad.Direction())
|
switch (pad.Direction())
|
||||||
{
|
{
|
||||||
case Bouncepad.Facing.Left:
|
case Bouncepad.Facing.Left:
|
||||||
this.playerController.RB.AddForce(
|
this.playerController.RB.AddForce(
|
||||||
new Vector2(-pad.bounceForce, pad.verticalMultiplier * pad.bounceForce),
|
new Vector2(-pad.bounceForce, pad.bounceForce),
|
||||||
ForceMode2D.Impulse
|
ForceMode2D.Impulse
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case Bouncepad.Facing.Right:
|
case Bouncepad.Facing.Right:
|
||||||
this.playerController.RB.AddForce(
|
|
||||||
new Vector2(pad.bounceForce, pad.verticalMultiplier * pad.bounceForce),
|
|
||||||
ForceMode2D.Impulse
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user