public static bool Touching(Actor actor) { var result = false; var rectActor = actor.ScreenRect; foreach (var enemy in _enemies) { var rectEnemy = enemy.ScreenRect; if (rectActor.Intersects(rectEnemy)) { enemy.Color = Color.Transparent; result = true; break; } } return result; }
public static bool Touching(Actor actor) { var result = false; var rectActor = actor.ScreenRect; foreach (var rock in _rocks) { var rectRock = rock.ScreenRect; if (rectActor.Intersects(rectRock)) { rock.Color = Color.Transparent; result = true; break; } } return result; }
public static bool Touching(Actor actor, int direction) { var result = false; var rectActor = actor.ScreenRect; if (direction < 0) { foreach (var bullet in _bullets) { if (bullet.Speed.Y < 0) { var rectBullet = bullet.ScreenRect; if (rectActor.Intersects(rectBullet)) { bullet.Color = Color.Transparent; result = true; break; } } } } else { foreach (var bullet in _bullets) { if (bullet.Speed.Y > 0) { var rectBullet = bullet.ScreenRect; if (rectActor.Intersects(rectBullet)) { bullet.Color = Color.Transparent; result = true; break; } } } } return result; }