Esempio n. 1
0
 public void Consume(WorldObject o)
 {
     Fruit fruit = o as Fruit;
     if (fruit != null)
     {
         // Something happens?
         FruitsConsumed++;
     }
 }
Esempio n. 2
0
 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;
             }
         }
     }
 }
Esempio n. 3
0
        void worldObjectCreated(WorldObject worldObject)
        {
            MapItemControl itemControl = new MapItemControl();
            itemControl.DataContext = worldObject;

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