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(); }
public void Update() { if (towerTransform) { enemyOnRange.transform.position = towerTransform.position; } if (healthData.isDead) { CancelDuel(); return; } if (enemyDuel) { if (enemyDuel.GetComponent <Health>().isDead) { CancelDuel(); return; } } if (moverData.isMoving && (duelData.isMovingToDuel == false)) { CancelDuel(); return; } if (moverData.isMoving) { duelData.canAttack = false; } if (!enemyOnRange.HasValidTargetOnRange(enemyDuel)) { CancelDuel(); return; } if (enemyDuel == null) { enemyDuel = GetNonDuelingTarget(); } PrepareToDuel(); }
void Shoot() { if (!reloadTimer.isReloaded) { return; } if (!enemyOnRangeChecker.HasValidTargetOnRange()) { return; } if (duelData != null) { if (duelData.canAttack == false) { return; } } transform.parent.GetComponentInChildren <Animator>().Play("Attacking"); Invoke("DoShoot", damageData.delayOfAttack); reloadTimer.Start(); }