BeatSaber 게임 모작 및 이그노어등

This commit is contained in:
jongjae0305
2026-04-30 14:00:10 +09:00
commit 0b6374511c
1503 changed files with 177358 additions and 0 deletions
@@ -0,0 +1,9 @@
using UnityEngine;
public class Cube : MonoBehaviour
{
void Update()
{
transform.position += Time.deltaTime * transform.forward * 2;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a6e8b48d2a534ce4cbbd814c811b8706
@@ -0,0 +1,33 @@
using System.ComponentModel.Design.Serialization;
using UnityEngine;
public class Saber : MonoBehaviour
{
public LayerMask layer;
Vector3 prevPos;
void Start()
{
}
void Update()
{
RaycastHit hit;
if(Physics.Raycast(transform.position, transform.forward, out hit, 1, layer))
//Raycast는 위치값을 받는 클래스로 뒤의 인수는 위치, 방향, 저장되는 변수, 거리, layer에 해당되는것만
{
Vector3 v1 = transform.position - prevPos; // 현재위치 - 이전 위치 = 이동방향
if(Vector3.Angle(v1, hit.transform.up) > 130)
//두 벡터 사이의 벌어진 각도를 구하는 함수 이동방향v1과 충돌한 물체의 위쪽방향
{
Destroy(hit.transform.gameObject);
}
}
prevPos = transform.position;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d1198f924174495469408455924b5610
@@ -0,0 +1,35 @@
using UnityEngine;
public class Spawner : MonoBehaviour
{
public GameObject[] cube;
public Transform[] point;
public float beat = 1;
float timer = 0f;
void Start()
{
}
// Update is called once per frame
void Update()
{
if(timer > beat)
{
int c = Random.Range(0, 2);
int p = Random.Range(0, 4);
GameObject obj = Instantiate(cube[c], point[p]); //beatBox를 랜덤하게 생성
obj.transform.localPosition = Vector3.zero; //박스의 벡터(방향을 초기화)
obj.transform.Rotate(transform.forward, 90 * Random.Range(0, 4)); //박스의 회전(방향, 회전률)
timer -= beat;
}
timer += Time.deltaTime;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b0370d061b6ce824685b1470ed1a9ed2