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); } }
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); }
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); }
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); } } }