private void OnTriggerEnter(Collider other) { //detect if its the enemy EnemyBehavior enemy = other.gameObject.GetComponent <EnemyBehavior>(); //if its a valid enemy if (enemy != null) { int damage = _playerStats.GetBasicAttackDamage(); enemy.DamageEnemy(damage); _levelController.StartCoroutine(_levelController.DisplayPlayerDamage(enemy.transform.position, damage)); //restore 1 tp on succesful hit _playerStats.GainTP(1); } }
private void OnTriggerEnter(Collider other) { //detect if its the enemy EnemyBehavior enemy = other.GetComponent <EnemyBehavior>(); //if its a valid enemy if (enemy != null) { int arteAttack = _player.GetArteAttackDamage(); _levelController.StartCoroutine(_levelController.DisplayPlayerDamage(transform.position, arteAttack)); enemy.DamageEnemy(arteAttack); Instantiate(_onHit, transform.position + (transform.forward * 0.6f), Quaternion.identity); Destroy(gameObject); } }