public IEnumerator Replace(Collider2D collision) { transitSystem.SetTrigger("TransitIn"); yield return(new WaitForSeconds(0.15f)); collision.transform.position = playerSpawn.position; DataPlayerChange playerHealth = collision.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(10); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { HitDetection(); StartCoroutine(Change()); DataPlayerChange playerHealth = collision.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(30); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { toDest = (toDest + 1) % checkPoints.Length; theTarget = checkPoints[toDest]; enemiesSprite.flipX = !enemiesSprite.flipX; DataPlayerChange playerHealth = collision.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(30); } }
private void Attack() { hit = true; // On ajoute les animations, elle se lance si first est 'true' ou bien si second est 'true'. bossAnimator.SetBool("Attack1", firstAttack); bossAnimator.SetBool("Attack2", secondAttack); // On instancie un tableau qui récupère tout les Collider qui rentre dans la hache au moment de l'attaque. Collider2D[] player_Hits = Physics2D.OverlapCircleAll(axe.position, attackRadius, playerLayer); // Pour chaque item (uniquement player ici (on prépare la possibilité de toucher deux joueurs à l'avenir)) // on récupère sa santé et on la décrémente de la puissance du Minotaure. foreach (Collider2D item in player_Hits) { DataPlayerChange playerHealth = item.transform.GetComponent <DataPlayerChange>(); playerHealth.TakeDamage(bossDamage); } }