Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class ObjShieldBubble : ObjShield {
- string[] buttonsJump = new string[] { "Secondary", "Tertiary" };
- public bool used = false;
- void Update() {
- // Movement
- if (character.InStateGroup("ground")) {
- if (used) {
- character.GroundSnap();
- if ((character.forwardAngle < 45) || (character.forwardAngle > 360 - 45)) {
- SFX.Play(audioSource, "sfxShieldBubbleJump");
- animator.Play("Bubble Rebound");
- Vector3 slopeVelocity = transform.up * 7.5F * character.physicsScale;
- slopeVelocity.x *= 2;
- character.velocity += slopeVelocity;
- character.position += character.velocity / 60F;
- character.stateCurrent = "jump";
- }
- }
- used = false;
- return;
- }
- if (used) return;
- if (!character.InStateGroup("jump")) return;
- if (!character.input.GetButtonsDown(buttonsJump)) return;
- if (character.stateFrameTimer == 0) return; // Hack?
- used = true;
- Vector3 velocityTemp = character.velocity;
- velocityTemp.y = -8F * character.physicsScale;
- velocityTemp.x *= 0.5F;
- character.velocity = velocityTemp;
- SFX.Play(audioSource, "sfxShieldBubbleJump");
- animator.Play("Bubble Bounce");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement