private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Templar")) //Faudra mettre le tag "Enemy" sur tous les ennemis { dormantEnemyScript = other.gameObject.GetComponent <DormantEnemy>(); dormantEnemyScript.Spell1AndPot2(); Destroy(this.gameObject); } }
private void Start() { enemy = GameObject.FindGameObjectWithTag("Enemy").transform; target = new Vector2(enemy.position.x, enemy.position.y); rb2d = GetComponent <Rigidbody2D>(); fwd = transform.TransformDirection(Vector3.up); DorEnemy = GetComponent <DormantEnemy>(); StartCoroutine(TicTac()); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "EnemyHitBox") { //applique effet //rb.AddForce(transform.right * forceAmount, ForceMode2D.Impulse); print("Enemy touched"); dormantEnemy = other.GetComponent <DormantEnemy>(); dormantEnemy.Spell2Effect(); } else { //se detruit contre murs/autres } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Templar")) //Faudra mettre le tag "Enemy" sur tous les ennemis { dormantEnemyScript = other.gameObject.GetComponent <DormantEnemy>(); dormantEnemyScript.Spell2Effect(); } if (other.CompareTag("Potion1") || other.CompareTag("Potion2")) { Destroy(gameObject); } //Si un jour on y arrive, faut stopper le collider contre les murs (pas le détruire mais faire en sorte qu'il aille pas plus loin) }
public void OnTriggerEnter2D(Collider2D other) { if (other.tag == "EnemyHitBox") { print("Enemy touched"); dormantEnemy = other.GetComponent <DormantEnemy>(); dormantEnemy.Spell1Effect(); Destroy(gameObject); //other.GetComponent<DormantEnemy>(); //GameObject dormantEnemy = other.GetComponent<DormantEnemy>(); //dormantEnemy.Spell1Effect(); //DormantEnemy dormantEnemy = gameObject.GetComponent<DormantEnemy>(); } else { //se detruit contre murs/autres } }