colors
This commit is contained in:
41
Assets/Scripts/AudioSplitter.cs
Normal file
41
Assets/Scripts/AudioSplitter.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioSplitter : MonoBehaviour
|
||||
{
|
||||
public AudioSource audioSource;
|
||||
public int sampleWindow = 256;
|
||||
|
||||
public float loudness;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
loudness = GetLoudnessFromAudioClip(audioSource, sampleWindow);
|
||||
//Debug.Log("Loudness: " + loudness);
|
||||
}
|
||||
|
||||
public float GetLoudnessFromAudioClip(AudioSource source, int sampleWindow)
|
||||
{
|
||||
if (source.clip == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float[] clipData = new float[sampleWindow];
|
||||
int position = source.timeSamples;
|
||||
source.clip.GetData(clipData, position);
|
||||
|
||||
float sum = 0;
|
||||
for (int i = 0; i < sampleWindow; i++)
|
||||
{
|
||||
sum += clipData[i] * clipData[i];
|
||||
}
|
||||
|
||||
float rmsValue = Mathf.Sqrt(sum / sampleWindow);
|
||||
return rmsValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/Scripts/AudioSplitter.cs.meta
Normal file
11
Assets/Scripts/AudioSplitter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a60b4d798c0ee254494b729b27e4f2e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/AudioSync.cs
Normal file
16
Assets/Scripts/AudioSync.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioSync : MonoBehaviour
|
||||
{
|
||||
//set these in the inspector!
|
||||
public AudioSource master;
|
||||
public AudioSource slave;
|
||||
public float curSample;
|
||||
void Update()
|
||||
{
|
||||
slave.time = Time.time;
|
||||
master.time = Time.time;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/AudioSync.cs.meta
Normal file
11
Assets/Scripts/AudioSync.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cecf6d33a56f90488b3e522a3d56215
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/Scripts/CamFollower.cs
Normal file
24
Assets/Scripts/CamFollower.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CamFollower : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
Vector3 offset;
|
||||
public float speed = 0.1f;
|
||||
private void Awake()
|
||||
{
|
||||
offset = transform.position - target.position;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.position = Vector3.Lerp(transform.position, target.position + offset, speed);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/CamFollower.cs.meta
Normal file
11
Assets/Scripts/CamFollower.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e953abc564320514b82c12176a7e79e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
173
Assets/Scripts/DrawShape.cs
Normal file
173
Assets/Scripts/DrawShape.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DrawShape : MonoBehaviour
|
||||
{
|
||||
// List of Vector3 points that define the shape
|
||||
public List<Vector3> points;
|
||||
public Material material;
|
||||
|
||||
public void Draw(List<Vector3> list, Vector3 offset)
|
||||
{
|
||||
Vector3 startPoint = list[0];
|
||||
Vector3 endPoint = list[list.Count - 1];
|
||||
|
||||
List<Vector3> newPoints = new List<Vector3>();
|
||||
newPoints.Add(startPoint+ offset);
|
||||
newPoints.AddRange(list);
|
||||
newPoints.Add(endPoint+ offset);
|
||||
|
||||
points = newPoints;
|
||||
if (points == null || points.Count < 3)
|
||||
{
|
||||
Debug.LogError("You need at least 3 points to define a shape.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a new GameObject to hold the mesh
|
||||
GameObject shapeObject = new GameObject("Shape");
|
||||
shapeObject.transform.parent = transform;
|
||||
shapeObject.transform.localPosition = Vector3.zero;
|
||||
|
||||
// Add MeshFilter and MeshRenderer components
|
||||
MeshFilter meshFilter = shapeObject.AddComponent<MeshFilter>();
|
||||
MeshRenderer meshRenderer = shapeObject.AddComponent<MeshRenderer>();
|
||||
|
||||
// Create the mesh and assign it to the MeshFilter
|
||||
Mesh mesh = new Mesh();
|
||||
meshFilter.mesh = mesh;
|
||||
|
||||
// Set the vertices from the points list
|
||||
mesh.vertices = points.ToArray();
|
||||
|
||||
// Triangulate the points
|
||||
int[] triangles = Triangulate(points);
|
||||
|
||||
// Set the triangles
|
||||
mesh.triangles = triangles;
|
||||
|
||||
// Recalculate normals and bounds
|
||||
mesh.RecalculateNormals();
|
||||
mesh.RecalculateBounds();
|
||||
|
||||
// Set a basic material
|
||||
meshRenderer.material = material;
|
||||
}
|
||||
|
||||
int[] Triangulate(List<Vector3> vertices)
|
||||
{
|
||||
// Simple ear clipping triangulation algorithm for concave/convex polygons
|
||||
// Note: This is a very basic implementation and may not handle all cases.
|
||||
|
||||
List<int> indices = new List<int>();
|
||||
int n = vertices.Count;
|
||||
|
||||
if (n < 3)
|
||||
return indices.ToArray();
|
||||
|
||||
int[] V = new int[n];
|
||||
if (Area(vertices) > 0)
|
||||
{
|
||||
for (int v = 0; v < n; v++)
|
||||
V[v] = v;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int v = 0; v < n; v++)
|
||||
V[v] = (n - 1) - v;
|
||||
}
|
||||
|
||||
int nv = n;
|
||||
int count = 2 * nv;
|
||||
for (int m = 0, v = nv - 1; nv > 2;)
|
||||
{
|
||||
if ((count--) <= 0)
|
||||
return indices.ToArray();
|
||||
|
||||
int u = v;
|
||||
if (nv <= u)
|
||||
u = 0;
|
||||
v = u + 1;
|
||||
if (nv <= v)
|
||||
v = 0;
|
||||
int w = v + 1;
|
||||
if (nv <= w)
|
||||
w = 0;
|
||||
|
||||
if (Snip(vertices, u, v, w, nv, V))
|
||||
{
|
||||
int a, b, c, s, t;
|
||||
a = V[u];
|
||||
b = V[v];
|
||||
c = V[w];
|
||||
indices.Add(a);
|
||||
indices.Add(b);
|
||||
indices.Add(c);
|
||||
m++;
|
||||
for (s = v, t = v + 1; t < nv; s++, t++)
|
||||
V[s] = V[t];
|
||||
nv--;
|
||||
count = 2 * nv;
|
||||
}
|
||||
}
|
||||
|
||||
return indices.ToArray();
|
||||
}
|
||||
|
||||
float Area(List<Vector3> vertices)
|
||||
{
|
||||
int n = vertices.Count;
|
||||
float A = 0.0f;
|
||||
for (int p = n - 1, q = 0; q < n; p = q++)
|
||||
{
|
||||
Vector3 v0 = vertices[p];
|
||||
Vector3 v1 = vertices[q];
|
||||
A += v0.x * v1.y - v1.x * v0.y;
|
||||
}
|
||||
return A * 0.5f;
|
||||
}
|
||||
|
||||
bool Snip(List<Vector3> vertices, int u, int v, int w, int n, int[] V)
|
||||
{
|
||||
int p;
|
||||
Vector3 A = vertices[V[u]];
|
||||
Vector3 B = vertices[V[v]];
|
||||
Vector3 C = vertices[V[w]];
|
||||
if (Mathf.Epsilon > (((B.x - A.x) * (C.y - A.y)) - ((B.y - A.y) * (C.x - A.x))))
|
||||
return false;
|
||||
for (p = 0; p < n; p++)
|
||||
{
|
||||
if ((p == u) || (p == v) || (p == w))
|
||||
continue;
|
||||
Vector3 P = vertices[V[p]];
|
||||
if (InsideTriangle(A, B, C, P))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InsideTriangle(Vector3 A, Vector3 B, Vector3 C, Vector3 P)
|
||||
{
|
||||
float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy;
|
||||
float cCROSSap, bCROSScp, aCROSSbp;
|
||||
|
||||
ax = C.x - B.x;
|
||||
ay = C.y - B.y;
|
||||
bx = A.x - C.x;
|
||||
by = A.y - C.y;
|
||||
cx = B.x - A.x;
|
||||
cy = B.y - A.y;
|
||||
apx = P.x - A.x;
|
||||
apy = P.y - A.y;
|
||||
bpx = P.x - B.x;
|
||||
bpy = P.y - B.y;
|
||||
cpx = P.x - C.x;
|
||||
cpy = P.y - C.y;
|
||||
|
||||
aCROSSbp = ax * bpy - ay * bpx;
|
||||
cCROSSap = cx * apy - cy * apx;
|
||||
bCROSScp = bx * cpy - by * cpx;
|
||||
|
||||
return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f));
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/DrawShape.cs.meta
Normal file
11
Assets/Scripts/DrawShape.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc070493d8d9053408a63cf9612ea8a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
327
Assets/Scripts/Mover.cs
Normal file
327
Assets/Scripts/Mover.cs
Normal file
@@ -0,0 +1,327 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.U2D;
|
||||
|
||||
public class Mover : MonoBehaviour
|
||||
{
|
||||
public Vector3 movingSpeed;
|
||||
public float loudBoost = 1f;
|
||||
|
||||
public AudioSplitter splitter;
|
||||
|
||||
public GameObject prefab;
|
||||
|
||||
|
||||
float prev_loud = 0;
|
||||
|
||||
public float loudnessThreshold = 0.08f;
|
||||
public float yieldTime = 0.2f;
|
||||
float LastTime;
|
||||
public SpriteShapeController botShape;
|
||||
public SpriteShapeController topShape;
|
||||
public LineRenderer botLineRenderer, topLineRenderer;
|
||||
public DrawShape botDrawer;
|
||||
public DrawShape topDrawer;
|
||||
|
||||
public SpriteRenderer insideFill;
|
||||
public float glowReductionSpeed = 2f;
|
||||
|
||||
|
||||
[SerializeField]
|
||||
public List<RecorderStep> currentSteps = new List<RecorderStep>();
|
||||
[SerializeField]
|
||||
List<RecorderStep> recordedSteps = new List<RecorderStep>();
|
||||
|
||||
public string currentStepsJson = "";
|
||||
public string recordedStepsJson;
|
||||
public bool playReplay = false;
|
||||
|
||||
float defFOV;
|
||||
private void Awake()
|
||||
{
|
||||
defFOV = Camera.main.orthographicSize;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Application.targetFrameRate = 164;
|
||||
if(recordedStepsJson.Length > 1)
|
||||
{
|
||||
recordedSteps = JsonConvert.DeserializeObject<List<RecorderStep>>(recordedStepsJson);
|
||||
GenerateRecordedPlatform();
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 LastPos;
|
||||
|
||||
float movingSpeedMultiplier = 1;
|
||||
|
||||
public bool manualFlip = true;
|
||||
|
||||
public bool manualFlipX = false;
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (insideFill.transform.localScale.x > 0)
|
||||
{
|
||||
insideFill.transform.localScale = Vector3.one * (insideFill.transform.localScale.x - (Time.deltaTime * glowReductionSpeed));
|
||||
}
|
||||
insideFill.color = new Color(1,1,1, insideFill.transform.localScale.y);
|
||||
|
||||
Camera.main.orthographicSize = Mathf.Lerp(Camera.main.orthographicSize, defFOV, 3 * Time.deltaTime);
|
||||
|
||||
if (!manualFlip) { return; }
|
||||
if(Input.GetKeyDown(KeyCode.LeftArrow))
|
||||
{
|
||||
manualFlipX = false;
|
||||
movingSpeed.x = -Mathf.Abs(movingSpeed.x);
|
||||
}else if (Input.GetKeyDown(KeyCode.RightArrow))
|
||||
{
|
||||
manualFlipX = false;
|
||||
movingSpeed.x = Mathf.Abs(movingSpeed.x);
|
||||
}else if (Input.GetKeyDown(KeyCode.UpArrow))
|
||||
{
|
||||
manualFlipX = true;
|
||||
movingSpeed.y = Mathf.Abs(movingSpeed.y);
|
||||
}else if (Input.GetKeyDown(KeyCode.DownArrow))
|
||||
{
|
||||
manualFlipX = true;
|
||||
movingSpeed.y = -Mathf.Abs(movingSpeed.y);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void FixedUpdate()
|
||||
{
|
||||
movingSpeedMultiplier = Mathf.Lerp(movingSpeedMultiplier, 1, Time.deltaTime * 2);
|
||||
|
||||
transform.Translate(movingSpeed*Time.deltaTime * movingSpeedMultiplier);
|
||||
|
||||
if(recordedStepsJson.Length > 1 && playReplay)
|
||||
{
|
||||
PostWork();
|
||||
}
|
||||
else
|
||||
{
|
||||
PreWork();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GenerateRecordedPlatform()
|
||||
{
|
||||
List<Vector3> botPoints = GetBottomPoints();
|
||||
botLineRenderer.positionCount = botPoints.Count;
|
||||
botLineRenderer.SetPositions(botPoints.ToArray());
|
||||
|
||||
List<Vector3> topPoints = GetTopPoints();
|
||||
topLineRenderer.positionCount = topPoints.Count;
|
||||
topLineRenderer.SetPositions(topPoints.ToArray());
|
||||
|
||||
botDrawer.Draw(botPoints, new Vector3(0, 30));
|
||||
topDrawer.Draw(topPoints, new Vector3(0,-30));
|
||||
}
|
||||
|
||||
void FixSpriteShape(SpriteShapeController ssc)
|
||||
{
|
||||
if (ssc.spriteShape != null && ssc.spriteShape.fillTexture != null)
|
||||
{
|
||||
// Bake the mesh after setting up the spline
|
||||
ssc.BakeMesh();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("SpriteShape or fillTexture is missing.");
|
||||
}
|
||||
ssc.BakeMesh();
|
||||
ssc.GetComponent<SpriteShapeRenderer>().enabled = true;
|
||||
}
|
||||
|
||||
|
||||
List<Vector3> bottomPoints = new List<Vector3>();
|
||||
List<Vector3> topPoints = new List<Vector3>();
|
||||
|
||||
public List<Vector3> GetBottomPoints()
|
||||
{
|
||||
List<Vector3> botPoints = new List<Vector3>();
|
||||
for (int i = 0; i < recordedSteps.Count; i++)
|
||||
{
|
||||
Vector3 point = recordedSteps[i].point;
|
||||
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
if (i > 2)
|
||||
{
|
||||
Vector3 prevPoint = recordedSteps[i-2].point;
|
||||
float xMid = prevPoint.x + ((point.x - prevPoint.x) / (2f *xFactorBot));
|
||||
xMid = recordedSteps[i - 1].point.x;
|
||||
float yMid = prevPoint.y + ((point.y - prevPoint.y) / 2f);
|
||||
Vector3 newP1 = new Vector3(xMid, prevPoint.y);
|
||||
Vector3 newP2 = new Vector3(xMid, point.y);
|
||||
botPoints.Add(newP1);
|
||||
botPoints.Add(newP2);
|
||||
}
|
||||
|
||||
botPoints.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
return botPoints;
|
||||
}
|
||||
|
||||
|
||||
public List<Vector3> GetTopPoints()
|
||||
{
|
||||
List<Vector3> botPoints = new List<Vector3>();
|
||||
for (int i = 0; i < recordedSteps.Count; i++)
|
||||
{
|
||||
Vector3 point = recordedSteps[i].point;
|
||||
|
||||
if (i % 2 != 0)
|
||||
{
|
||||
if (i > 2)
|
||||
{
|
||||
Vector3 prevPoint = recordedSteps[i - 2].point;
|
||||
float xMid = prevPoint.x + ((point.x - prevPoint.x) / (2f * xFactorTop));
|
||||
float yMid = prevPoint.y + ((point.y - prevPoint.y) / 2f);
|
||||
xMid = recordedSteps[i - 1].point.x; ;
|
||||
Vector3 newP1 = new Vector3(xMid, prevPoint.y);
|
||||
Vector3 newP2 = new Vector3(xMid, point.y);
|
||||
botPoints.Add(newP1);
|
||||
botPoints.Add(newP2);
|
||||
}
|
||||
|
||||
botPoints.Add(point);
|
||||
}
|
||||
}
|
||||
|
||||
return botPoints;
|
||||
}
|
||||
|
||||
void AddPointToShape(SpriteShapeController shapeController, Vector3 point)
|
||||
{
|
||||
Spline spline = shapeController.spline;
|
||||
spline.InsertPointAt(spline.GetPointCount(), point);
|
||||
spline.SetTangentMode(spline.GetPointCount() - 1, ShapeTangentMode.Continuous);
|
||||
}
|
||||
public float xFactorBot,xFactorTop = 1f;
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (playReplay && !Application.isPlaying)
|
||||
{
|
||||
recordedSteps = JsonConvert.DeserializeObject<List<RecorderStep>>(recordedStepsJson);
|
||||
List<Vector3> botPoints = GetBottomPoints();
|
||||
Gizmos.color = Color.yellow;
|
||||
//Bottom lines
|
||||
for(int i=1; i < botPoints.Count; i++)
|
||||
{
|
||||
Gizmos.DrawLine(botPoints[i - 1], botPoints[i]);
|
||||
}
|
||||
List<Vector3> topPoints = GetTopPoints();
|
||||
//top lines
|
||||
for (int i = 1; i < topPoints.Count; i++)
|
||||
{
|
||||
Gizmos.DrawLine(topPoints[i - 1], topPoints[i]);
|
||||
}
|
||||
Gizmos.color = Color.red;
|
||||
//moving path
|
||||
for(int i =1; i < recordedSteps.Count; i++)
|
||||
{
|
||||
Gizmos.DrawLine(recordedSteps[i-1].point, recordedSteps[i].point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreWork()
|
||||
{
|
||||
float loudness_delta = splitter.loudness - prev_loud;
|
||||
bool notTooShort = (Time.time - LastTime) > yieldTime;
|
||||
bool oldLoudLogic = splitter.loudness > loudnessThreshold && prev_loud < loudnessThreshold;
|
||||
|
||||
if ((loudness_delta > loudnessThreshold && notTooShort) || Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
Debug.Log(LastTime - Time.time);
|
||||
//Instantiate(prefab, transform.position, Quaternion.identity);
|
||||
int random = Random.Range(0, 3);
|
||||
bool flippedX = LastPos.x - transform.position.x > LastPos.y - transform.position.y;
|
||||
if (manualFlip) { flippedX = manualFlipX; }
|
||||
if (flippedX)
|
||||
{
|
||||
movingSpeed.x = -movingSpeed.x;
|
||||
Instantiate(prefab, transform.position + new Vector3(-1 / 5f, 0), Quaternion.Euler(new Vector3(0, 0, 0))).transform.GetComponentInChildren<TextMesh>().text = loudness_delta.ToString("n3");
|
||||
movingSpeedMultiplier += (loudness_delta * loudBoost) / loudnessThreshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
movingSpeed.y = -movingSpeed.y;
|
||||
Instantiate(prefab, transform.position + new Vector3(0, -1 / 5f), Quaternion.Euler(new Vector3(0, 0, 90))).transform.GetComponentInChildren<TextMesh>().text = loudness_delta.ToString("n3"); ;
|
||||
movingSpeedMultiplier += (loudness_delta * loudBoost) / loudnessThreshold;
|
||||
}
|
||||
|
||||
LastTime = Time.time;
|
||||
currentSteps.Add(new RecorderStep(LastTime, movingSpeed, movingSpeedMultiplier, transform.position));
|
||||
currentStepsJson = JsonConvert.SerializeObject(currentSteps);
|
||||
LastPos = transform.position;
|
||||
}
|
||||
prev_loud = splitter.loudness;
|
||||
|
||||
}
|
||||
|
||||
void PostWork()
|
||||
{
|
||||
if(recordedSteps.Count <= 0) { return; }
|
||||
|
||||
if (Time.time >= recordedSteps[0].time)
|
||||
{
|
||||
//Time to act
|
||||
movingSpeed = recordedSteps[0].movingSpeed;
|
||||
movingSpeedMultiplier = recordedSteps[0].movingSpeedMultiplier;
|
||||
musicSourceToSync.time = (float)recordedSteps[0].time;
|
||||
|
||||
recordedSteps.RemoveAt(0);
|
||||
|
||||
HitFX();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public GameObject particleFxPrefab;
|
||||
public AudioSource musicSourceToSync;
|
||||
public float fovChangeOnHit = 0.9f;
|
||||
void HitFX()
|
||||
{
|
||||
StartCoroutine(CoroutineScaleupGlow());
|
||||
Vector3 movingSpeedY = movingSpeed;
|
||||
movingSpeedY.x = 0;
|
||||
Instantiate(particleFxPrefab, transform.position - (movingSpeedY/5f), Quaternion.LookRotation(-movingSpeedY));
|
||||
Camera.main.orthographicSize = defFOV * fovChangeOnHit;
|
||||
}
|
||||
|
||||
IEnumerator CoroutineScaleupGlow()
|
||||
{
|
||||
while(insideFill.transform.localScale.x < 0.6f)
|
||||
{
|
||||
insideFill.transform.localScale = Vector3.one * (insideFill.transform.localScale.x + (Time.deltaTime * glowReductionSpeed * 5));
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class RecorderStep
|
||||
{
|
||||
public double time;
|
||||
public Vector3 movingSpeed;
|
||||
public float movingSpeedMultiplier;
|
||||
public Vector3 point;
|
||||
|
||||
public RecorderStep(double t, Vector3 s, float m, Vector3 p)
|
||||
{
|
||||
time = t; movingSpeed = s; movingSpeedMultiplier = m; point = p;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Mover.cs.meta
Normal file
11
Assets/Scripts/Mover.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 421150d6c4c020d4b850bcef33f1a00f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2158
Assets/Scripts/map1.prefab
Normal file
2158
Assets/Scripts/map1.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scripts/map1.prefab.meta
Normal file
7
Assets/Scripts/map1.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9c9645b6b406c44f815c2c131ad8731
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1818
Assets/Scripts/map2.prefab
Normal file
1818
Assets/Scripts/map2.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scripts/map2.prefab.meta
Normal file
7
Assets/Scripts/map2.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c5017f7a87a2614395bef9463f8be1a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user