Esempio n. 1
0
        public bool Contains(Vector2 vector)
        {
            int x = (int)vector.X;
            int y = (int)vector.Y;

            if (x < Left || y < Top || x >= Right || y >= Bottom)
                return false;

            return true;
        }
Esempio n. 2
0
        public CustomSprite(Sprite2D sprite)
        {
            var rect = new Rect();

            sprite.GetTextureRectangle(ref rect);

            TexCoordTL = rect.Min;
            TexCoordBR = rect.Max;

            Height = (int) (rect.Height * 128);
            Width = (int) (rect.Width * 128);

            Texture = sprite.Texture;
        }
Esempio n. 3
0
 public static IEnumerable<Entity> GetNearbyEntities(Vector2 position, float radius)
 {
     return entities.Where(x => Vector2.DistanceSquared(position, x.Position) < radius * radius);
 }