void b_BrokeBox(object sender, EventArgs e) { DXBox box = (DXBox)sender; Score += 10 + ComboScore; ComboScore += 5; DXAnimation anm = null; switch (box.Kind) { case BoxKind.Red: anm = breakingAnimations[0].Clone(); break; case BoxKind.Blue: anm = breakingAnimations[1].Clone(); break; case BoxKind.Green: anm = breakingAnimations[2].Clone(); break; case BoxKind.Yellow: anm = breakingAnimations[3].Clone(); break; case BoxKind.Purple: anm = breakingAnimations[4].Clone(); break; case BoxKind.Cyan: anm = breakingAnimations[5].Clone(); break; case BoxKind.White: anm = breakingAnimations[6].Clone(); break; } if (anm == null) { return; } anm.PosX = box.PosX - 32f; anm.PosY = box.PosY - 8f; anm.Visible = true; animations.Add(anm); }
public void OnBrokeBox(DXBox box) { EventHandler handler = BrokeBox; if (handler != null) { handler(box, EventArgs.Empty); } }