Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OnTriggerEnter2D(Collider2D collision)
- {
- //Debug.Log("currently colliding with " + collision.gameObject.tag);
- if (collision.gameObject.tag == "punch" || collision.gameObject.tag == "kick" || collision.gameObject.tag == "upperCut")
- {
- if (beingAttacked == true)
- {
- currentCombo++;
- comboNumbers.SetText(currentCombo.ToString());
- shakeOffset += .1f;
- //Debug.Log("supposed to shake");
- generateRandomOffset();
- Vector2 offsetAmount = new Vector2(xOffset, yOffset);
- transform.position = offsetAmount + new Vector2(transform.position.x, transform.position.y);
- StartCoroutine(attackVibe());
- }
- }
- if (collision.gameObject.tag == "punch")
- {
- if(beingAttacked == false)
- {
- Debug.Log("being attacked by " + collision.gameObject + " tag is: " + collision.gameObject.tag);
- //Debug.Log("kai hit enemy");
- rB.AddForce(new Vector2(punchForce, 0));
- StartCoroutine(delay(stunTimer));
- beingAttacked = true;
- }
- //rB.AddForce(new Vector2(punchForce, 0));
- }
- if(collision.gameObject.tag == "wall")
- {
- //force = (-rB.velocity);
- //Debug.Log("wall trigger enter");
- rB.AddForce(new Vector2(-punchForce, 0));
- }
- if(collision.gameObject.tag == "upperCut")
- {
- if (beingAttacked == false)
- {
- Debug.Log("sui hit enemy");
- beingAttacked = true;
- rB.AddForce(new Vector2(0, uppercutForce));
- StartCoroutine(delay(stunTimer));
- //beingAttacked = true;
- }
- //rB.AddForce(new Vector2(0, uppercutForce));
- }
- if (collision.gameObject.tag == "ceiling")
- {
- //Debug.Log("ceiling trigger enter");
- rB.AddForce(new Vector2(0, -uppercutForce));
- }
- if (collision.gameObject.tag == "kick")
- {
- if (beingAttacked == false)
- {
- rB.AddForce(new Vector2(0, kickForce));
- StartCoroutine(delay(stunTimer));
- beingAttacked = true;
- }
- //rB.AddForce(new Vector2(0, kickForce));
- }
- if (collision.gameObject.tag == "floor")
- {
- //Debug.Log("floor trigger enter");
- rB.AddForce(new Vector2(0, -kickForce));
- }
- if(collision.gameObject.tag == "EnemyOrigin" && beingAttacked == true)
- {
- //this shoudl be set when the enemy returns back to position (uhhhhhhhhhhhhhhhh)
- currentCombo = 0;
- comboNumbers.SetText(currentCombo.ToString());
- shakeOffset = .5f;
- beingAttacked = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement