IEnumerator Attack() { //enter while (state == CharacterState.Attack) { yield return(null); //stay MoveUtil.RotateBurst(transform, attackPoint.transform); if (Vector3.Distance(transform.position, attackPoint.transform.position) > attackRange && RemainTime(0.7f)) { SetState(CharacterState.AttackRun); break; } if (monsterFSM.state == CharacterState.Dead && (a.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f) > 0.7) { attackPoint.SetActive(false); SetState(CharacterState.Idle); break; } } //exit }
IEnumerator Attack() { //enter while (state == CharacterState.Attack) { yield return(null); //stay MoveUtil.RotateBurst(transform, player); if (Vector3.Distance(transform.position, player.position) > attackRange) { SetState(CharacterState.Run); break; } if (playerFSM.IsDead()) { SetState(CharacterState.Idle); break; } } //exit }
public void ProcessDamage(float damage) { currentHP -= (int)damage; if (currentHP <= 0) { SetState(CharacterState.Dead); currentHP = 0; } else { SetState(CharacterState.Run); MoveUtil.RotateBurst(transform, player); } }