Commit e478b624 authored by catdog's avatar catdog

NoteObject의 NoteHit 구현

parent 7ed14ee0
fileFormatVersion: 2
guid: b91d9e17939dbb54ca7c770b6ede3001
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: e640eeafa4d7b8645b26c885d7eba308
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 39e07a022f545624db4f9f7a8480a8d3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -100,7 +100,7 @@ class ForwardNote : Note
protected override void FromBmsNum(string num)
{
Debug.Log(num);
//Debug.Log(num);
// since 00 is used for empty notes, 1 ~ Z is valid range
x = charToCoord(num[0]) / 35.0f;
y = charToCoord(num[1]) / 35.0f;
......
......@@ -44,6 +44,9 @@ public class ForwardNoteObject : NoteObject
}
private void Start()
{
NoteHit(NoteHitType.PERFECT);
Debug.Log("A");
}
private void OnDisable()
......@@ -67,7 +70,7 @@ public class ForwardNoteObject : NoteObject
public override void NoteHit(NoteHitType type)
{
//OnNoteHit(NoteHitType.PERFECT, 300);
base.NoteHit(type);
}
public override void SetPosition(float remainedTime)
......
......@@ -14,7 +14,7 @@ public class GameManager : MonoBehaviour
private void Start()
{
NoteObject.OnNoteHit += UpdateScore;
}
public void StartStage()
......
......@@ -7,13 +7,11 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
{
public GameObject ringUIPrefab;
public List<GameObject> hitEffectPrefabs = new List<GameObject>();
private void Start()
{
NoteObject.OnNoteHit += OnNoteHit;
}
public void OnNoteHit(NoteHitType type, int score)
public void OnNoteHit(NoteHitType type)
{
}
......
......@@ -7,14 +7,15 @@ using UnityEngine.UI;
public enum NoteHitType
{
PERFECT,
GOOD,
BAD,
PERFECT_OTHER_HAND,
HIT,
HIT_OTHER_HAND,
MISS
}
public abstract class NoteObject : MonoBehaviour
{
public static Action<NoteHitType, int> OnNoteHit;
public static Action<NoteHitType> OnNoteHit;
protected float remainedTime;
public Vector3 startPoint { get { return endPoint + new Vector3(0, 0, 50); } }
......@@ -23,7 +24,6 @@ public abstract class NoteObject : MonoBehaviour
public float maxRemainedTime = 1;
public float perfectZ = 10;
protected virtual void OnDestroy()
{
......@@ -34,7 +34,12 @@ public abstract class NoteObject : MonoBehaviour
remainedTime = maxRemainedTime;
}
public abstract void NoteHit(NoteHitType type);
public virtual void NoteHit(NoteHitType type)
{
OnNoteHit?.Invoke(type);
Instantiate(PlayEngine.inst.hitEffectPrefabs[(int)type], transform.position, Quaternion.identity);
Destroy(gameObject);
}
public virtual void SetPosition(float remainedTime)
{
......
......@@ -19,6 +19,9 @@ public class PlayEngine : SingletonBehaviour<PlayEngine>
private double startDspTime;
public int test;
public List<GameObject> hitEffectPrefabs = new List<GameObject>();
public void Start()
{
audioSource = GetComponent<AudioSource>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment