Exemplo n.º 1
0
 public Warp GetWarp(int x, int y)
 {
     for (int c = 0; c < Location.warps.Count; c++)
     {
         if (Location.warps[c].X == x && Location.warps[c].Y == y)
         {
             return(Warp.Wrap(Location.warps[c]));
         }
     }
     throw new NullReferenceException();
 }
Exemplo n.º 2
0
 public bool TryGetWarp(int x, int y, out Warp warp)
 {
     warp = default(Warp);
     for (int c = 0; c < Location.warps.Count; c++)
     {
         if (Location.warps[c].X == x && Location.warps[c].Y == y)
         {
             warp = Warp.Wrap(Location.warps[c]);
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 3
0
 public void SetWarp(Warp warp, bool replace = false)
 {
     for (int c = 0; c < Location.warps.Count; c++)
     {
         if (Location.warps[c].X == warp.X && Location.warps[c].Y == warp.Y)
         {
             if (!replace)
             {
                 throw new InvalidOperationException();
             }
             Location.warps[c] = Warp.Unwrap(warp);
             return;
         }
     }
     Location.warps.Add(Warp.Unwrap(warp));
 }
Exemplo n.º 4
0
 public bool TrySetWarp(Warp warp, bool replace = false)
 {
     for (int c = 0; c < Location.warps.Count; c++)
     {
         if (Location.warps[c].X == warp.X && Location.warps[c].Y == warp.Y)
         {
             if (!replace)
             {
                 return(false);
             }
             Location.warps[c] = Warp.Unwrap(warp);
             break;
         }
     }
     Location.warps.Add(Warp.Unwrap(warp));
     return(true);
 }
Exemplo n.º 5
0
 internal static StardewValley.Warp Unwrap(Warp obj)
 {
     return(new StardewValley.Warp(obj.X, obj.Y, obj.Target, obj.TargetX, obj.TargetY, false));
 }