Files
whdwo798 4dad9e5d5b feat: SongCreator 씬 완성 — Beat Sage URL 지원, info.dat 메타데이터 자동 추출
- BeatSageUploader: audio_url 지원(UploadFromUrl), PollAndDownload 공통화, ZIP 500 오류 3회 재시도
- BeatSageConverter: info.dat 파싱(SongMetadata), BPM 자동 감지 → 노트 타이밍 변환에 적용
- SongCreatorManager: title/BPM 필수 입력 제거, 난이도 4개 자동 선택, GenerateFlowFromUrl 버그 수정
- NasPublisher: audioPath null 허용(URL 흐름에서 로컬 파일 없는 경우 스킵)
- .gitignore/.gitattributes 초기 설정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 23:37:34 +09:00

90 lines
3.8 KiB
C#

using System.Collections;
using UnityEngine;
namespace EzySlice {
/**
* Define Extension methods for easy access to slicer functionality
*/
public static class SlicerExtensions {
/**
* SlicedHull Return functions and appropriate overrides!
*/
public static SlicedHull Slice(this GameObject obj, Plane pl, Material crossSectionMaterial = null) {
return Slice(obj, pl, new TextureRegion(0.0f, 0.0f, 1.0f, 1.0f), crossSectionMaterial);
}
public static SlicedHull Slice(this GameObject obj, Vector3 position, Vector3 direction, Material crossSectionMaterial = null) {
return Slice(obj, position, direction, new TextureRegion(0.0f, 0.0f, 1.0f, 1.0f), crossSectionMaterial);
}
public static SlicedHull Slice(this GameObject obj, Vector3 position, Vector3 direction, TextureRegion textureRegion, Material crossSectionMaterial = null) {
Plane cuttingPlane = new Plane();
Vector3 refUp = obj.transform.InverseTransformDirection(direction);
Vector3 refPt = obj.transform.InverseTransformPoint(position);
cuttingPlane.Compute(refPt, refUp);
return Slice(obj, cuttingPlane, textureRegion, crossSectionMaterial);
}
public static SlicedHull Slice(this GameObject obj, Plane pl, TextureRegion textureRegion, Material crossSectionMaterial = null) {
return Slicer.Slice(obj, pl, textureRegion, crossSectionMaterial);
}
/**
* These functions (and overrides) will return the final indtaniated GameObjects types
*/
public static GameObject[] SliceInstantiate(this GameObject obj, Plane pl) {
return SliceInstantiate(obj, pl, new TextureRegion(0.0f, 0.0f, 1.0f, 1.0f));
}
public static GameObject[] SliceInstantiate(this GameObject obj, Vector3 position, Vector3 direction) {
return SliceInstantiate(obj, position, direction, null);
}
public static GameObject[] SliceInstantiate(this GameObject obj, Vector3 position, Vector3 direction, Material crossSectionMat) {
return SliceInstantiate(obj, position, direction, new TextureRegion(0.0f, 0.0f, 1.0f, 1.0f), crossSectionMat);
}
public static GameObject[] SliceInstantiate(this GameObject obj, Vector3 position, Vector3 direction, TextureRegion cuttingRegion, Material crossSectionMaterial = null) {
EzySlice.Plane cuttingPlane = new EzySlice.Plane();
Vector3 refUp = obj.transform.InverseTransformDirection(direction);
Vector3 refPt = obj.transform.InverseTransformPoint(position);
cuttingPlane.Compute(refPt, refUp);
return SliceInstantiate(obj, cuttingPlane, cuttingRegion, crossSectionMaterial);
}
public static GameObject[] SliceInstantiate(this GameObject obj, Plane pl, TextureRegion cuttingRegion, Material crossSectionMaterial = null) {
SlicedHull slice = Slicer.Slice(obj, pl, cuttingRegion, crossSectionMaterial);
if (slice == null) {
return null;
}
GameObject upperHull = slice.CreateUpperHull(obj, crossSectionMaterial);
GameObject lowerHull = slice.CreateLowerHull(obj, crossSectionMaterial);
if (upperHull != null && lowerHull != null) {
return new GameObject[] { upperHull, lowerHull };
}
// otherwise return only the upper hull
if (upperHull != null) {
return new GameObject[] { upperHull };
}
// otherwise return only the lower hull
if (lowerHull != null) {
return new GameObject[] { lowerHull };
}
// nothing to return, so return nothing!
return null;
}
}
}