Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        _GameCtrl = FindObjectOfType(typeof(_GameCtrl)) as _GameCtrl;

        playerRb       = GetComponent <Rigidbody2D>();
        playerAnimator = GetComponent <Animator>();
        sRender        = GetComponent <SpriteRenderer>();

        vidaAtual = vidaMaxima;

        foreach (GameObject o in armas)
        {
            o.SetActive(false);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        _GameCtrl    = FindObjectOfType(typeof(_GameCtrl)) as _GameCtrl;
        playerScript = FindObjectOfType(typeof(playerScript)) as playerScript;
        sRender      = GetComponent <SpriteRenderer>();
        animator     = GetComponent <Animator>();

        sRender.color = characterColor[0];
        barrasVida.SetActive(false);
        vidaAtual        = vidaInimigo;
        hpBar.localScale = new Vector3(1, 1, 1);

        if (olhandoEsquerda == true)
        {
            olhandoEsquerda = !olhandoEsquerda; // inverte o valor da variavel
            float x = transform.localScale.x;
            x *= -1;
            transform.localScale            = new Vector3(x, transform.localScale.y, transform.localScale.z);
            barrasVida.transform.localScale = new Vector3(x, barrasVida.transform.localScale.y, barrasVida.transform.localScale.x);
        }
    }
Exemplo n.º 3
0
 private void Start()
 {
     _GameCtrl = FindObjectOfType(typeof(_GameCtrl)) as _GameCtrl;
 }