Today's Lesson: Looting Coins
Summary
1. We take a look at how we can make the engine generate a random amount of coins when the player collects a loot bag and add it to their current balance.
2. We also go over how we can display that random value on the screen as a variable.
Virtus Learning Hub
✅ 클래스별 재화 획득
◼️ 재화 관리를 위한 클래스 구분
In <ThirdPersonGameMode>
- New Variable: ClassSelected
- Type: Integer, Default Value: 0
- New Variable: AmountFound
- Type: Integer, Default Value: 0
In Widget BP <Class_Select>
- Select Magic Character 이후
ThirdPersonGameMode의 ClassSelected 1로 설정
- Select Sword Character 이후
ThirdPersonGameMode의 ClassSelected 2로 설정

◼️ 클래스별 재화 획득 로직
In <LootBagWidget>
- Construct Event
Create Widget을 통해 매번 새로운 위젯 인스턴스가 생성되고, 각각의 인스턴스는 고유한 Counstruct Event를 실행한다
- 게임 모드의 AmountFound 변수를 매번 랜덤하게 설정
- 게임 모드의 ClassSelected 변수가
- 1인 경우 Magic Character의 Currency를
- 2인 경우 Sword Character의 Currency를
AmountFound 값만큼 더한 뒤 다시 저장

✅ UI
◼️ 재화 개수 표시
- CoinsNumber - 바인딩 생성

✅ Result
- 재화 획득

- 재화 합산: 22 + 24
