열쇠 3개를 방에 랜덤 배치하고 3개를 먹은 후 엔딩방에 도달하면 문이열리도록 구현했다.
엔딩 애니메이션 페이드 인/아웃과 적에게 잡혔을 때의 애니메이션도 추가!
public class KeyGenerator : MonoBehaviour
{
[SerializeField] private GameObject keyPrefab;
[SerializeField] private Transform[] spawnPoints;
[SerializeField] private int numberOfKeys = 3;
private bool[] check;
void Start()
{
check = new bool[spawnPoints.Length];
while (numberOfKeys > 0)
{
int index = Random.Range(0, spawnPoints.Length);
if (!check[index])
{
check[index] = true;
Instantiate(keyPrefab, spawnPoints[index].position, Quaternion.identity, transform);
numberOfKeys--;
}
}
}
}
0
어려운건 없었다.
이제 포스트 프로세싱에 대해 배워보고 적용해봐야지
'Unity > John Lemon in Nightmareland' 카테고리의 다른 글
Unity Piscine Module06 - 9. 적 추가 (0) | 2024.08.27 |
---|---|
Unity Piscine Module06 - 8. Post Processing 적용 (0) | 2024.08.27 |
Unity Piscine Module06 - 6. 맵 구현 (0) | 2024.08.26 |
Unity Piscine Module06 - 5. FPS / TPS 시점 적용 (0) | 2024.08.25 |
Unity Piscine Module06 - 4. 움직임 구현 (0) | 2024.08.22 |