6-9. 15조 Monster 수정

keubung·2024년 12월 6일

Monster 수정

다른 기능들이 추가되며 Monster가 상속받는 IDetectable의 사용법이 달라졌고 그로인해 Monster가 제대로 움직이지 않게 되었음.

1. Monster.cs

Revealed, Invisible 수정

    public virtual void Revealed() // 태블릿 내릴때
    {
        if (StateType != PropStateType.DetectCompleted)
        {
            Detected();
            return;
        }

        StateType = PropStateType.Revealed;
        myRenderer.enabled = true;
        mapIcon.Revealed();

        myController.SetState(AIStateType.Wandering);
    }

    public virtual void Invisible() // 초기화 - 감지범위 벗어났을 때
    {
        StateType = PropStateType.None;
        mapIcon.Invisible();
        myRenderer.enabled = false;
    }

2. MonsterController.cs

void ResetCycle()
{
    SetState(AIStateType.Idle);
    StopCoroutine(timer);
    timer = null;
    ResetWanderingCount();
    canWander = true;
    monster.Invisible();
}

3. Tofu(Monster)의 설정 수정

Tofu(Monster)의 Rigidbody - Is Kinematic true
: 멈춰있어야 하는 상황에 회전을 하면 두부가 조금씩 움직임
: 벽에 가까이 가면 마찰로 인해 속도가 느려짐

  • Is Kinematic : Unity의 물리 엔진에서 작용하는 힘(중력, 충돌 등)에 의해 움직이지 않고 대신 스크립트나 Transform을 통해 직접 위치와 회전을 제어
    -> Is Kinematic을 활성화해서 외부 힘의 영향을 받지 않도록 하여 해결
profile
김나영(Unity_6기)

0개의 댓글