카테고리 없음

0722 유니티(체력 증감에 따른 모션 변화), #if문 테스트

버스창문 2025. 7. 22. 11:19

 

 

Sync

 

layer가 여러개일때, Base Layer의 형태를 그대로 들고오는 내용

 

똑같이 내려오긴하지만, 안에 모션 내용들은 전부 빠진다

파라미터 및 내부 모션 셋팅

hp체크할 ui셋팅

 

 

 

 

 

    void Start()
    {
        this.anim = GetComponent<Animator>();
        this.hpSlider.onValueChanged.AddListener((value) =>
        {
            this.hp = (int)(100 * value);
            this.hpText.text = $"HP : {this.hp}";
            this.anim.SetLayerWeight(1, 1 - value);
        });
    }

슬라이더의 값이 변하면 체력이 변동하게 설정,

체력이 적을수록 injured의  LayerWeight가 높아지게 해서 다친 모션이 나오게함

 

 

수류탄 던지기

윗모션만 따서

Throw 트리거와 함께 모션 셋팅

    public void GranadeThrow()
    {
        this.anim.SetTrigger("Throw");
    }

던지기

 

 

 

_________________________________________________________________

 

else쪽에선 아예 회색으로 떠서 코드치기 불편함

이쪽을 Release로 바꿈

색이 들어온곳이 바뀌고, 코드 추천도 잘뜸