// - Apply debuff protected void DebuffApply(float[] debuffTime) { if (debuffState[(int)EnemyDebuffCase.Ice] == DebuffState.On) { OffDebuff(EnemyDebuffCase.Ice); } foreach (int debuff in Enum.GetValues(typeof(EnemyDebuffCase))) { if (debuff == (int)EnemyDebuffCase.END_POINTER || debuffTime[debuff] == 0.0f || debuffState[debuff] == DebuffState.Immune) { continue; } float duration = debuffTime[debuff]; switch ((EnemyDebuffCase)debuff) { case EnemyDebuffCase.Fire: if (fireDuration != 0.0f) { fireDuration += duration; } else { debuffState[debuff] = DebuffState.On; StartCoroutine(OnFire(duration)); } break; case EnemyDebuffCase.Ice: debuffState[debuff] = DebuffState.On; movementLock = EnemyMovementLock.Debuffed; StartCoroutine(OnIce(duration)); break; case EnemyDebuffCase.Stun: if (debuffState[debuff] != DebuffState.On) { debuffState[debuff] = DebuffState.On; movementLock = EnemyMovementLock.Debuffed; StartCoroutine(OnStun(duration)); } break; case EnemyDebuffCase.Blind: //StartCoroutine(OnBlind(duration)); break; case EnemyDebuffCase.Charm: //StartCoroutine(OnCharm(duration)); break; default: break; } } }
protected virtual void Start() { CurrHealth = maxHealth; Invisible = false; movementLock = EnemyMovementLock.Free; if (enemyManager.DropTableByID.ContainsKey(monsterID)) { dropTable = enemyManager.DropTableByID[monsterID]; } PlayerDistance = Vector2.Distance(GameManager.Instance.player.transform.position, transform.parent.position); }
// When damaged // - Calculate value & Arrange information public virtual void GetHit(PlayerAttackInfo attack) { TakeDamage(attack.damage); float knockbackDist = attack.damage * attack.knockBackMultiplier / weight; float knockbackTime = (knockbackDist >= 0.5f) ? 0.5f : knockbackDist; if (movementLock == EnemyMovementLock.Rigid) // 넉백이 진행 중 { StopCoroutine("Knockback"); } if (movementLock < EnemyMovementLock.Debuffed) { movementLock = EnemyMovementLock.Rigid; StartCoroutine(Knockback(knockbackDist, knockbackTime)); } DebuffApply(attack.debuffTime); animator.SetTrigger("TrackTrigger"); }
protected void OffDebuff(EnemyDebuffCase Case) { StartCoroutine(ImmuneTimer(Case, immunity_time[(int)Case])); switch (Case) { case EnemyDebuffCase.Ice: GetComponent <SpriteRenderer>().color = Color.white; StopCoroutine("OnIce"); movementLock = EnemyMovementLock.Free; animator.speed = 1.0f; animator.SetTrigger("DisableStunTrigger"); break; case EnemyDebuffCase.Stun: StopCoroutine("OnStun"); movementLock = EnemyMovementLock.Free; animator.speed = 1.0f; animator.SetTrigger("DisableStunTrigger"); break; default: break; } }