반응형
AttackEntity.cs
protected virtual void OnTargetUpdate()
{
//the override of this method in both the UnitAttack and BuildingAttack components are responsible for checking the conditions for which an attack can be continued or not
//reaching this stage means that all conditions have been met and it's safe to continue with the attack
if (wasInTargetRange == false) //if the attacker never was in the target's range but just entered it:
OnEnterTargetRange();
if (reloadTimer > 0 || IsInLineOfSight() == false) //still in reload time or not facing target? do not proceed
return;
if (delayTimer > 0) //delay timer
{
delayTimer -= Time.deltaTime;
return;
}
//If the attack delay is over, the attack is triggered and LOS conditions are met
if (triggered)
{
if (direct == true) //Is this a direct attack (no use of attack objects)?
{
attackPerformedEvent.Invoke();
//not an area attack:
CustomEvents.OnAttackPerformed(this, Target, GetTargetPosition());
damage.TriggerAttack(Target, GetTargetPosition());
gameMgr.AudioMgr.PlaySFX(FactionEntity.AudioSourceComp, attackAudio.Fetch(), false);
OnAttackComplete();
}
else if (attackObjectLauncher.OnIndirectAttackUpdate()) //indirect attack ? -> must launch attack objects
gameMgr.AudioMgr.PlaySFX(FactionEntity.AudioSourceComp, attackAudio.Fetch(), false);
}
}
여기 때문인거 같은데..
반응형
'Unity > Asset 분석' 카테고리의 다른 글
Toon FX (0) | 2023.01.20 |
---|---|
[RTS Engine] 공격에 반응하지 않게 하기 & 반응 후 처리 (0) | 2022.06.18 |
[RTS Engine] [GridSearchHandler] No search cell has been defined to contain position: {position}! (0) | 2022.03.12 |
[RTS Engine] Attack시 자폭판정이 쓰는 버그 (0) | 2022.01.25 |
[RTS Engine] 현재 Scene에 Spawn된 Unit Instance접근 (0) | 2022.01.08 |