Ejemplo n.º 1
0
 /// <summary>
 /// 每块地被触摸调用此事件
 /// </summary>
 /// <param name="args"></param>
 public void DispatchTouch(TouchEventArgs args)
 {
     if (args.Target.GetType() == typeof(FarmUnit))
     {
         FarmUnit target = args.Target as FarmUnit;
         //如果当前土地已经开垦,可以点击
         if (target.EnablePlant == 1)
         {
             //如果有植物,则点击植物
             if (target.Plant != null)
             {
                 target.Plant.Touched(args);
             }
             //点击农田
             target.Touched(args);
         }
         else
         {
             if (target.Brand != null)
             {
                 target.Brand.Touched(args);
             }
         }
     }
     else
     {
         WorldObject obj = args.Target as WorldObject;
         obj.Touched(args);
     }
 }