private void OnTriggerEnter2D(Collider2D collider) { ColisionesCaleb player = collider.GetComponent <ColisionesCaleb>(); if (player) { numCol++; } if (collider.gameObject.name == "Caleb") { if (numCol == 4) { if (Caleb.isDashing) { timeToWait = startTimeToWait; transform.position = Vector2.MoveTowards(transform.position, target.position, 0); Lamia.bodyType = RigidbodyType2D.Static; LamiaAnimation.SetBool("Walking", false); cantMove = true; checkMove = false; numHit++; } if (numHit == 2) { ColliderLamia.enabled = false; ColliderLamia2.enabled = false; ColliderLamia3.enabled = false; ColliderLamia4.enabled = false; TriggerLamia.enabled = false; //SpriteRenderLamia.enabled = false; isDead = true; cantMove = true; checkMove = false; LamiaAnimation.SetBool("Death", true); //Destroy(LamiaGO); } else if (attackDeelay <= 0f && Caleb.isDashing == false && cantMove == false) { Lamia.bodyType = RigidbodyType2D.Static; LamiaAnimation.SetBool("Attack", true); curAnimationTime = startAnimationTime; Lamia.transform.position = Vector2.MoveTowards(Lamia.transform.position, target.position, 0); hpBar.value -= 15f; attackDeelay = startAttackDeelay; } } } }
private void OnTriggerExit2D(Collider2D collider) { ColisionesCaleb player = collider.GetComponent <ColisionesCaleb>(); if (player) { numCol--; } if (!cantMove) { if (Reputacion.reputation == 10 && numCol == 2) { checkMove = false; } //Rata if (Reputacion.reputation == 20 && numCol == 1) { checkMove = false; } //Humano } }