public void CollisionCheck() { foreach (gameObject nextObject in Scene.SceneObjects) { if (nextObject == this) { continue; } Vector2 other = nextObject.worldTransform.position; Vector2 current = worldTransform.position; if ((int)other.x == (int)current.x && (int)other.y == (int)current.y) { if (nextObject.attachedScript != null) { nextObject.attachedScript.OnCollision(this); } if (attachedScript != null) { attachedScript.OnCollision(nextObject); } } } }