Beispiel #1
0
 public void Consume(WorldObject o)
 {
     Fruit fruit = o as Fruit;
     if (fruit != null)
     {
         // Something happens?
         FruitsConsumed++;
     }
 }
 void worldObjectRemoved(WorldObject worldObject)
 {
     foreach (UIElement e in itemLayer.Children)
     {
         MapItemControl mapItem = e as MapItemControl;
         if (mapItem != null)
         {
             if (mapItem.DataContext == worldObject)
             {
                 itemLayer.Children.Remove(e);
                 return;
             }
         }
     }
 }
        void worldObjectCreated(WorldObject worldObject)
        {
            MapItemControl itemControl = new MapItemControl();
            itemControl.DataContext = worldObject;

            itemLayer.AddChild(itemControl, worldObject.Position);
        }
Beispiel #4
0
 public bool CollidesWith(WorldObject worldObject)
 {
     return Position.GetDistanceTo(worldObject.Position) < CollisionDistanceThreshold;
 }