示例#1
0
        public void StartDefenseOperation(DamageDealerComponent damageDealer)
        {
            if (damageDealer is null)
            {
                return;
            }
            if (_instanceIdEnemyList.Any(e => e == damageDealer.GetInstanceID()))
            {
                return;
            }
            _instanceIdEnemyList.Add(damageDealer.GetInstanceID());

            StartCoroutine(DefenseOperation(damageDealer));
        }
示例#2
0
        IEnumerator DefenseOperation(DamageDealerComponent damageDealer)
        {
            float _internalCdw = 0f;

            if (damageDealer != null)
            {
                InteractableComponent enemyInteractableComponent = damageDealer.GetComponent <InteractableComponent>();

                while (_internalCdw <= damageDealer.CdwDamage)
                {
                    _internalCdw += Time.deltaTime;
                    yield return(new WaitForFixedUpdate());
                }

                if (enemyInteractableComponent.IsAttackingThisMonster(this.GetInstanceID()) && _readyToCombat)
                {
                    damageDealer.StartAtackAnimation(this);
                    StartCoroutine(DefenseOperation(damageDealer));
                }
                else
                {
                    _instanceIdEnemyList.Remove(damageDealer.GetInstanceID());
                }
            }
        }