public override bool performToolAction(Tool t, GameLocation location) { if (t is Pickaxe) { var who = t.getLastFarmerToUse(); this.performRemoveAction(this.TileLocation, location); Debris deb = new Debris(getOne(), who.GetToolLocation(), new Vector2(who.GetBoundingBox().Center.X, who.GetBoundingBox().Center.Y)); Game1.currentLocation.debris.Add(deb); DataAccess DataAccess = DataAccess.GetDataAccess(); List <Node> nodes = DataAccess.LocationNodes[Game1.currentLocation]; Node node = nodes.Find(n => n.Position.Equals(TileLocation)); if (node != null && node is ConnectorPipeNode) { ConnectorPipeNode pipe = (ConnectorPipeNode)node; if (pipe.StoredItem != null) { Printer.Info($"[T{Thread.CurrentThread.ManagedThreadId}] GET OUT"); Printer.Info($"[T{Thread.CurrentThread.ManagedThreadId}] " + pipe.StoredItem.Stack.ToString()); pipe.Print(); Debris itemDebr = new Debris(pipe.StoredItem, who.GetToolLocation(), new Vector2(who.GetBoundingBox().Center.X, who.GetBoundingBox().Center.Y)); Game1.currentLocation.debris.Add(itemDebr); pipe.Broken = true; } } Game1.currentLocation.objects.Remove(this.TileLocation); return(false); } return(false); }
public static void AnimateInputConnection(List <Node> path) { foreach (Node node in path.ToList()) { if (node != null && node is ConnectorPipeNode) { ConnectorPipeNode conn = (ConnectorPipeNode)node; AnimateInput(conn); } } }
public static void AnimateItemSending(List <Node> path) { foreach (Node node in path.ToList()) { if (node != null && node is ConnectorPipeNode) { ConnectorPipeNode conn = (ConnectorPipeNode)node; AnimateItemMovement(conn); } } /* * Node[] nodes = path.ToArray(); * int cont = 0; * updated = false; * if (Globals.Debug) { Printer.Info("ANIMATING..."); } * while (cont < nodes.Length) * { * Node node = nodes[cont]; * if (node != null && node is ConnectorNode) * { * ConnectorNode conn = (ConnectorNode)node; * if (Globals.Debug) { conn.Print(); Printer.Info(conn.PassingItem.ToString()); } * if (!conn.PassingItem) * { * if (Globals.Debug) { Printer.Info($"[X] PASSING"); } * updated = false; * conn.PassingItem = true; * current = conn; * } * if (updated) * { * current.PassingItem = false; * cont++; * } * } * else * { * cont++; * } * * } */ }
private static void AnimateInput(ConnectorPipeNode conn) { conn.Connecting = true; System.Threading.Thread.Sleep(100); conn.Connecting = false; }
private static void AnimateItemMovement(ConnectorPipeNode conn) { conn.PassingItem = true; System.Threading.Thread.Sleep(500); conn.PassingItem = false; }