EnemyDuel GetNonDuelingTarget() { //return enemyOnRange.GetListOfTargets()[0].GetComponent<EnemyDuel>(); // // var targets = enemyOnRange.GetListOfTargets(); foreach (GameObject tempEnemy in targets) { var tempEnemyDuel = tempEnemy.GetComponent <EnemyDuel>(); if (tempEnemyDuel.IsOnDuelWithOtherThanMe(this)) { continue; } else { return(tempEnemyDuel); } } if (enemyOnRange.GetListOfTargets().Count > 0) { return(enemyOnRange.GetListOfTargets()[0].GetComponent <EnemyDuel>()); } return(null); }
void Shoot() { if (!reloadTimer.isReloaded) { return; } if (!enemyOnRangeChecker.HasValidTargetOnRange()) { return; } if (duelData != null) { if (duelData.canAttack == false) { return; } } animator.Play("Attacking"); Invoke("DoShoot", damageData.delayOfAttack); target = enemyOnRangeChecker.GetListOfTargets()[0]; FaceTheTarget(); reloadTimer.Start(); }