コード例 #1
0
        void TickTakeItems()
        {
            takeItemsTimer -= TickDelta;
            if (takeItemsTimer <= 0)
            {
                takeItemsTimer += .25f;

                Vec3  size   = MapBounds.GetSize();
                float radius = Math.Max(Math.Max(size.X, size.Y), size.Z);

                Map.Instance.GetObjects(new Sphere(Position, radius), delegate(MapObject obj)
                {
                    Item item = obj as Item;
                    if (item == null)
                    {
                        return;
                    }

                    //if( ( item.Position - Position ).LengthFast() > radius )
                    if ((item.Position - Position).LengthSqr() > radius * radius)
                    {
                        return;
                    }

                    item.Take(this);
                });
            }
        }