private void PlayerMoveCrate() { bottleCrateCurrentPosition++; UpdatePosition(); spRenderer.flipX = !spRenderer.flipX; IncreaseScore?.Invoke(); }
protected void HandleObjectWasEaten() { EnableObject(false); if (pointsText != null) { pointsText.gameObject.SetActive(true); pointsText.text = points.ToString(); StartCoroutine(StartTimerToHideText()); } IncreaseScore?.Invoke(points); }
/// <summary> /// Explodes all the explode element in the explode event, add explodede gameobjects to object pool to reuse them. /// Invoke increase score after all explosions and start fill event for vacancies of exploded gameobjects. /// </summary> /// <param name="explodeEvent"></param> /// <returns></returns> private IEnumerator Explode(ExplodeEvent explodeEvent) { yield return(new WaitForSeconds(0.3f)); foreach (ExplodeElement explodeElement in explodeEvent.explodeElements) { foreach (Vector2 coord in explodeElement.positions) { gridComponentHolder[coord].explode.SetExplode(); itemComponentsPool.Add(gridComponentHolder[coord]); gridComponentHolder[coord] = null; } } yield return(new WaitForSeconds(1f)); IncreaseScore?.Invoke(hexagonLogic.GetCurrentScore()); FillEvent fillEvent = hexagonLogic.Fill(); SetFill(fillEvent); yield return(null); }
/// <summary> /// Падение /// </summary> public void Fall() { if (!figure.CanFall()) { FreezeFigure(); int[] coordinatesForDel = CheckFilling().ToArray(); if (coordinatesForDel.Length > 0) { for (int i = 0; i < coordinatesForDel.Length; i++) { ChangeCoordinates(coordinatesForDel[i]); IncreaseScore?.Invoke(Events.DeleteRows); } MyGraphics.ClearCells(form.splitContainer1.Panel2); MyGraphics.DrawCells(form.splitContainer1.Panel2); neighborsList.Clear(); } else { IncreaseScore?.Invoke(Events.Fall); } figure = Figure.CreateFigure(figureName); CheckEndGame(); } else { MyGraphics.EraseFigure(figure, form.splitContainer1.Panel2); figure.Fall(); MyGraphics.DrawCells(neighborsList, form.splitContainer1.Panel2); MyGraphics.DrawFigure(figure, form.splitContainer1.Panel2); neighborsList = figure.CheckNeighboringCells(); } }
public void IncrementScore(int increase) { IncreaseScore.Invoke(increase); }
public void Destroy() { IncreaseScore?.Invoke(_points); Destroyed?.Invoke(this); }