private void OnTriggerEnter2D(Collider2D collision) { GameObject gameObject = collision.gameObject; if (!gameObject.GetComponent <Defenders>()) { return; } animator.SetBool("isAttacking", true); attackers.Attack(gameObject); }
void OnTriggerEnter2D(Collider2D trigger) { GameObject obj = trigger.gameObject; if (!obj.GetComponent <Defenders>()) { return; } attacker.Attack(obj); anim.SetBool("isAttacking", true); }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; //abort if not colliding with defender if (!obj.GetComponent <Defenders>()) { return; } anim.SetBool("isAttacking", true); att.Attack(obj); }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; //Leave the method if not a defender if (!obj.GetComponent <Defenders>()) { return; } anim.SetBool("isAttacking", true); attackers.Attack(obj); }
void OnTriggerEnter2D(Collider2D collider) { obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } else { animate.SetBool("Explode", true); attackobject.Attack(obj); } }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } else { Debug.LogWarning("Not a defender"); } anim.SetBool("isAttacking", true); attacker.Attack(obj); }
/// <summary> /// /// </summary> void OnTriggerEnter2D(Collider2D collider) { obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } if (obj.GetComponent <Stone>()) { animate.SetBool("isJumping", true); } else { animate.SetBool("isAttacking", true); attackobject.Attack(obj); } Invoke("invokebool", 0.5f); }
// Attack starts after colliding with something void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } anim.SetBool("isAttacking", true); attacker.Attack(obj); attacker.StrikeCurrentTarget(15f); // Defender health reached 0, interrupts the attack and starts moving if (obj.GetComponent <Health>().HP < 0) { anim.SetBool("isAttacking", false); } }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } if (obj.GetComponent <Stone>()) { anim.SetTrigger("jump trigger"); } else { anim.SetBool("isAttacking", true); attacker.Attack(obj); } }
void OnTriggerEnter2D(Collider2D collider) { obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } else { animate.SetBool("isAttacking", true); attackobject.Attack(obj); thereIsADefender = true; defenderHealth = obj.GetComponent <Health>(); thereIsADefender = true; defenderHealthValue = defenderHealth.health; } }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; //Leave the method if not a defender if (!obj.GetComponent <Defenders>()) { return; } if (obj.GetComponent <GraveStone>()) { Debug.Log("Fox Collided with " + collider); anim.SetTrigger("JumpTrigger"); } else { anim.SetBool("isAttacking", true); attackers.Attack(obj); } }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; // Leave method if not colliding with defender if (!obj.GetComponent <Defenders>()) { return; } //Trigger jump animation if (obj.GetComponent <Stone>()) { anim.SetTrigger("jumpTrigger"); } else { // Set's animation to attacking anim.SetBool("isAttacking", true); attacker.Attack(obj); } }
void OnTriggerEnter2D(Collider2D collider) { GameObject obj = collider.gameObject; if (!obj.GetComponent <Defenders>()) { return; } else if (obj.GetComponent <Stone>()) { anim.SetTrigger("jump once"); } else { anim.SetBool("isAttacking", true); attacker.Attack(obj); attacker.StrikeCurrentTarget(10); if (obj.GetComponent <Health>().HP < 0) { anim.SetBool("isAttacking", false); Destroy(obj); } } }