Esempio n. 1
0
 private void PlayerMoveCrate()
 {
     bottleCrateCurrentPosition++;
     UpdatePosition();
     spRenderer.flipX = !spRenderer.flipX;
     IncreaseScore?.Invoke();
 }
Esempio n. 2
0
    protected void HandleObjectWasEaten()
    {
        EnableObject(false);

        if (pointsText != null)
        {
            pointsText.gameObject.SetActive(true);
            pointsText.text = points.ToString();
            StartCoroutine(StartTimerToHideText());
        }
        IncreaseScore?.Invoke(points);
    }
Esempio n. 3
0
    private void Start()
    {
        if (player is null)
        {
            var playerGameObject = Instantiate(GlobalState.Instance.SelectedSpaceCraft, playerSpawnLocation, Quaternion.Euler(-90f, 0f, 0f));
            player = playerGameObject.GetComponent <SpaceshipController>();
        }
        // player stats
        player.meta.attack += progress.attackLevel;
        player.meta.health += progress.healthLevel;
        player.meta.reload -= 0.09f * progress.reloadLevel;


        inputs        = GetComponent <PlayerInput>();
        increaseScore = GetComponent <IncreaseScore>();
        SetupGUI();
    }
    /// <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);
    }
Esempio n. 5
0
        /// <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();
            }
        }
Esempio n. 6
0
 public void IncrementScore(int increase)
 {
     IncreaseScore.Invoke(increase);
 }
Esempio n. 7
0
 public void Destroy()
 {
     IncreaseScore?.Invoke(_points);
     Destroyed?.Invoke(this);
 }