Commit 61bd817b authored by Tanner Grehawick's avatar Tanner Grehawick

fix prefabs, CharacterTest, and CollisionState

parent 1720dae5
......@@ -14,23 +14,22 @@ public class CollisionState : MonoBehaviour {
[HideInInspector]public Collider2D enemyHit;
private InputState inputState;
private Rigidbody2D body;
void Awake() {
inputState = GetComponent<InputState>();
body = GetComponent<Rigidbody2D>();
}
void FixedUpdate() {
enemyHit = null;
Vector2 pos = bottomPosition;
pos.x += transform.position.x;
pos.y += transform.position.y;
onGround = Physics2D.OverlapCircle(pos, collisionRadius, collisionLayer);
enemyHit = null;
onGround = Physics2D.OverlapCircle(body.position + bottomPosition, collisionRadius, collisionLayer);
onWallLeft = Physics2D.OverlapCircle(leftPosition, collisionRadius, collisionLayer);
onWallRight = Physics2D.OverlapCircle(rightPosition, collisionRadius, collisionLayer);
onWallLeft = Physics2D.OverlapCircle(body.position + leftPosition, collisionRadius, collisionLayer);
onWallRight = Physics2D.OverlapCircle(body.position + rightPosition, collisionRadius, collisionLayer);
onWall = onWallRight || onWallLeft;
enemyHit = Physics2D.OverlapCircle(pos, collisionRadius, enemyLayer);
enemyHit = Physics2D.OverlapCircle(body.position + bottomPosition, collisionRadius, enemyLayer);
}
void OnDrawGizmos() {
......
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