protected virtual IEnumerator MS_Attack2() { MoveUtil.RotateToDirBurst(transform, player.transform); do { yield return(null); if (IsDead()) { break; } if (Vector3.Distance(transform.position, player.transform.position) > State.AttackRange && m_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f > 0.7f) { SetState(CH_STATE.MS_AttackRun); break; } else if (Vector3.Distance(transform.position, player.transform.position) <= State.AttackRange && m_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f > 0.7f) { SetState(CH_STATE.MS_Wait); break; } if (player.IsDead()) { SetState(CH_STATE.MS_Wait); break; } } while (!isNewState); }
public void TakeDamage() { if (IsDead()) { return; } StartCoroutine(ReDoColor()); ChangeColor(GetComponentsInChildren <SkinnedMeshRenderer>(), new Color(0.3455882f, 0, 0)); float Damage; if (player.IsWhirlwind()) { Damage = Random.Range(player.MinDamage / 2, player.MaxDamage / 2); SoundManager.Instance.PlaySFX("Whirlwind_Explosion", 0.3f); Health.TakeDamage((int)Damage); } else if (player.IsBash()) { Damage = Random.Range(player.MinDamage * 2, player.MaxDamage * 2); Health.TakeDamage((int)Damage); } else { Damage = Random.Range(player.MinDamage, player.MaxDamage); SoundManager.Instance.PlaySFX("BasicAttack", 0.5f); Health.TakeDamage((int)Damage); } MemoryPoolManager.Instance.CreateObject("Hit1", transform); Vector3 FontPosition; if (this.State.Name != "Evil Orca") { FontPosition = new Vector3(transform.position.x, this.transform.position.y + 2.0f, transform.position.z); } else { FontPosition = new Vector3(transform.position.x, this.transform.position.y + 6.0f, transform.position.z); } MemoryPoolManager.Instance.CreateTextObject("DamageFont", FontPosition, (int)Damage); if (Health.IsDeath()) { ChangeShader(GetComponentsInChildren <SkinnedMeshRenderer>(), "Custom/DissolveShader"); NavMesh.isStopped = true; SetState(CH_STATE.MS_Dead); stringBuilder.Length = 0; stringBuilder.Append(State.Name); stringBuilder.Append("_Death"); SoundManager.Instance.PlaySFX(stringBuilder.ToString()); return; } if (CHState != CH_STATE.MS_Attack && CHState != CH_STATE.MS_Attack2 && CHState != CH_STATE.MS_Attack3 && CHState != CH_STATE.MS_BigAttack) { MoveUtil.RotateToDirBurst(transform, player.transform); } }