Unity/Asset 분석

RTS Side Attack 안되는 원인

lipnus 2022. 5. 29. 21:44
반응형

UnitAttack에서 LOS해놓으면 안됨... 왜 안되는지는 자세히 안봄...

 

 

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);
            }

        }

 

여기 때문인거 같은데..

 

 

 

반응형