public override void MouseUp(Shape s) { //this.X = origX; //this.Y = origY; if (s is Sausage && !hasSausage) { Sausage sausage = (Sausage)s; Game.grill.removeSausage(sausage); Game.removeShape(s); hasSausage = true; changePicture(); price += sausage.price; } else if (s is Ketchup && !hasKetchup) { hasKetchup = true; ((Ketchup)s).MouseUp(); changePicture(); } else { s.MouseUp(); } }
public void removeSausage(Sausage s) { int ind = sausages.IndexOf(s); sausages[ind] = null; isEmpty[ind] = true; timers[ind].Stop(); timers[ind].Enabled = false; }
public Shape addSausage() { for (int i = 0; i < isEmpty.Count; i++) { if (isEmpty[i]) { sausages[i] = new Sausage(positions[i].X, positions[i].Y, 30, 100); sausages[i].Selected = sausages[i]; isEmpty[i] = false; timers[i].Enabled = true; timers[i].Start(); return(sausages[i]); } } return(null); }
public override void MouseUp(Shape s) { if (s is Sausage) { Game.removeShape(s); Sausage sausage = (Sausage)s; Game.grill.removeSausage(sausage); Game.showPrice(new Point((int)this.X + this.Width / 2, (int)this.Y), (int)(sausage.price * 0.3 * (-1))); } else if (s is Bread) { Game.removeShape(s); Game.table.removeBread(s); Game.showPrice(new Point((int)this.X + this.Width / 2, (int)this.Y), (int)(((Bread)s).price * 0.3 * (-1))); } else { s.MouseUp(); } }
public void startTimer(Sausage s) { int ind = sausages.IndexOf(s); timers[ind].Enabled = true; }
public void stopTimer(Sausage s) { int ind = sausages.IndexOf(s); timers[ind].Enabled = false; }