public String cookCupcakes() { comboMessages = ""; score = 0; heat += 15; int spotsFilled = 0;; for (int i = 0; i < StoredCupcakes.Count(); i++) { if (StoredCupcakes[i] != null) { score += EACH_CUPCAKE; spotsFilled++; } } if (spotsFilled < StoredCupcakes.Length) { comboMessages += "\nDIDN'T USE ALL SLOTS! +5 heat"; heat += 5; } //optimization. no combos to find if there aren't 3 cupcakes present if (spotsFilled > 2) { findCombos(); } clearCupcakes(); return(comboMessages); }
private void clearCupcakes() { for (int i = 0; i < StoredCupcakes.Count(); i++) { StoredCupcakes[i] = null; } }
//CookCupcakes takes public String cookCupcakes() { comboMessages = ""; score = 0; heat += 15; int spotsFilled = 0;; for (int i = 0; i < StoredCupcakes.Count(); i++) { if (StoredCupcakes[i] != null) //Give the player points for each cupcake they captured in each spot. { score += EACH_CUPCAKE; spotsFilled++; } } if (spotsFilled < StoredCupcakes.Length) //Add heat to the oven for trays with empty spots. { comboMessages += "\nDIDN'T USE ALL SLOTS! +5 heat"; heat += 5; } //Optimization. Only call findCombos() if tray of cupcakes are full. if (spotsFilled > 2) { findCombos(); } clearCupcakes(); //Once in oven, clear the cupcake trays return(comboMessages); }
public new bool takeCupcake(Actor cupcake) { if (cupcake != null) { for (int i = 0; i < StoredCupcakes.Count(); i++) { if (StoredCupcakes[i] == null) { float tempX = this.Position.X; float tempY = this.Position.Y + 64; tempX = tempX + (i % 3) * 64; tempY = tempY + (float)Math.Floor((double)(i / 3)) * 64; cupcake.Position = new Vector2(tempX, tempY); //Console.WriteLine("cupcake " + i + " at " + cupcake.Position.ToString()); StoredCupcakes[i] = cupcake; return(true); } } } //if you return false, show some kind of PAN FULL warning to player return(false); }