Commit 14dbaa34 authored by Tanner Grehawick's avatar Tanner Grehawick

working CollisionStateRefactor

parent 8c74d0fa
No preview for this file type
......@@ -33,32 +33,37 @@ public class CollisionState : MonoBehaviour {
enemyHit = Physics2D.OverlapCircle(body.position + bottomPosition, collisionRadius, enemyLayer);
}
void OnDrawGizmosSelected() {
Gizmos.color = Color.red;
// void OnDrawGizmosSelected() {
// Gizmos.color = Color.red;
Vector2 pos = bottomPosition;
pos.x += transform.position.x;
pos.y += transform.position.y;
// Vector2 pos = bottomPosition;
// pos.x += transform.position.x;
// pos.y += transform.position.y;
Gizmos.DrawWireSphere(pos, collisionRadius);
// Gizmos.DrawWireSphere(pos, collisionRadius);
pos = rightPosition;
pos.x += transform.position.x;
pos.y += transform.position.y;
// pos = rightPosition;
// pos.x += transform.position.x;
// pos.y += transform.position.y;
Gizmos.DrawWireSphere(pos, collisionRadius);
// Gizmos.DrawWireSphere(pos, collisionRadius);
pos = leftPosition;
pos.x += transform.position.x;
pos.y += transform.position.y;
// pos = leftPosition;
// pos.x += transform.position.x;
// pos.y += transform.position.y;
Gizmos.DrawWireSphere(pos, collisionRadius);
}
// Gizmos.DrawWireSphere(pos, collisionRadius);
// }
float lastFixedTime;
void OnCollisionStay2D(Collision2D collision) {
if (Time.fixedTime != lastFixedTime) {
onGround = false;
onWallLeft = false;
onWallRight = false;
lastFixedTime = Time.fixedTime;
}
foreach (ContactPoint2D contact in collision.contacts) {
Color color = Color.white;
Vector2 normal = contact.normal;
......
Markdown is supported
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