https://yangsooplus.github.io/unsleep-cave/
- 스테레오 사운드를 지원하지 않습니다.
- 웹 환경에서 구동할 수 있도록 경량화하여 실제 게임과는 다릅니다.
- 실제 플레이는 아래 영상을 확인해주세요.
- csv로 동굴 맵 데이터를 표현
- csv 한 칸은
Carven
객체 하나를 나타냄 - CaveMapParser에서 DFS로 csv를 탐색하여
Cavern
Tree로 전체 맵을 구성
public class Cavern
{
public int routeCnt;
public int talkId;
public string soundPosition;
public int soundIndex;
public float volume;
public int soundIndex2;
public float volume2;
public bool isObject = false;
public int objectIndex;
public bool isSave;
public Cavern prev = null;
public Cavern[] next = null;
}
- CaveMapManager에서 전진할때마다 지나온 길(Cavern)을 Stack에 Push한다.
public void proceed(int routeIndex) // routeIndex: 전진하려는 길의 인덱스
{
if (caveMapRenderer.moving) return;
stack.Push(currentCavern); // 지나온 길을 push
currentCavern = currentCavern.next[routeIndex]; // 현재 위치를 전진할 길로 이동
caveMapRenderer.proceed(currentCavern); // 화면 + 소리 갱신
(생략)
}
- 후퇴할 때에는 Stack에서 pop한 길로 이동한다.
public void back()
{
if (caveMapRenderer.moving) return;
currentCavern = stack.Pop();
caveMapRenderer.back(currentCavern); // 화면 + 소리 갱신
if (stack.Count == 0) backButton.SetActive(false); // 스택이 비었을 경우, 뒤로 후퇴하는 버튼을 숨긴다.
}
public void returnLastPoint()
{
if (stack.Count == 0 || stack.Peek().isSave) return; // 지나온 길이 없거나 이미 중간포인트에 있는 경우
while (!stack.Peek().isSave) // 중간 포인트에 도달할 때까지 지나온 길을 pop한다.
{
stack.Pop();
}
currentCavern = stack.Pop(); // 중간포인트
caveMapRenderer.renderCavern(currentCavern); // 화면 + 소리 갱신
if (stack.Count == 0) backButton.SetActive(false); // 스택이 비었을 경우, 뒤로 후퇴하는 버튼을 숨긴다.
}