Beispiel #1
0
    private void Awake()
    {
        InGameItem.all.Clear();

        maxScoreLabel.SetFormatedText(gameManager.MaxScore);

        bricksManager.Setup(OnGameOver, item =>
        {
            if (item is InGameItemBall)
            {
                score++;
                if (score.Current > gameManager.MaxScore)
                {
                    gameManager.MaxScore = score.Current;
                }

                ballsManager.AddExtraBall(item.transform.position);
            }
        });

        controller.Setup(direction => ballsManager.Shoot(direction, () => StartCoroutine(TakeReady())));

        score.SetOnValueChanged((lv, cv) => scoreLabel.SetFormatedText(cv));
        score.Current = 0;
    }
Beispiel #2
0
 public InGameItemBrick SetMaxHealth(int brickHealth)
 {
     health.SetOnValueChanged((lv, nv) =>
     {
         var color    = visual.color;
         color.b      = color.g = 1f - Mathf.Clamp(health * 2 + 100f, 100f, 255f) / 255f;
         visual.color = color;
         label.text   = nv.ToString().Persian();
     });
     health.Current = brickHealth;
     return(this);
 }