//IEnumerator delay() //{ // yield return new WaitForSeconds(0.5f); //} public void boomFire(int windDir) { Vector3 nlocation; switch (windDir) { case 0: //좌 fd = LeftCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.x -= 0.7f; if (fd.hit == false && nlocation.x >= -2.1f) { Instantiate(fr, nlocation, transform.rotation); } break; case 1: //우 fd = RightCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.x += 0.7f; if (fd.hit == false && nlocation.x <= 2.1f) { Instantiate(fr, nlocation, transform.rotation); } break; case 2: //상 fd = UpCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.y += 0.7f; if (fd.hit == false && nlocation.y <= 4.0f) { Instantiate(fr, nlocation, transform.rotation); } break; case 3: //하 fd = DownCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.y -= 0.7f; if (fd.hit == false && nlocation.y >= -1.4f) { Instantiate(fr, nlocation, transform.rotation); } break; } }
//확산된다 public void deffusionFire(int windDir) { // 1. 10초 마다 바람의 방향에 따라 각 '불'오브젝트 기준으로 1개 씩 생성 // 2. 인화물질을 만나면 인화물질을 기준으로 동-서-남-북 사방으로 1개 씩 생성 // 3. 15초 마다 상황이 제시되고, 상황에서 '불'의 확산 상황 발생 시 // # 같은 위치에 중첩되지 않는다 Vector3 nlocation; switch (windDir) { case 0: //왼쪽 불 번짐 fd = LeftCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.x -= 0.7f; //불의 왼쪽에 불이 없고 맵을 벗어나지 않았다면 생성 if (fd.hit == false && nlocation.x >= -2.3f) { Instantiate(fr, nlocation, transform.rotation); } break; case 1: //우 fd = RightCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.x += 0.7f; //불의 오른쪽에 불이 업고 맵을 벗어나지 않았다면 생성 if (fd.hit == false && nlocation.x <= 2.3f) { Instantiate(fr, nlocation, transform.rotation); } break; case 2: //상 fd = UpCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.y += 0.7f; //불의 윗쪽에 불이 없고 맵을 벗어나지 않았다면 생성 if (fd.hit == false && nlocation.y <= 4.2f) { Instantiate(fr, nlocation, transform.rotation); } break; case 3: //하 fd = DownCollis.GetComponent <FireDetector>(); nlocation = transform.position; nlocation.y -= 0.7f; //불의 아랫쪽에 불이 없고 맵을 벗어나지 않았다면 생성 if (fd.hit == false && nlocation.y >= -1.7f) { Instantiate(fr, nlocation, transform.rotation); } break; } }