Page 425 - MDP2022-3
P. 425
public bool is_can_hit = true;
public void CanHit()
{
is_can_hit = true;
}
private void OnTriggerStay(Collider other)
{
if (other.tag == "Flash" && awakeSuccess && !isKilling)
{
navAgent.isStopped = true;
dmg_Timer += Time.deltaTime;
if (dmg_Timer >= 3)
{
Destroy(gameObject);
}
if (is_can_hit)
{
is_can_hit = false; //flag
audiosourece.clip = cry_audio; //오디오 우는걸로변경
audiosourece.Play();
animator.avatar = null; //애니메이션 동작을 위한 아바타 삭제
animator.SetTrigger("isDamaged");
}
}
}
public void NotDie()
{
dmg_Timer = 0;
audiosourece.clip = laugh; //오디오 원래대로 돌리기
audiosourece.Play();
animator.avatar = avatar;
animator.SetBool("isWalk", true);
navAgent.isStopped = false;
is_can_hit = true;
}
}