Commit 76bf8620 authored by 15박보승's avatar 15박보승

Merge branch 'notemovement' of https://git.kucatdog.net/ulongcha/rhythmkata into notemovement

parents 2c23ca16 928ffea4
...@@ -27,13 +27,13 @@ Transform: ...@@ -27,13 +27,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4640709078173886784} m_GameObject: {fileID: 4640709078173886784}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -3, z: 50} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 10, z: 1} m_LocalScale: {x: 10, y: 10, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4640709078173886787 --- !u!33 &4640709078173886787
MeshFilter: MeshFilter:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -111,4 +111,4 @@ MonoBehaviour: ...@@ -111,4 +111,4 @@ MonoBehaviour:
hitSfx: hitSfx:
- {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3} - {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3}
- {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3} - {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3}
direction: {x: 0, y: 0, z: 0} direction: {x: 0, y: -1, z: 0}
...@@ -28,8 +28,8 @@ Transform: ...@@ -28,8 +28,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4734231541000158423} m_GameObject: {fileID: 4734231541000158423}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5, y: 0, z: 50} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 7, z: 1} m_LocalScale: {x: 10, y: 10, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
...@@ -111,4 +111,4 @@ MonoBehaviour: ...@@ -111,4 +111,4 @@ MonoBehaviour:
hitSfx: hitSfx:
- {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3} - {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3}
- {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3} - {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3}
direction: {x: 0, y: 0, z: 0} direction: {x: -1, y: 0, z: 0}
...@@ -28,8 +28,8 @@ Transform: ...@@ -28,8 +28,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1476454008853626150} m_GameObject: {fileID: 1476454008853626150}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5, y: 0, z: 50} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 7, z: 1} m_LocalScale: {x: 10, y: 10, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
...@@ -111,4 +111,4 @@ MonoBehaviour: ...@@ -111,4 +111,4 @@ MonoBehaviour:
hitSfx: hitSfx:
- {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3} - {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3}
- {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3} - {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3}
direction: {x: 0, y: 0, z: 0} direction: {x: 1, y: 0, z: 0}
...@@ -27,13 +27,13 @@ Transform: ...@@ -27,13 +27,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4081910931583206819} m_GameObject: {fileID: 4081910931583206819}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 3, z: 50} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 10, z: 1} m_LocalScale: {x: 10, y: 10, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4081910931583206814 --- !u!33 &4081910931583206814
MeshFilter: MeshFilter:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -111,4 +111,4 @@ MonoBehaviour: ...@@ -111,4 +111,4 @@ MonoBehaviour:
hitSfx: hitSfx:
- {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3} - {fileID: 8300000, guid: e60d0bfc8448c5040af14e9faeaecae5, type: 3}
- {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3} - {fileID: 8300000, guid: b90743fe091960d4f837d44bbd2ad318, type: 3}
direction: {x: 0, y: 0, z: 0} direction: {x: 0, y: 1, z: 0}
...@@ -9568,7 +9568,7 @@ ParticleSystem: ...@@ -9568,7 +9568,7 @@ ParticleSystem:
serializedVersion: 6 serializedVersion: 6
lengthInSec: 0.2 lengthInSec: 0.2
simulationSpeed: 1 simulationSpeed: 1
stopAction: 0 stopAction: 2
cullingMode: 1 cullingMode: 1
ringBufferMode: 0 ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1} ringBufferLoopRange: {x: 0, y: 1}
......
This diff is collapsed.
fileFormatVersion: 2
guid: b8ffb5b84b254524abff419289c5adfd
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -43,7 +43,7 @@ ParticleSystem: ...@@ -43,7 +43,7 @@ ParticleSystem:
serializedVersion: 6 serializedVersion: 6
lengthInSec: 0.1 lengthInSec: 0.1
simulationSpeed: 1 simulationSpeed: 1
stopAction: 0 stopAction: 2
cullingMode: 3 cullingMode: 3
ringBufferMode: 0 ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1} ringBufferLoopRange: {x: 0, y: 1}
......
This diff is collapsed.
This diff is collapsed.
...@@ -23,7 +23,7 @@ class Level ...@@ -23,7 +23,7 @@ class Level
{ {
note.Deactivate(); note.Deactivate();
} }
note.HandleJudge(judge); note.HandleJudge(judge);
} }
} }
......
...@@ -6,6 +6,8 @@ public class EdgeNoteObject : NoteObject ...@@ -6,6 +6,8 @@ public class EdgeNoteObject : NoteObject
{ {
[SerializeField] [SerializeField]
private Vector3 direction; private Vector3 direction;
private const float radius = 100f;
public void Init(HandType hand) public void Init(HandType hand)
{ {
Material mat = GetComponent<Renderer>().material; Material mat = GetComponent<Renderer>().material;
...@@ -28,7 +30,22 @@ public class EdgeNoteObject : NoteObject ...@@ -28,7 +30,22 @@ public class EdgeNoteObject : NoteObject
public override void SetPosition(float remainedTime) public override void SetPosition(float remainedTime)
{ {
transform.position = Vector3.Lerp(endPoint, endPoint + new Vector3(0, 0, 200), remainedTime / maxRemainedTime);
if (remainedTime > 0.5f)
{
transform.position = new Vector3(0, 0, Mathf.Lerp(radius, 500, (remainedTime - 0.5f) * 2));
}
else
{
float angle = Mathf.Lerp(0, 90, Mathf.Pow(remainedTime * 2 - 1, 2));
transform.position = Quaternion.Euler(direction.x * angle, direction.y * angle, 0) * new Vector3(0, 0, radius);
transform.LookAt(Vector3.zero);
}
//transform.position = Vector3.Lerp(endPoint, endPoint + new Vector3(0, 0, 200), remainedTime);
} }
public override bool IsHit(Ray ray) public override bool IsHit(Ray ray)
......
...@@ -9,6 +9,7 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager> ...@@ -9,6 +9,7 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
public Text scoreText; public Text scoreText;
public Text comboText; public Text comboText;
private Vector3 comboTextPosition;
private void Start() private void Start()
{ {
...@@ -33,6 +34,17 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager> ...@@ -33,6 +34,17 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
if (combo < 1) if (combo < 1)
comboText.text = ""; comboText.text = "";
else else
{
comboText.text = combo.ToString() + " Combo!"; comboText.text = combo.ToString() + " Combo!";
StartCoroutine(ComboRoutine());
}
}
private IEnumerator ComboRoutine()
{
for (float t = 0; t < 0.2f; t += Time.deltaTime) {
comboText.transform.localPosition = Vector3.Lerp(new Vector3(0, 10), Vector3.zero, t * 5);
yield return new WaitForEndOfFrame();
}
comboText.transform.localPosition = Vector3.zero;
} }
} }
...@@ -14,7 +14,7 @@ public abstract class NoteObject : MonoBehaviour ...@@ -14,7 +14,7 @@ public abstract class NoteObject : MonoBehaviour
public Vector3 endPoint; public Vector3 endPoint;
public float maxRemainedTime = 5; public float maxRemainedTime = 5;
public float perfectZ = 10; public float perfectZ = 50;
public AudioClip[] hitSfx; public AudioClip[] hitSfx;
...@@ -60,10 +60,17 @@ public abstract class NoteObject : MonoBehaviour ...@@ -60,10 +60,17 @@ public abstract class NoteObject : MonoBehaviour
// TODO: temporary implementation // TODO: temporary implementation
// make note invisible // make note invisible
StartCoroutine(DissolveRoutine());
/*
var meshRenderer = gameObject.GetComponent<MeshRenderer>(); var meshRenderer = gameObject.GetComponent<MeshRenderer>();
var trailRenderer = gameObject.GetComponent<TrailRenderer>(); var trailRenderer = gameObject.GetComponent<TrailRenderer>();
if (meshRenderer) meshRenderer.enabled = false; if (meshRenderer) meshRenderer.enabled = false;
if (trailRenderer) trailRenderer.enabled = false; if (trailRenderer) trailRenderer.enabled = false;
*/
PlayEngine.inst.HandleNoteJudge(judge.type);
} }
} }
...@@ -75,4 +82,38 @@ public abstract class NoteObject : MonoBehaviour ...@@ -75,4 +82,38 @@ public abstract class NoteObject : MonoBehaviour
} }
public abstract bool IsHit(Ray ray); public abstract bool IsHit(Ray ray);
private IEnumerator DissolveRoutine()
{
Material mat = new Material(Shader.Find("Unlit/Dissolve"));
MeshRenderer mr = GetComponent<MeshRenderer>();
mat.SetColor("_Color", mr.material.color);
mat.SetColor("_Glow", (Color.white + mr.material.color) / 2);
mr.material = mat;
Texture2D noise = new Texture2D(100, 100);
float scale = UnityEngine.Random.Range(20, 50);
for (int i = 0; i < noise.width; ++i)
{
for (int j = 0; j < noise.height; ++j)
{
float noiseVal = Mathf.PerlinNoise(scale * i / noise.width, scale * j / noise.height);
noise.SetPixel(i, j, new Color(noiseVal, noiseVal, noiseVal, 1));
}
}
noise.Apply();
mat.SetTexture("_NoiseTex", noise);
const float time = 0.5f;
for (float t = 0; t < time; t += Time.deltaTime)
{
//print(t / time);
mat.SetFloat("_Threshold", t / time);
yield return null;
}
mat.SetFloat("_Threshold", 1);
}
} }
...@@ -30,7 +30,10 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> ...@@ -30,7 +30,10 @@ public class PlayEngine : SingletonBehaviour<PlayEngine>
public SteamVR_Action_Boolean fire; public SteamVR_Action_Boolean fire;
public SteamVR_Input_Sources leftHand; public SteamVR_Input_Sources leftHand;
public SteamVR_Input_Sources rightHand; public SteamVR_Input_Sources rightHand;
private int combo;
private int score;
public void Start() public void Start()
{ {
...@@ -121,6 +124,20 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> ...@@ -121,6 +124,20 @@ public class PlayEngine : SingletonBehaviour<PlayEngine>
startDspTime -= 1.0f; startDspTime -= 1.0f;
} }
} }
// Simple implementations of Combo, Score UIs
// It needs to be changed if PlayEngine don't have any responsibilities of score & combo
public void HandleNoteJudge(JudgeType type)
{
if (type == JudgeType.Ignore)
return;
combo = type != JudgeType.Miss ? combo + 1 : 0;
score += (int)type;
IngameUIManager.inst.UpdateComboUI(combo);
IngameUIManager.inst.UpdateScoreUI(score);
}
//
} }
public class PlayerInput public class PlayerInput
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: d9a533cec04e2124e9c31541b4f63e72 guid: c914f324cf453f049a32e43b44daeee1
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
Shader "Unlit/Dissolve"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_Color("Color", Color) = (1, 1, 1, 1)
_NoiseTex("Noise_Texture", 2D) = "white" {}
_Threshold("Threshold" , range(0,1)) = 0
_Glow("Glow", Color) = (1, 0.5, 0.5, 1)
_EmissionAmount("Emission amount", float) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 _Color;
sampler2D _NoiseTex;
float _Threshold;
fixed4 _Glow;
float _EmissionAmount;
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv) * _Color;
if (col.a < 0.01f)
discard;
if (tex2D(_NoiseTex, i.uv).r < _Threshold)
discard;
else if (tex2D(_NoiseTex, i.uv).r < _Threshold + 0.05f)
col = lerp(_Glow, col, (tex2D(_NoiseTex, i.uv).r - _Threshold) * 20);
//else
// o.Emission = _Glow * _EmissionAmount * pow(1 - (tex2D(_NoiseTex, IN.uv_MainTex).r - _Threshold), 10);
return col;
}
ENDCG
}
}
}
fileFormatVersion: 2
guid: 457a7835d317dbd40a3c3467b0006e70
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
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