Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        int    colons            = health / 2;
        int    periods           = health % 2;
        string healthTextColons  = new string(':', colons);
        string healthTextPeriods = new string('.', periods);

        healthText.text = healthTextColons + healthTextPeriods;


        scoreText.text = "SCORE\n" + score;



        if (Input.GetButtonDown("Fire1") && alive)
        {
            anim.SetBool("HasWeapon", hasWeapon);
            anim.SetTrigger("Attack");
        }


        if (health < 1 && alive)
        {
            alive = false;
            resetButton.SetActive(true);
            menuButton.SetActive(true);
            Death();
        }


        if (!alive)
        {
            sprite.enabled = false;
            controller2D.DisableMovement();
        }
    }