change: Added cymbal functionality to player behavior and added some adjustment to jump pads
This commit is contained in:
		@@ -15,6 +15,8 @@ public class Bouncepad : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    [SerializeField]
 | 
			
		||||
    public float bounceForce = 20f;
 | 
			
		||||
    [SerializeField]
 | 
			
		||||
    public float verticalModifier = 1.0f;
 | 
			
		||||
 | 
			
		||||
    public Facing Direction()
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,9 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    Vector2 dashVec;
 | 
			
		||||
    private bool lowSpeed = false;
 | 
			
		||||
 | 
			
		||||
    [Header("Cymbals:")]
 | 
			
		||||
    private float cymbalActiveTime = 0f;
 | 
			
		||||
 | 
			
		||||
    [Header("Grappling:")]
 | 
			
		||||
    [SerializeField] public Tutorial_GrapplingGun grapplingGun;
 | 
			
		||||
    [SerializeField] public Tutorial_GrapplingRope grapplingRope;
 | 
			
		||||
@@ -72,6 +75,8 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    void Update()
 | 
			
		||||
    {
 | 
			
		||||
        this.cymbalActiveTime -= Time.deltaTime;
 | 
			
		||||
 | 
			
		||||
        unlockedTambourine = StateController.Instance.HasTambourine();
 | 
			
		||||
        if (playerIsAlive)
 | 
			
		||||
        {
 | 
			
		||||
@@ -123,6 +128,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
            else if (!isInWater)
 | 
			
		||||
            {
 | 
			
		||||
                isDash = false;
 | 
			
		||||
 | 
			
		||||
                currentDash = 0.0f;
 | 
			
		||||
                _rb.AddForce(-(dashVec), ForceMode2D.Impulse);
 | 
			
		||||
                dashVec = Vector2.zero;
 | 
			
		||||
@@ -134,6 +140,14 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
                dashVec = Vector2.zero;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (StateController.Instance.HasCymbal())
 | 
			
		||||
        {
 | 
			
		||||
            if (this.playerInput.actions["CymbalCrash"].WasPressedThisFrame())
 | 
			
		||||
            {
 | 
			
		||||
                this.cymbalActiveTime = 1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Animate()
 | 
			
		||||
@@ -296,20 +310,21 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        {
 | 
			
		||||
            // Assign the player's velocity to zero so that the player can 
 | 
			
		||||
            // bounce on the same jump pad
 | 
			
		||||
            this.playerController.RB.velocity = new Vector2(
 | 
			
		||||
                this.playerController.RB.velocity.x,
 | 
			
		||||
                0
 | 
			
		||||
                );
 | 
			
		||||
            this.playerController.RB.velocity = Vector2.zero;
 | 
			
		||||
            Bouncepad pad = col.GetComponent<Bouncepad>();
 | 
			
		||||
            switch (pad.Direction())
 | 
			
		||||
            {
 | 
			
		||||
                case Bouncepad.Facing.Left:
 | 
			
		||||
                    this.playerController.RB.AddForce(
 | 
			
		||||
                        new Vector2(-pad.bounceForce, pad.bounceForce),
 | 
			
		||||
                        new Vector2(-pad.bounceForce, pad.verticalModifier * pad.bounceForce),
 | 
			
		||||
                        ForceMode2D.Impulse
 | 
			
		||||
                        );
 | 
			
		||||
                    break;
 | 
			
		||||
                case Bouncepad.Facing.Right:
 | 
			
		||||
                    this.playerController.RB.AddForce(
 | 
			
		||||
                        new Vector2(pad.bounceForce, pad.verticalModifier * pad.bounceForce),
 | 
			
		||||
                        ForceMode2D.Impulse
 | 
			
		||||
                        );
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -353,8 +368,15 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        else if (collision.gameObject.tag == "Projectile")
 | 
			
		||||
        {
 | 
			
		||||
            Destroy(collision.gameObject);
 | 
			
		||||
            if (this.cymbalActiveTime > 0)
 | 
			
		||||
            {
 | 
			
		||||
                Debug.Log("Reflected!");
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                StartCoroutine(DestroyPlayer());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //stupid stuff for claude's house
 | 
			
		||||
        else if (collision.gameObject.tag == "SirJacques")
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user