Exemplo n.º 1
0
    void Attack2()
    {
        GameObject   go           = GameObject.FindGameObjectWithTag("Player");
        JotaroHealth jotaro       = go.GetComponent <JotaroHealth>();
        JotaroCombat jotaroCombat = go.GetComponent <JotaroCombat>();

        if (Input.GetKey(KeyCode.P) && Time.time >= jotaroCombat.nextBlockTime)
        {
            jotaroCombat.Block();
        }
        else
        {
            jotaro.TakeDamage(2);
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        JotaroHealth jotaro       = hitInfo.GetComponent <JotaroHealth>();
        JotaroCombat jotaroCombat = hitInfo.GetComponent <JotaroCombat>();

        if (jotaro != null)
        {
            if (Input.GetKey(KeyCode.P) && Time.time >= jotaroCombat.nextBlockTime)
            {
                jotaroCombat.Block();
            }
            else
            {
                jotaro.TakeDamage(damage);
            }
        }
        Destroy(gameObject);
    }
Exemplo n.º 3
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        JotaroHealth jotaroHealth = hitInfo.GetComponent <JotaroHealth>();
        JotaroCombat jotaroCombat = hitInfo.GetComponent <JotaroCombat>();

        if (jotaroHealth != null)
        {
            if (Input.GetKey(KeyCode.P) && Time.time >= jotaroCombat.nextBlockTime)
            {
                jotaroCombat.Block();
            }
            else
            {
                jotaroHealth.TakeDamage(damage);
            }
        }

        Instantiate(impactEffect, transform.position, transform.rotation);
        Destroy(gameObject);
    }
Exemplo n.º 4
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        JotaroHealth jotaro       = hitInfo.GetComponent <JotaroHealth>();
        JotaroCombat jotaroCombat = hitInfo.GetComponent <JotaroCombat>();

        if (jotaro != null)
        {
            if (Input.GetKey(KeyCode.P) && Time.time >= jotaroCombat.nextBlockTime)
            {
                jotaroCombat.Block();
            }
            else
            {
                tenAnim.SetTrigger("Attack");
                jotaro.TakeDamage(damage);
                GameObject     j          = GameObject.FindGameObjectWithTag("Player");
                JotaroMovement moveScript = j.GetComponent <JotaroMovement>();
                moveScript.enabled     = false;
                moveScript.rb.velocity = transform.right * 0;
                rb.velocity            = transform.right * 0;
                Invoke("ResumeMovement", 1);
            }
        }
    }