public static Ground GetGroundLeftFromVector(Level level, Vector2 vector) { Ground bestGround = null; float bestDistance = 99999999.0f; foreach (Ground ground in level.Grounds) { if (ground.RightX > vector.X) { continue; } float distance = vector.X - ground.RightX; if (distance < bestDistance) { bestGround = ground; bestDistance = distance; } } return(bestGround); }
private static bool IsVectorOnGround(Ground ground, Vector2 vector) { return(vector.Y == ground.TopY); }
public void AddGround(Ground ground) { Grounds.Add(ground); }