Example #1
0
    public void StartPlaying()
    {
        if (playing)
        {
            return;
        }

        if (StartHealth == 0)
        {
            throw new Exception("StartHealth must be greater than 0");
        }

        health  = StartHealth;
        playing = true;

        if (healthIndicator != null)
        {
            healthIndicator.UpdateHealth(health);
        }

        if (score != null)
        {
            score.StartPlaying();
        }
    }
Example #2
0
    void Start()
    {
        leftMoveLimit  = LeftWall.transform.position.x + (LeftWall.transform.localScale.x / 2);
        rightMoveLimit = RightWall.transform.position.x - (RightWall.transform.localScale.x / 2);

        score = ScoreInstance.GetComponent <Score>();

        health          = StartHealth;
        healthIndicator = HealthIndicatorInstance.GetComponent <HealthIndicator>();
        healthIndicator.UpdateHealth(health);

        StartPlaying();
    }