修复一些内容
This commit is contained in:
@@ -33,7 +33,11 @@ MonoBehaviour:
|
|||||||
- Assembly-CSharp
|
- Assembly-CSharp
|
||||||
- Assembly-CSharp-firstpass
|
- Assembly-CSharp-firstpass
|
||||||
- Cinemachine
|
- Cinemachine
|
||||||
|
- CW.Common
|
||||||
- EasySave3
|
- EasySave3
|
||||||
|
- LeanCommon
|
||||||
|
- LeanGUI
|
||||||
|
- LeanTransition
|
||||||
showAdvancedSettings: 0
|
showAdvancedSettings: 0
|
||||||
addMgrToSceneAutomatically: 0
|
addMgrToSceneAutomatically: 0
|
||||||
autoUpdateReferences: 1
|
autoUpdateReferences: 1
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 9d11567c06fec024f925fe336d9385a1
|
guid: e45c91269dcbefe429bcfe99acfc7fc8
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
182
Convention/[Runtime]/Audio/SpectrogramRenderer - 副本.xcsx
Normal file
182
Convention/[Runtime]/Audio/SpectrogramRenderer - 副本.xcsx
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
using Unity.Collections;
|
||||||
|
|
||||||
|
namespace Convention
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 频谱图渲染器 - 横轴时间,纵轴频率,颜色深度表示声音强度
|
||||||
|
/// </summary>
|
||||||
|
public class SpectrogramRenderer : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("Audio Source")]
|
||||||
|
public AudioClip audioClip;
|
||||||
|
public int fftSize = 256; // FFT窗口大小,必须是2的幂
|
||||||
|
public int timeResolution = 10; // 时间分辨率,每秒分析多少次
|
||||||
|
|
||||||
|
[Header("Render Texture")]
|
||||||
|
public RenderTexture spectrogramTexture;
|
||||||
|
public RenderTextureFormat textureFormat = RenderTextureFormat.ARGB32;
|
||||||
|
public int textureWidth = 512; // 时间轴分辨率
|
||||||
|
public int textureHeight = 256; // 频率轴分辨率
|
||||||
|
|
||||||
|
[Header("Display Settings")]
|
||||||
|
public float intensityScale = 100f;
|
||||||
|
public Color lowIntensityColor = Color.black;
|
||||||
|
public Color highIntensityColor = Color.red;
|
||||||
|
|
||||||
|
private float[][] spectrogramData;
|
||||||
|
private int currentTimeIndex = 0;
|
||||||
|
private Texture2D bufferTexture;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
InitializeSpectrogramTexture();
|
||||||
|
if (audioClip != null)
|
||||||
|
{
|
||||||
|
StartCoroutine(ProcessAudioClip());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeSpectrogramTexture()
|
||||||
|
{
|
||||||
|
if (spectrogramTexture == null)
|
||||||
|
{
|
||||||
|
spectrogramTexture = new RenderTexture(textureWidth, textureHeight, 0, textureFormat);
|
||||||
|
spectrogramTexture.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferTexture = new Texture2D(textureWidth, textureHeight, TextureFormat.ARGB32, false);
|
||||||
|
|
||||||
|
// 初始化为黑色
|
||||||
|
Color[] pixels = new Color[textureWidth * textureHeight];
|
||||||
|
for (int i = 0; i < pixels.Length; i++)
|
||||||
|
{
|
||||||
|
pixels[i] = Color.black;
|
||||||
|
}
|
||||||
|
bufferTexture.SetPixels(pixels);
|
||||||
|
bufferTexture.Apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator ProcessAudioClip()
|
||||||
|
{
|
||||||
|
if (audioClip == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("AudioClip is null!");
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
float[] samples = new float[audioClip.samples * audioClip.channels];
|
||||||
|
audioClip.GetData(samples, 0);
|
||||||
|
|
||||||
|
int sampleRate = audioClip.frequency;
|
||||||
|
int samplesPerAnalysis = sampleRate / timeResolution;
|
||||||
|
int totalAnalyses = Mathf.CeilToInt((float)samples.Length / samplesPerAnalysis);
|
||||||
|
|
||||||
|
spectrogramData = new float[totalAnalyses][];
|
||||||
|
|
||||||
|
for (int i = 0; i < totalAnalyses; i++)
|
||||||
|
{
|
||||||
|
int startSample = i * samplesPerAnalysis;
|
||||||
|
int endSample = Mathf.Min(startSample + fftSize, samples.Length);
|
||||||
|
|
||||||
|
// 创建FFT窗口数据
|
||||||
|
float[] windowData = new float[fftSize];
|
||||||
|
for (int j = 0; j < fftSize && startSample + j < endSample; j++)
|
||||||
|
{
|
||||||
|
if (startSample + j < samples.Length)
|
||||||
|
{
|
||||||
|
// 应用汉宁窗
|
||||||
|
float windowValue = 0.5f * (1f - Mathf.Cos(2f * Mathf.PI * j / (fftSize - 1)));
|
||||||
|
windowData[j] = samples[startSample + j] * windowValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行FFT
|
||||||
|
spectrogramData[i] = PerformFFT(windowData);
|
||||||
|
|
||||||
|
// 渲染当前频谱到纹理
|
||||||
|
RenderSpectrumToTexture(spectrogramData[i], i);
|
||||||
|
|
||||||
|
// 每处理几帧就让出控制权,避免卡顿
|
||||||
|
if (i % 10 == 0)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 最终更新渲染纹理
|
||||||
|
Graphics.CopyTexture(bufferTexture, spectrogramTexture);
|
||||||
|
Debug.Log("频谱图生成完成!");
|
||||||
|
}
|
||||||
|
|
||||||
|
float[] PerformFFT(float[] timeData)
|
||||||
|
{
|
||||||
|
// 简化的FFT实现 - 实际项目中建议使用更优化的FFT库
|
||||||
|
float[] magnitudes = new float[fftSize / 2];
|
||||||
|
|
||||||
|
for (int k = 0; k < fftSize / 2; k++)
|
||||||
|
{
|
||||||
|
float real = 0f;
|
||||||
|
float imag = 0f;
|
||||||
|
|
||||||
|
for (int n = 0; n < fftSize; n++)
|
||||||
|
{
|
||||||
|
float angle = -2f * Mathf.PI * k * n / fftSize;
|
||||||
|
real += timeData[n] * Mathf.Cos(angle);
|
||||||
|
imag += timeData[n] * Mathf.Sin(angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
magnitudes[k] = Mathf.Sqrt(real * real + imag * imag) / fftSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return magnitudes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderSpectrumToTexture(float[] spectrum, int timeIndex)
|
||||||
|
{
|
||||||
|
if (bufferTexture == null || spectrum == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 计算在纹理中的x坐标
|
||||||
|
int x = Mathf.FloorToInt((float)timeIndex / spectrogramData.Length * textureWidth);
|
||||||
|
x = Mathf.Clamp(x, 0, textureWidth - 1);
|
||||||
|
|
||||||
|
// 渲染频谱数据到纹理的一列
|
||||||
|
for (int y = 0; y < textureHeight; y++)
|
||||||
|
{
|
||||||
|
float frequency = (float)y / textureHeight;
|
||||||
|
int spectrumIndex = Mathf.FloorToInt(frequency * spectrum.Length);
|
||||||
|
spectrumIndex = Mathf.Clamp(spectrumIndex, 0, spectrum.Length - 1);
|
||||||
|
|
||||||
|
float intensity = spectrum[spectrumIndex] * intensityScale;
|
||||||
|
intensity = Mathf.Clamp01(intensity);
|
||||||
|
|
||||||
|
Color pixelColor = Color.Lerp(lowIntensityColor, highIntensityColor, intensity);
|
||||||
|
bufferTexture.SetPixel(x, y, pixelColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateSpectrogram()
|
||||||
|
{
|
||||||
|
if (audioClip == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("请先设置AudioClip!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StopAllCoroutines();
|
||||||
|
StartCoroutine(ProcessAudioClip());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
if (bufferTexture != null)
|
||||||
|
{
|
||||||
|
DestroyImmediate(bufferTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 33758f009a94512469e578396fa2ded4
|
guid: 6d25fa7ac86d50849b05d7ea4eb2c741
|
||||||
PrefabImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
127
Convention/[Runtime]/Audio/SpectrogramRenderer.cs
Normal file
127
Convention/[Runtime]/Audio/SpectrogramRenderer.cs
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
using Unity.Collections;
|
||||||
|
|
||||||
|
namespace Convention
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 频谱图渲染器 - 横轴时间,纵轴频率,颜色深度表示声音强度
|
||||||
|
/// </summary>
|
||||||
|
public class SpectrogramRenderer : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("Audio Source")]
|
||||||
|
public AudioClip clip;
|
||||||
|
public int Step = 100;
|
||||||
|
|
||||||
|
[Header("Render Texture")]
|
||||||
|
public RenderTexture spectrogramTexture;
|
||||||
|
|
||||||
|
[Header("Display Settings")]
|
||||||
|
public Color lowIntensityColor = Color.black;
|
||||||
|
public Color midIntensityColor = Color.red;
|
||||||
|
public Color highIntensityColor = Color.white;
|
||||||
|
public float PowMode = 5f;
|
||||||
|
|
||||||
|
private Texture2D bufferTexture;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
InitializeSpectrogramTexture();
|
||||||
|
if (clip != null)
|
||||||
|
{
|
||||||
|
StartCoroutine(ProcessAudioClip());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeSpectrogramTexture()
|
||||||
|
{
|
||||||
|
bufferTexture = new Texture2D(spectrogramTexture.width, spectrogramTexture.height, TextureFormat.ARGB32, false);
|
||||||
|
|
||||||
|
// 初始化为黑色
|
||||||
|
Color[] pixels = new Color[spectrogramTexture.width * spectrogramTexture.height];
|
||||||
|
for (int i = 0; i < pixels.Length; i++)
|
||||||
|
{
|
||||||
|
pixels[i] = Color.black;
|
||||||
|
}
|
||||||
|
bufferTexture.SetPixels(pixels);
|
||||||
|
bufferTexture.Apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator ProcessAudioClip()
|
||||||
|
{
|
||||||
|
var samplesCount = clip.samples;
|
||||||
|
Debug.Log("ProcessAudioClip Start", this);
|
||||||
|
|
||||||
|
var data = new float[spectrogramTexture.width + 10][];
|
||||||
|
for (int i = 0; i < spectrogramTexture.width + 10; i++)
|
||||||
|
{
|
||||||
|
data[i] = new float[spectrogramTexture.height];
|
||||||
|
for (int j = 0; j < spectrogramTexture.height; j++)
|
||||||
|
data[i][j] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < samplesCount; )
|
||||||
|
{
|
||||||
|
var current = new float[spectrogramTexture.height];
|
||||||
|
int x = Mathf.FloorToInt(i * (spectrogramTexture.width / (float)samplesCount));
|
||||||
|
clip.GetData(current, i);
|
||||||
|
for (int j = 0; j < spectrogramTexture.height; j++)
|
||||||
|
{
|
||||||
|
data[x][j] = Mathf.Max(data[x][j], current[j]);
|
||||||
|
}
|
||||||
|
for (int y = 0; y < spectrogramTexture.height; y++)
|
||||||
|
{
|
||||||
|
var last = bufferTexture.GetPixel(x, y);
|
||||||
|
var t = (data[x][y] + 1f) * 0.5f;
|
||||||
|
Color pixelColor = Color.white;
|
||||||
|
if (t < 0.5f)
|
||||||
|
pixelColor = Color.Lerp(lowIntensityColor, midIntensityColor, Mathf.Log(t*100, PowMode)*0.01f);
|
||||||
|
else
|
||||||
|
pixelColor = Color.Lerp(midIntensityColor, highIntensityColor, Mathf.Log(t*100, PowMode)*0.01f);
|
||||||
|
pixelColor = new(Mathf.Max(last.r, pixelColor.r), Mathf.Max(last.g, pixelColor.g),
|
||||||
|
Mathf.Max(last.b, pixelColor.b), Mathf.Max(last.a, pixelColor.a));
|
||||||
|
bufferTexture.SetPixel(x, y, pixelColor);
|
||||||
|
}
|
||||||
|
if (x % 100 == 0)
|
||||||
|
{
|
||||||
|
bufferTexture.Apply();
|
||||||
|
Debug.Log($"ProcessAudioClip: {i}-{i * 100 / samplesCount}%");
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
i += Step;
|
||||||
|
}
|
||||||
|
//for (int x = 0; x < spectrogramTexture.width; x++)
|
||||||
|
//{
|
||||||
|
// for (int y = 0; y < spectrogramTexture.height; y++)
|
||||||
|
// {
|
||||||
|
// var last = bufferTexture.GetPixel(x, y);
|
||||||
|
// var t = (data[x][y] + 1f) * 0.5f;
|
||||||
|
// Color pixelColor = Color.Lerp(lowIntensityColor, highIntensityColor, Mathf.Pow(t, PowMode));
|
||||||
|
// pixelColor = new(Mathf.Max(last.r, pixelColor.r), Mathf.Max(last.g, pixelColor.g),
|
||||||
|
// Mathf.Max(last.b, pixelColor.b), Mathf.Max(last.a, pixelColor.a));
|
||||||
|
// bufferTexture.SetPixel(x, y, pixelColor);
|
||||||
|
// }
|
||||||
|
// if (x % 100 == 0)
|
||||||
|
// {
|
||||||
|
// Debug.Log($"ProcessAudioClip Render: {x}-{x * 100 / spectrogramTexture.width}%");
|
||||||
|
// yield return null;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
// 最终更新渲染纹理
|
||||||
|
bufferTexture.Apply();
|
||||||
|
Graphics.CopyTexture(bufferTexture, spectrogramTexture);
|
||||||
|
Debug.Log("频谱图生成完成!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
if (bufferTexture != null)
|
||||||
|
{
|
||||||
|
DestroyImmediate(bufferTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Convention/[Runtime]/Audio/SpectrogramRenderer.cs.meta
Normal file
11
Convention/[Runtime]/Audio/SpectrogramRenderer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 81765945edc9f7f4ea0d96345d7bea36
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
429
Convention/[Runtime]/AudioSystem.cs
Normal file
429
Convention/[Runtime]/AudioSystem.cs
Normal file
@@ -0,0 +1,429 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Audio;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
using UnityEngine.Rendering.Universal;
|
||||||
|
using UnityEngine.XR;
|
||||||
|
|
||||||
|
namespace Convention
|
||||||
|
{
|
||||||
|
public abstract class BasicAudioSystem : MonoBehaviour
|
||||||
|
{
|
||||||
|
public abstract void LoadAudioClip(AudioClip clip);
|
||||||
|
public abstract AudioClip GetAudioClip();
|
||||||
|
public abstract float GetClockTime();
|
||||||
|
|
||||||
|
public AudioClip CurrentClip
|
||||||
|
{
|
||||||
|
get => GetAudioClip();
|
||||||
|
set => LoadAudioClip(value);
|
||||||
|
}
|
||||||
|
public float CurrentTime => GetClockTime();
|
||||||
|
|
||||||
|
public abstract bool IsPlaying();
|
||||||
|
|
||||||
|
public abstract void Stop();
|
||||||
|
public abstract void Pause();
|
||||||
|
public abstract void Play();
|
||||||
|
|
||||||
|
public abstract void SetPitch(float pitch);
|
||||||
|
public abstract void SetSpeed(float speed);
|
||||||
|
public abstract void SetVolume(float volume);
|
||||||
|
|
||||||
|
public void PrepareToOtherScene()
|
||||||
|
{
|
||||||
|
StartCoroutine(ClockOnJump());
|
||||||
|
IEnumerator ClockOnJump()
|
||||||
|
{
|
||||||
|
transform.parent = null;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
for (float now = 0; now < 1; now += UnityEngine.Time.deltaTime)
|
||||||
|
{
|
||||||
|
this.SetVolume(1 - now);
|
||||||
|
yield return new WaitForEndOfFrame();
|
||||||
|
}
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnValidate()
|
||||||
|
{
|
||||||
|
if (samples.Length != spectrumLength) samples = new float[spectrumLength];
|
||||||
|
if (bands.Length != BandCount) bands = new float[BandCount];
|
||||||
|
if (freqBands.Length != BandCount) freqBands = new float[BandCount];
|
||||||
|
if (bandBuffers.Length != BandCount) bandBuffers = new float[BandCount];
|
||||||
|
if (bufferDecrease.Length != BandCount) bufferDecrease = new float[BandCount];
|
||||||
|
if (bandHighest.Length != BandCount) bandHighest = new float[BandCount];
|
||||||
|
if (normalizedBands.Length != BandCount) normalizedBands = new float[BandCount];
|
||||||
|
if (normalizedBandBuffers.Length != BandCount) normalizedBandBuffers = new float[BandCount];
|
||||||
|
if (sampleCount.Length != BandCount) sampleCount = new int[BandCount];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Sampling()
|
||||||
|
{
|
||||||
|
if (samples.Length != spectrumLength) samples = new float[spectrumLength];
|
||||||
|
if (bands.Length != BandCount) bands = new float[BandCount];
|
||||||
|
if (freqBands.Length != BandCount) freqBands = new float[BandCount];
|
||||||
|
if (bandBuffers.Length != BandCount) bandBuffers = new float[BandCount];
|
||||||
|
if (bufferDecrease.Length != BandCount) bufferDecrease = new float[BandCount];
|
||||||
|
if (bandHighest.Length != BandCount) bandHighest = new float[BandCount];
|
||||||
|
if (normalizedBands.Length != BandCount) normalizedBands = new float[BandCount];
|
||||||
|
if (normalizedBandBuffers.Length != BandCount) normalizedBandBuffers = new float[BandCount];
|
||||||
|
if (sampleCount.Length != BandCount) sampleCount = new int[BandCount];
|
||||||
|
|
||||||
|
InjectSampling();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void InjectSampling();
|
||||||
|
|
||||||
|
public static AudioType GetAudioType(string path)
|
||||||
|
{
|
||||||
|
return Path.GetExtension(path) switch
|
||||||
|
{
|
||||||
|
"wav" => AudioType.WAV,
|
||||||
|
"mp3" => AudioType.MPEG,
|
||||||
|
"ogg" => AudioType.OGGVORBIS,
|
||||||
|
_ => AudioType.UNKNOWN
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadOnResource(string path)
|
||||||
|
{
|
||||||
|
LoadAudioClip(Resources.Load<AudioClip>(path));
|
||||||
|
}
|
||||||
|
public void LoadOnUrl(string url)
|
||||||
|
{
|
||||||
|
LoadOnUrl(url, GetAudioType(url));
|
||||||
|
}
|
||||||
|
public void LoadOnUrl(string url, AudioType audioType)
|
||||||
|
{
|
||||||
|
StartCoroutine(LoadAudio(url, audioType));
|
||||||
|
}
|
||||||
|
public IEnumerator LoadAudio(string path, AudioType audioType)
|
||||||
|
{
|
||||||
|
UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, audioType);
|
||||||
|
yield return request.SendWebRequest();
|
||||||
|
|
||||||
|
if (request.result == UnityWebRequest.Result.Success)
|
||||||
|
{
|
||||||
|
AudioClip audioClip = DownloadHandlerAudioClip.GetContent(request);
|
||||||
|
CurrentClip = audioClip;
|
||||||
|
}
|
||||||
|
else Debug.LogError(request.result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SpectrumLength
|
||||||
|
{
|
||||||
|
Spectrum64, Spectrum128, Spectrum256, Spectrum512, Spectrum1024, Spectrum2048, Spectrum4096, Spectrum8192
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BufferDecreasingType
|
||||||
|
{
|
||||||
|
Jump, Slide, Falling
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BufferIncreasingType
|
||||||
|
{
|
||||||
|
Jump, Slide
|
||||||
|
}
|
||||||
|
[Header("MusicSampler")]
|
||||||
|
public SpectrumLength SpectrumCount = SpectrumLength.Spectrum256;
|
||||||
|
protected int spectrumLength => (int)Mathf.Pow(2, ((int)SpectrumCount + 6));
|
||||||
|
public float[] samples = new float[64];
|
||||||
|
protected int[] sampleCount = new int[8];
|
||||||
|
public uint BandCount = 8;
|
||||||
|
public BufferDecreasingType decreasingType = BufferDecreasingType.Jump;
|
||||||
|
public float decreasing = 0.003f;
|
||||||
|
public float DecreaseAcceleration = 0.2f;
|
||||||
|
public BufferIncreasingType increasingType = BufferIncreasingType.Jump;
|
||||||
|
public float increasing = 0.003f;
|
||||||
|
public float[] bands = new float[8];
|
||||||
|
protected float[] freqBands = new float[8];
|
||||||
|
protected float[] bandBuffers = new float[8];
|
||||||
|
protected float[] bufferDecrease = new float[8];
|
||||||
|
public float average
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float average = 0;
|
||||||
|
for (int i = 0; i < BandCount; i++)
|
||||||
|
{
|
||||||
|
average += normalizedBands[i];
|
||||||
|
}
|
||||||
|
average /= BandCount;
|
||||||
|
return average;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float[] bandHighest = new float[8];
|
||||||
|
public float[] normalizedBands = new float[8];
|
||||||
|
protected float[] normalizedBandBuffers = new float[8];
|
||||||
|
|
||||||
|
protected void GetSampleCount()
|
||||||
|
{
|
||||||
|
float acc = (((float)((int)SpectrumCount + 6)) / BandCount);
|
||||||
|
int sum = 0;
|
||||||
|
int last = 0;
|
||||||
|
for (int i = 0; i < BandCount - 1; i++)
|
||||||
|
{
|
||||||
|
int pow = (int)Mathf.Pow(2, acc * (i));
|
||||||
|
sampleCount[i] = pow - sum;
|
||||||
|
if (sampleCount[i] < last) sampleCount[i] = last;
|
||||||
|
sum += sampleCount[i];
|
||||||
|
last = sampleCount[i];
|
||||||
|
}
|
||||||
|
sampleCount[BandCount - 1] = samples.Length - sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AudioSystem : BasicAudioSystem
|
||||||
|
{
|
||||||
|
[SerializeField] private AudioSource source;
|
||||||
|
|
||||||
|
public AudioSource Source
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (source == null)
|
||||||
|
source = this.SeekComponent<AudioSource>();
|
||||||
|
if (source == null)
|
||||||
|
source = this.gameObject.AddComponent<AudioSource>();
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
source = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AudioMixer Mixer = null;
|
||||||
|
|
||||||
|
public override AudioClip GetAudioClip()
|
||||||
|
{
|
||||||
|
return Source.clip;
|
||||||
|
}
|
||||||
|
public override float GetClockTime()
|
||||||
|
{
|
||||||
|
return (float)Source.timeSamples / (float)Source.clip.frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsPlaying()
|
||||||
|
{
|
||||||
|
return Source.isPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LoadAudioClip(AudioClip clip)
|
||||||
|
{
|
||||||
|
Source.clip = clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Stop()
|
||||||
|
{
|
||||||
|
Source.Stop();
|
||||||
|
}
|
||||||
|
public override void Pause()
|
||||||
|
{
|
||||||
|
Source.Pause();
|
||||||
|
}
|
||||||
|
public override void Play()
|
||||||
|
{
|
||||||
|
Source.Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetPitch(float pitch)
|
||||||
|
{
|
||||||
|
Source.pitch = pitch;
|
||||||
|
}
|
||||||
|
public override void SetSpeed(float speed)
|
||||||
|
{
|
||||||
|
SetSpeed(speed, 1.0f, "Master", "MasterPitch", "PitchShifterPitch", true);
|
||||||
|
}
|
||||||
|
public override void SetVolume(float volume)
|
||||||
|
{
|
||||||
|
Source.volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSpeed(float speed,
|
||||||
|
float TargetPitchValue,
|
||||||
|
string TargetGroupName,
|
||||||
|
string TargetPitch_Attribute_Name,
|
||||||
|
string TargetPitchshifterPitch_Attribute_Name,
|
||||||
|
bool IsIgnoreWarning = false)
|
||||||
|
{
|
||||||
|
if (Mixer != null)
|
||||||
|
{
|
||||||
|
if (TargetPitchValue > 0)
|
||||||
|
{
|
||||||
|
Source.pitch = 1;
|
||||||
|
Mixer.SetFloat(TargetPitch_Attribute_Name, TargetPitchValue);
|
||||||
|
float TargetPitchshifterPitchValue = 1.0f / TargetPitchValue;
|
||||||
|
Mixer.SetFloat(TargetPitchshifterPitch_Attribute_Name, TargetPitchshifterPitchValue);
|
||||||
|
Source.outputAudioMixerGroup = Mixer.FindMatchingGroups(TargetGroupName)[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Source.pitch = -1;
|
||||||
|
Mixer.SetFloat(TargetPitch_Attribute_Name, -TargetPitchValue);
|
||||||
|
float TargetPitchshifterPitchValue = -1.0f / TargetPitchValue;
|
||||||
|
Mixer.SetFloat(TargetPitchshifterPitch_Attribute_Name, TargetPitchshifterPitchValue);
|
||||||
|
Source.outputAudioMixerGroup = Mixer.FindMatchingGroups(TargetGroupName)[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IsIgnoreWarning == false)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("you try to change an Audio's speed without AudioMixer, which will cause it to change its pitch");
|
||||||
|
SetPitch(speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetSpectrums()
|
||||||
|
{
|
||||||
|
Source.GetSpectrumData(samples, 0, FFTWindow.Blackman);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void GetFrequencyBands()
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
for (int i = 0; i < BandCount; i++)
|
||||||
|
{
|
||||||
|
float average = 0;
|
||||||
|
for (int j = 0; j < sampleCount[i]; j++)
|
||||||
|
{
|
||||||
|
average += samples[counter] * (counter + 1);
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
average /= sampleCount[i];
|
||||||
|
freqBands[i] = average * 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetNormalizedBands()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < BandCount; i++)
|
||||||
|
{
|
||||||
|
if (freqBands[i] > bandHighest[i])
|
||||||
|
{
|
||||||
|
bandHighest[i] = freqBands[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetBandBuffers(BufferIncreasingType increasingType, BufferDecreasingType decreasingType)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < BandCount; i++)
|
||||||
|
{
|
||||||
|
if (freqBands[i] > bandBuffers[i])
|
||||||
|
{
|
||||||
|
switch (increasingType)
|
||||||
|
{
|
||||||
|
case BufferIncreasingType.Jump:
|
||||||
|
bandBuffers[i] = freqBands[i];
|
||||||
|
bufferDecrease[i] = decreasing;
|
||||||
|
break;
|
||||||
|
case BufferIncreasingType.Slide:
|
||||||
|
bufferDecrease[i] = decreasing;
|
||||||
|
bandBuffers[i] += increasing;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (freqBands[i] < bandBuffers[i]) bandBuffers[i] = freqBands[i];
|
||||||
|
}
|
||||||
|
if (freqBands[i] < bandBuffers[i])
|
||||||
|
{
|
||||||
|
switch (decreasingType)
|
||||||
|
{
|
||||||
|
case BufferDecreasingType.Jump:
|
||||||
|
bandBuffers[i] = freqBands[i];
|
||||||
|
break;
|
||||||
|
case BufferDecreasingType.Falling:
|
||||||
|
bandBuffers[i] -= decreasing;
|
||||||
|
break;
|
||||||
|
case BufferDecreasingType.Slide:
|
||||||
|
bandBuffers[i] -= bufferDecrease[i];
|
||||||
|
bufferDecrease[i] *= 1 + DecreaseAcceleration;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (freqBands[i] > bandBuffers[i]) bandBuffers[i] = freqBands[i]; ;
|
||||||
|
}
|
||||||
|
bands[i] = bandBuffers[i];
|
||||||
|
if (bandHighest[i] == 0) continue;
|
||||||
|
normalizedBands[i] = (freqBands[i] / bandHighest[i]);
|
||||||
|
normalizedBandBuffers[i] = (bandBuffers[i] / bandHighest[i]);
|
||||||
|
if (normalizedBands[i] > normalizedBandBuffers[i])
|
||||||
|
{
|
||||||
|
switch (increasingType)
|
||||||
|
{
|
||||||
|
case BufferIncreasingType.Jump:
|
||||||
|
normalizedBandBuffers[i] = normalizedBands[i];
|
||||||
|
bufferDecrease[i] = decreasing;
|
||||||
|
break;
|
||||||
|
case BufferIncreasingType.Slide:
|
||||||
|
bufferDecrease[i] = decreasing;
|
||||||
|
normalizedBandBuffers[i] += increasing;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (normalizedBands[i] < normalizedBandBuffers[i]) normalizedBandBuffers[i] = normalizedBands[i];
|
||||||
|
}
|
||||||
|
if (normalizedBands[i] < normalizedBandBuffers[i])
|
||||||
|
{
|
||||||
|
switch (decreasingType)
|
||||||
|
{
|
||||||
|
case BufferDecreasingType.Jump:
|
||||||
|
normalizedBandBuffers[i] = normalizedBands[i];
|
||||||
|
break;
|
||||||
|
case BufferDecreasingType.Falling:
|
||||||
|
normalizedBandBuffers[i] -= decreasing;
|
||||||
|
break;
|
||||||
|
case BufferDecreasingType.Slide:
|
||||||
|
normalizedBandBuffers[i] -= bufferDecrease[i];
|
||||||
|
bufferDecrease[i] *= 1 + DecreaseAcceleration;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (normalizedBands[i] > normalizedBandBuffers[i]) normalizedBandBuffers[i] = normalizedBands[i];
|
||||||
|
}
|
||||||
|
normalizedBands[i] = normalizedBandBuffers[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BandNegativeCheck()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < BandCount; i++)
|
||||||
|
{
|
||||||
|
if (bands[i] < 0)
|
||||||
|
{
|
||||||
|
bands[i] = 0;
|
||||||
|
}
|
||||||
|
if (normalizedBands[i] < 0)
|
||||||
|
{
|
||||||
|
normalizedBands[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InjectSampling()
|
||||||
|
{
|
||||||
|
GetSpectrums();
|
||||||
|
GetFrequencyBands();
|
||||||
|
GetNormalizedBands();
|
||||||
|
GetBandBuffers(increasingType, decreasingType);
|
||||||
|
BandNegativeCheck();
|
||||||
|
|
||||||
|
}
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
float[] spectrum = new float[256];
|
||||||
|
AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular);
|
||||||
|
for (int i = 1; i < spectrum.Length - 1; i++)
|
||||||
|
{
|
||||||
|
Debug.DrawLine(new Vector3(i - 1, spectrum[i] + 10, 0), new Vector3(i, spectrum[i + 1] + 10, 0), Color.red);
|
||||||
|
Debug.DrawLine(new Vector3(i - 1, Mathf.Log(spectrum[i - 1]) + 10, 2), new Vector3(i, Mathf.Log(spectrum[i]) + 10, 2), Color.cyan);
|
||||||
|
Debug.DrawLine(new Vector3(Mathf.Log(i - 1), spectrum[i - 1] - 10, 1), new Vector3(Mathf.Log(i), spectrum[i] - 10, 1), Color.green);
|
||||||
|
Debug.DrawLine(new Vector3(Mathf.Log(i - 1), Mathf.Log(spectrum[i - 1]), 3), new Vector3(Mathf.Log(i), Mathf.Log(spectrum[i]), 3), Color.blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Convention/[Runtime]/AudioSystem.cs.meta
Normal file
11
Convention/[Runtime]/AudioSystem.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 92ba7bb6320d6934e82e24c449692e71
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -1,6 +1,7 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 657c1352c4888554a911c696f6366650
|
guid: c7e7a21c7741808448212d47963918a1
|
||||||
PrefabImporter:
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
386
Convention/[Visual]/CurveMeshBuilder/CurveMeshBuilder.cs
Normal file
386
Convention/[Visual]/CurveMeshBuilder/CurveMeshBuilder.cs
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dynamic build curve mesh by given key points
|
||||||
|
/// Curve type is Catmul-Rom
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
|
||||||
|
public class CurveMeshBuilder : MonoBehaviour
|
||||||
|
{
|
||||||
|
public struct CurveSegment2D
|
||||||
|
{
|
||||||
|
public Vector2 point1;
|
||||||
|
public Vector2 point2;
|
||||||
|
|
||||||
|
public CurveSegment2D(Vector2 point1, Vector2 point2)
|
||||||
|
{
|
||||||
|
this.point1 = point1;
|
||||||
|
this.point2 = point2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2 SegmentVector
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return point2 - point1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//[HideInInspector]
|
||||||
|
public List<Vector2> nodeList = new List<Vector2>();
|
||||||
|
|
||||||
|
public bool drawGizmos = true;
|
||||||
|
public int smooth = 5;
|
||||||
|
public float width = 0.2f;
|
||||||
|
public float uvTiling = 1f;
|
||||||
|
|
||||||
|
private Mesh _mesh;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public float gizmosNodeBallSize = 0.1f;
|
||||||
|
[System.NonSerialized]
|
||||||
|
public int selectedNodeIndex = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
BuildMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
if (_mesh == null)
|
||||||
|
{
|
||||||
|
_mesh = new Mesh();
|
||||||
|
_mesh.name = "CurveMesh";
|
||||||
|
GetComponent<MeshFilter>().mesh = _mesh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
//Draw the spline in the scene view
|
||||||
|
void OnDrawGizmos()
|
||||||
|
{
|
||||||
|
if (!drawGizmos)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vector3 prevPosition = Vector3.zero;
|
||||||
|
for (int i = 0; i < nodeList.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
prevPosition = transform.TransformPoint(nodeList[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector3 curPosition = transform.TransformPoint(nodeList[i]);
|
||||||
|
Gizmos.DrawLine(prevPosition, curPosition);
|
||||||
|
prevPosition = curPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == selectedNodeIndex)
|
||||||
|
{
|
||||||
|
Color c = Gizmos.color;
|
||||||
|
Gizmos.color = Color.yellow;
|
||||||
|
Gizmos.DrawSphere(prevPosition, gizmosNodeBallSize * UnityEditor.HandleUtility.GetHandleSize(prevPosition) * 1.5f);
|
||||||
|
Gizmos.color = c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Gizmos.DrawSphere(prevPosition, gizmosNodeBallSize * UnityEditor.HandleUtility.GetHandleSize(prevPosition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#region Node Operate
|
||||||
|
public void AddNode(Vector2 position)
|
||||||
|
{
|
||||||
|
nodeList.Add(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InsertNode(int index, Vector2 position)
|
||||||
|
{
|
||||||
|
index = Mathf.Max(index, 0);
|
||||||
|
if (index >= nodeList.Count)
|
||||||
|
{
|
||||||
|
AddNode(position);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nodeList.Insert(index, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveNode(int index)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= nodeList.Count)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodeList.RemoveAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearNodes()
|
||||||
|
{
|
||||||
|
nodeList.Clear();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public bool BuildMesh()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
_mesh.Clear();
|
||||||
|
if (nodeList.Count < 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<Vector2> curvePoints = CalculateCurve(nodeList, smooth, false);
|
||||||
|
List<Vector2> vertices = GetVertices(curvePoints, width * 0.5f);
|
||||||
|
List<Vector2> verticesUV = GetVerticesUV(curvePoints);
|
||||||
|
|
||||||
|
Vector3[] _vertices = new Vector3[vertices.Count];
|
||||||
|
Vector2[] _uv = new Vector2[verticesUV.Count];
|
||||||
|
int[] _triangles = new int[(vertices.Count - 2) * 3];
|
||||||
|
for (int i = 0; i < vertices.Count; i++)
|
||||||
|
{
|
||||||
|
_vertices[i].Set(vertices[i].x, vertices[i].y, 0);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < verticesUV.Count; i++)
|
||||||
|
{
|
||||||
|
_uv[i].Set(verticesUV[i].x, verticesUV[i].y);
|
||||||
|
}
|
||||||
|
for (int i = 2; i < vertices.Count; i += 2)
|
||||||
|
{
|
||||||
|
int index = (i - 2) * 3;
|
||||||
|
_triangles[index] = i - 2;
|
||||||
|
_triangles[index + 1] = i - 0;
|
||||||
|
_triangles[index + 2] = i - 1;
|
||||||
|
_triangles[index + 3] = i - 1;
|
||||||
|
_triangles[index + 4] = i - 0;
|
||||||
|
_triangles[index + 5] = i + 1;
|
||||||
|
}
|
||||||
|
_mesh.vertices = _vertices;
|
||||||
|
_mesh.triangles = _triangles;
|
||||||
|
_mesh.uv = _uv;
|
||||||
|
_mesh.RecalculateNormals();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnValidate()
|
||||||
|
{
|
||||||
|
BuildMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate Catmul-Rom Curve
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="points">key points</param>
|
||||||
|
/// <param name="smooth">how many segments between two nearby point</param>
|
||||||
|
/// <param name="curveClose">whether curve is a circle</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<Vector2> CalculateCurve(IList<Vector2> points, int smooth, bool curveClose)
|
||||||
|
{
|
||||||
|
int pointCount = points.Count;
|
||||||
|
int segmentCount = curveClose ? pointCount : pointCount - 1;
|
||||||
|
|
||||||
|
List<Vector2> allVertices = new List<Vector2>((smooth + 1) * segmentCount);
|
||||||
|
Vector2[] tempVertices = new Vector2[smooth + 1];
|
||||||
|
float smoothReciprocal = 1f / smooth;
|
||||||
|
|
||||||
|
for (int i = 0; i < segmentCount; ++i)
|
||||||
|
{
|
||||||
|
// get 4 adjacent point in points to calculate position between p1 and p2
|
||||||
|
Vector2 p0, p1, p2, p3;
|
||||||
|
p1 = points[i];
|
||||||
|
|
||||||
|
if (curveClose)
|
||||||
|
{
|
||||||
|
p0 = i == 0 ? points[segmentCount - 1] : points[i - 1];
|
||||||
|
p2 = i + 1 < pointCount ? points[i + 1] : points[i + 1 - pointCount];
|
||||||
|
p3 = i + 2 < pointCount ? points[i + 2] : points[i + 2 - pointCount];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p0 = i == 0 ? p1 : points[i - 1];
|
||||||
|
p2 = points[i + 1];
|
||||||
|
p3 = i == segmentCount - 1 ? p2 : points[i + 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 pA = p1;
|
||||||
|
Vector2 pB = 0.5f * (-p0 + p2);
|
||||||
|
Vector2 pC = p0 - 2.5f * p1 + 2f * p2 - 0.5f * p3;
|
||||||
|
Vector2 pD = 0.5f * (-p0 + 3f * p1 - 3f * p2 + p3);
|
||||||
|
|
||||||
|
float t = 0;
|
||||||
|
for (int j = 0; j <= smooth; j++)
|
||||||
|
{
|
||||||
|
tempVertices[j] = pA + t * (pB + t * (pC + t * pD));
|
||||||
|
t += smoothReciprocal;
|
||||||
|
}
|
||||||
|
for (int j = allVertices.Count == 0 ? 0 : 1; j < tempVertices.Length; j++)
|
||||||
|
{
|
||||||
|
allVertices.Add(tempVertices[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allVertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<CurveSegment2D> GetSegments(List<Vector2> points)
|
||||||
|
{
|
||||||
|
List<CurveSegment2D> segments = new List<CurveSegment2D>(points.Count - 1);
|
||||||
|
for (int i = 1; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
segments.Add(new CurveSegment2D(points[i - 1], points[i]));
|
||||||
|
}
|
||||||
|
return segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vector2> GetVertices(List<Vector2> points, float expands)
|
||||||
|
{
|
||||||
|
List<CurveSegment2D> segments = GetSegments(points);
|
||||||
|
|
||||||
|
List<CurveSegment2D> segments1 = new List<CurveSegment2D>(segments.Count);
|
||||||
|
List<CurveSegment2D> segments2 = new List<CurveSegment2D>(segments.Count);
|
||||||
|
|
||||||
|
for (int i = 0; i < segments.Count; i++)
|
||||||
|
{
|
||||||
|
Vector2 vOffset = new Vector2(-segments[i].SegmentVector.y, segments[i].SegmentVector.x).normalized;
|
||||||
|
segments1.Add(new CurveSegment2D(segments[i].point1 + vOffset * expands, segments[i].point2 + vOffset * expands));
|
||||||
|
segments2.Add(new CurveSegment2D(segments[i].point1 - vOffset * expands, segments[i].point2 - vOffset * expands));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Vector2> points1 = new List<Vector2>(points.Count);
|
||||||
|
List<Vector2> points2 = new List<Vector2>(points.Count);
|
||||||
|
|
||||||
|
for (int i = 0; i < segments1.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
points1.Add(segments1[0].point1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector2 crossPoint;
|
||||||
|
if (!TryCalculateLinesIntersection(segments1[i - 1], segments1[i], out crossPoint, 0.1f))
|
||||||
|
{
|
||||||
|
crossPoint = segments1[i].point1;
|
||||||
|
}
|
||||||
|
points1.Add(crossPoint);
|
||||||
|
}
|
||||||
|
if (i == segments1.Count - 1)
|
||||||
|
{
|
||||||
|
points1.Add(segments1[i].point2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < segments2.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
points2.Add(segments2[0].point1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector2 crossPoint;
|
||||||
|
if (!TryCalculateLinesIntersection(segments2[i - 1], segments2[i], out crossPoint, 0.1f))
|
||||||
|
{
|
||||||
|
crossPoint = segments2[i].point1;
|
||||||
|
}
|
||||||
|
points2.Add(crossPoint);
|
||||||
|
}
|
||||||
|
if (i == segments2.Count - 1)
|
||||||
|
{
|
||||||
|
points2.Add(segments2[i].point2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Vector2> combinePoints = new List<Vector2>(points.Count * 2);
|
||||||
|
for (int i = 0; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
combinePoints.Add(points1[i]);
|
||||||
|
combinePoints.Add(points2[i]);
|
||||||
|
}
|
||||||
|
return combinePoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vector2> GetVerticesUV(List<Vector2> points)
|
||||||
|
{
|
||||||
|
List<Vector2> uvs = new List<Vector2>(points.Count * 2);
|
||||||
|
float totalLength = 0;
|
||||||
|
float totalLengthReciprocal = 0;
|
||||||
|
float curLength = 0;
|
||||||
|
for (int i = 1; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
totalLength += Vector2.Distance(points[i - 1], points[i]);
|
||||||
|
}
|
||||||
|
totalLengthReciprocal = uvTiling / totalLength;
|
||||||
|
for (int i = 0; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
uvs.Add(new Vector2(0, 1));
|
||||||
|
uvs.Add(new Vector2(0, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (i == points.Count - 1)
|
||||||
|
{
|
||||||
|
uvs.Add(new Vector2(uvTiling, 1));
|
||||||
|
uvs.Add(new Vector2(uvTiling, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curLength += Vector2.Distance(points[i - 1], points[i]);
|
||||||
|
float uvx = curLength * totalLengthReciprocal;
|
||||||
|
|
||||||
|
uvs.Add(new Vector2(uvx, 1));
|
||||||
|
uvs.Add(new Vector2(uvx, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return uvs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryCalculateLinesIntersection(CurveSegment2D segment1, CurveSegment2D segment2, out Vector2 intersection, float angleLimit)
|
||||||
|
{
|
||||||
|
intersection = new Vector2();
|
||||||
|
|
||||||
|
Vector2 p1 = segment1.point1;
|
||||||
|
Vector2 p2 = segment1.point2;
|
||||||
|
Vector2 p3 = segment2.point1;
|
||||||
|
Vector2 p4 = segment2.point2;
|
||||||
|
|
||||||
|
float denominator = (p2.y - p1.y) * (p4.x - p3.x) - (p1.x - p2.x) * (p3.y - p4.y);
|
||||||
|
// If denominator is 0, means parallel
|
||||||
|
if (denominator == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check angle between segments
|
||||||
|
float angle = Vector2.Angle(segment1.SegmentVector, segment2.SegmentVector);
|
||||||
|
// if the angle between two segments is too small, we treat them as parallel
|
||||||
|
if (angle < angleLimit || (180f - angle) < angleLimit)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float x = ((p2.x - p1.x) * (p4.x - p3.x) * (p3.y - p1.y)
|
||||||
|
+ (p2.y - p1.y) * (p4.x - p3.x) * p1.x
|
||||||
|
- (p4.y - p3.y) * (p2.x - p1.x) * p3.x) / denominator;
|
||||||
|
float y = -((p2.y - p1.y) * (p4.y - p3.y) * (p3.x - p1.x)
|
||||||
|
+ (p2.x - p1.x) * (p4.y - p3.y) * p1.y
|
||||||
|
- (p4.x - p3.x) * (p2.y - p1.y) * p3.y) / denominator;
|
||||||
|
|
||||||
|
intersection.Set(x, y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e25668119d28b7144b077a2e5dc1176a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -1,189 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!1 &1194520623583548762
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 8132712973314222637}
|
|
||||||
- component: {fileID: 2682277743158303610}
|
|
||||||
- component: {fileID: 3402880044481262717}
|
|
||||||
- component: {fileID: 8920008805867454334}
|
|
||||||
- component: {fileID: 6506369038458274189}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Benchmark_Prefab
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &8132712973314222637
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1194520623583548762}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children:
|
|
||||||
- {fileID: 3033895151238867298}
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &2682277743158303610
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1194520623583548762}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_PanelSettings: {fileID: 11400000, guid: ba33de63d1649ba42b55b8beea949f5a, type: 2}
|
|
||||||
m_ParentUI: {fileID: 0}
|
|
||||||
sourceAsset: {fileID: 9197481963319205126, guid: e7dea75f7919436408a29190292ad5c5, type: 3}
|
|
||||||
m_SortingOrder: 0
|
|
||||||
--- !u!114 &3402880044481262717
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1194520623583548762}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_FirstSelected: {fileID: 0}
|
|
||||||
m_sendNavigationEvents: 1
|
|
||||||
m_DragThreshold: 10
|
|
||||||
--- !u!114 &8920008805867454334
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1194520623583548762}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_SendPointerHoverToParent: 1
|
|
||||||
m_MoveRepeatDelay: 0.5
|
|
||||||
m_MoveRepeatRate: 0.1
|
|
||||||
m_XRTrackingOrigin: {fileID: 0}
|
|
||||||
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_PointAction: {fileID: 1054132383583890850, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_MoveAction: {fileID: 3710738434707379630, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_SubmitAction: {fileID: 2064916234097673511, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_CancelAction: {fileID: -1967631576421560919, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_LeftClickAction: {fileID: 8056856818456041789, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_MiddleClickAction: {fileID: 3279352641294131588, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_RightClickAction: {fileID: 3837173908680883260, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_ScrollWheelAction: {fileID: 4502412055082496612, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_TrackedDevicePositionAction: {fileID: 4754684134866288074, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_TrackedDeviceOrientationAction: {fileID: 1025543830046995696, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
|
||||||
m_DeselectOnBackgroundClick: 1
|
|
||||||
m_PointerBehavior: 0
|
|
||||||
m_CursorLockBehavior: 0
|
|
||||||
m_ScrollDeltaPerTick: 6
|
|
||||||
--- !u!114 &6506369038458274189
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1194520623583548762}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: e3a26a4bb71ca7646b87c6f72d82f1e0, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
StageScenes:
|
|
||||||
- enabled: 1
|
|
||||||
sceneName: TerminalScene
|
|
||||||
cameraPosition: {x: 0, y: 0, z: 0}
|
|
||||||
cameraRotation: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
useFullTimeline: 1
|
|
||||||
- enabled: 1
|
|
||||||
sceneName: GardenScene
|
|
||||||
cameraPosition: {x: 0, y: 0, z: 0}
|
|
||||||
cameraRotation: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
useFullTimeline: 1
|
|
||||||
- enabled: 1
|
|
||||||
sceneName: OasisScene
|
|
||||||
cameraPosition: {x: 0, y: 0, z: 0}
|
|
||||||
cameraRotation: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
useFullTimeline: 1
|
|
||||||
- enabled: 1
|
|
||||||
sceneName: CockpitScene
|
|
||||||
cameraPosition: {x: 0, y: 0, z: 0}
|
|
||||||
cameraRotation: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
useFullTimeline: 1
|
|
||||||
WaitTime: 5
|
|
||||||
FramesToCapture: 500
|
|
||||||
_testDataVisualTreeReference: {fileID: 9197481963319205126, guid: 32701d82a368f1644aed274f6e67367b, type: 3}
|
|
||||||
currentTimingRefreshCount: 10
|
|
||||||
CurrentTimingRefreshCounter: 11
|
|
||||||
liveRefreshGraph: 0
|
|
||||||
CameraPrefab: {fileID: 1184572588443782738, guid: f576361f019670b4a86271169e51522a, type: 3}
|
|
||||||
_eventSystem: {fileID: 3402880044481262717}
|
|
||||||
--- !u!1 &2347660263666688036
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 3033895151238867298}
|
|
||||||
- component: {fileID: 6038028693833600838}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: GameObject
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 0
|
|
||||||
--- !u!4 &3033895151238867298
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2347660263666688036}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 8132712973314222637}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &6038028693833600838
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 2347660263666688036}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_PanelSettings: {fileID: 11400000, guid: 7923546beae955540a6279f11eb5c41b, type: 2}
|
|
||||||
m_ParentUI: {fileID: 2682277743158303610}
|
|
||||||
sourceAsset: {fileID: 9197481963319205126, guid: 55b23197e3bc1df4c84c22c909c70d26, type: 3}
|
|
||||||
m_SortingOrder: 0
|
|
File diff suppressed because it is too large
Load Diff
@@ -9,13 +9,17 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 0}
|
m_GameObject: {fileID: 0}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: ccb2112c81751444e8570e0d4f319070, type: 3}
|
m_Script: {fileID: 11500000, guid: 234eb658dcbbff94aaa51624bd64af0b, type: 3}
|
||||||
m_Name: TextureRenderingConfig
|
m_Name: TextureRenderingConfig
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Datas:
|
uobjects:
|
||||||
Data:
|
m_Keys: []
|
||||||
- Key: RenderTextureScale
|
m_Values: []
|
||||||
Value:
|
symbols:
|
||||||
CurrentValue: 1
|
m_Keys: []
|
||||||
CurrentObject: {fileID: 0}
|
m_Values: []
|
||||||
RealType: Single
|
values:
|
||||||
|
m_Keys:
|
||||||
|
- RenderTextureScale
|
||||||
|
m_Values:
|
||||||
|
- 1
|
||||||
|
@@ -9,22 +9,12 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 0}
|
m_GameObject: {fileID: 0}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: c84cf04bd69b6c640a560080def4549b, type: 3}
|
m_Script: {fileID: 11500000, guid: 86ad14e0f9fcf5e4c97545f4c6ffc1b1, type: 3}
|
||||||
m_Name: NodePrefabs
|
m_Name: NodePrefabs
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
uobjects:
|
uobjects:
|
||||||
m_Keys:
|
m_Keys: []
|
||||||
- ResourceNode
|
m_Values: []
|
||||||
- TextNode
|
|
||||||
- ValueNode
|
|
||||||
- StepNode
|
|
||||||
- EndNode
|
|
||||||
m_Values:
|
|
||||||
- {fileID: 1131170017039480627, guid: 678fa72e5ebe5c74e8d4de1fece04c3e, type: 3}
|
|
||||||
- {fileID: 5643479676596018674, guid: b9430ac712415504f8e090ca01cfa5e9, type: 3}
|
|
||||||
- {fileID: 2495722784719720390, guid: 3903bd8b562bcb547acc3bdcc7d96b0f, type: 3}
|
|
||||||
- {fileID: 7399632051589070183, guid: 4bdcb6a81d37aa14db41e036f4d87a2a, type: 3}
|
|
||||||
- {fileID: 7767195200921155885, guid: 342367736a396c348b524e4f4ca082f0, type: 3}
|
|
||||||
symbols:
|
symbols:
|
||||||
m_Keys: []
|
m_Keys: []
|
||||||
m_Values: []
|
m_Values: []
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 84ae530a0aa9bb546aa239af0c361401
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3add4e75f485dfe4da39ee5334017e8f
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cf7376bfb3f88e645bdea9614f36f723
|
|
||||||
PrefabImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -9,58 +9,15 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 0}
|
m_GameObject: {fileID: 0}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: c84cf04bd69b6c640a560080def4549b, type: 3}
|
m_Script: {fileID: 11500000, guid: 86ad14e0f9fcf5e4c97545f4c6ffc1b1, type: 3}
|
||||||
m_Name: Transformer
|
m_Name: Transformer
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Datas:
|
uobjects:
|
||||||
Data:
|
m_Keys: []
|
||||||
- Key: TextNode
|
m_Values: []
|
||||||
Value:
|
symbols:
|
||||||
CurrentValue: "\u6587\u672C\u8282\u70B9"
|
m_Keys: []
|
||||||
CurrentObject: {fileID: 0}
|
m_Values: []
|
||||||
RealType: String
|
values:
|
||||||
- Key: ValueNode
|
m_Keys: []
|
||||||
Value:
|
m_Values: []
|
||||||
CurrentValue: "\u6570\u503C\u8282\u70B9"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: ResourceNode
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u8D44\u6E90\u8282\u70B9"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: StepNode
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u64CD\u4F5C\u8282\u70B9"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: EndNode
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u7ED3\u675F\u8282\u70B9"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: Text
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u6587\u672C"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: value
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u503C"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: SlotName
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u69FD\u7684\u540D\u79F0"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: Delete
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u5220\u9664"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
- Key: Create New Slot
|
|
||||||
Value:
|
|
||||||
CurrentValue: "\u521B\u5EFA\u65B0\u7684\u69FD"
|
|
||||||
CurrentObject: {fileID: 0}
|
|
||||||
RealType: String
|
|
||||||
|
@@ -1309,7 +1309,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 32531427016416541}
|
- component: {fileID: 32531427016416541}
|
||||||
- component: {fileID: 7551288850924406523}
|
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: VFX
|
m_Name: VFX
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -1336,77 +1335,6 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 100, y: 100}
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &7551288850924406523
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3705958412594858625}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: a5a3db8f679e3ee40b424f8a997797ed, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_passName: Fullscreen Pass
|
|
||||||
_material: {fileID: 0}
|
|
||||||
_injectionPoint: 450
|
|
||||||
_injectionPointOffset: 0
|
|
||||||
_inputRequirements: 0
|
|
||||||
_cameraType: 3
|
|
||||||
IgnoreCameraTag: []
|
|
||||||
TransitionAmount_Float: _TransitionAmount
|
|
||||||
DissolveZoomInCurve:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Curve:
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 0
|
|
||||||
value: 0
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0
|
|
||||||
outWeight: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 1
|
|
||||||
value: 1
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0
|
|
||||||
outWeight: 0
|
|
||||||
m_PreInfinity: 2
|
|
||||||
m_PostInfinity: 2
|
|
||||||
m_RotationOrder: 4
|
|
||||||
DissolveZoomOutCurve:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Curve:
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 0
|
|
||||||
value: 0
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0
|
|
||||||
outWeight: 0
|
|
||||||
- serializedVersion: 3
|
|
||||||
time: 1
|
|
||||||
value: 1
|
|
||||||
inSlope: 0
|
|
||||||
outSlope: 0
|
|
||||||
tangentMode: 0
|
|
||||||
weightedMode: 0
|
|
||||||
inWeight: 0
|
|
||||||
outWeight: 0
|
|
||||||
m_PreInfinity: 2
|
|
||||||
m_PostInfinity: 2
|
|
||||||
m_RotationOrder: 4
|
|
||||||
ZommInDuration: 0.5
|
|
||||||
ZommOutDuration: 0.5
|
|
||||||
StayDuration: 0.5
|
|
||||||
--- !u!1 &3962607723904284606
|
--- !u!1 &3962607723904284606
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -2063,19 +1991,19 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 5270120234092917765}
|
m_GameObject: {fileID: 5270120234092917765}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 49e2d4cf41bb80444b49aaedbadf0f2f, type: 3}
|
m_Script: {fileID: 11500000, guid: dd45ab603848a8147a3b02553e5bc1ba, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_workflow:
|
m_workflow:
|
||||||
Datas: []
|
Datas: []
|
||||||
Functions: []
|
Functions: []
|
||||||
m_CameraTransform: {fileID: 2785136268184413821}
|
m_CameraTransform: {fileID: 3948954146018797651}
|
||||||
ScrollSpeed: 10
|
ScrollSpeed: 1
|
||||||
GraphNodePrefabs: {fileID: 11400000, guid: 30f07b1347aae0c4288acea46ad161e8, type: 2}
|
GraphNodePrefabs: {fileID: 11400000, guid: 30f07b1347aae0c4288acea46ad161e8, type: 2}
|
||||||
TextLabels: {fileID: 0}
|
TextLabels: {fileID: 11400000, guid: 06b127d4e769f714db8a80d09253087a, type: 2}
|
||||||
ContentPlane: {fileID: 7225733823207126825}
|
ContentPlane: {fileID: 0}
|
||||||
focusObject: {fileID: 7100963408768520451}
|
focusObject: {fileID: 8189909026899954709}
|
||||||
UIFocusObject: {fileID: 8189909026899954709}
|
UIFocusObject: {fileID: 0}
|
||||||
LastSavePath:
|
LastSavePath:
|
||||||
--- !u!95 &3419202564603977045
|
--- !u!95 &3419202564603977045
|
||||||
Animator:
|
Animator:
|
||||||
@@ -2970,7 +2898,6 @@ MonoBehaviour:
|
|||||||
m_DeselectOnBackgroundClick: 1
|
m_DeselectOnBackgroundClick: 1
|
||||||
m_PointerBehavior: 0
|
m_PointerBehavior: 0
|
||||||
m_CursorLockBehavior: 0
|
m_CursorLockBehavior: 0
|
||||||
m_ScrollDeltaPerTick: 6
|
|
||||||
--- !u!1 &8436897264842315307
|
--- !u!1 &8436897264842315307
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -3708,6 +3635,7 @@ MonoBehaviour:
|
|||||||
anchorMax: {x: 0, y: 0}
|
anchorMax: {x: 0, y: 0}
|
||||||
anchorMin: {x: 0, y: 0}
|
anchorMin: {x: 0, y: 0}
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0, y: 0}
|
||||||
|
BeforeMaximizeWindowBackgroundColorA: 1
|
||||||
AdjustSizeToContainsRect: {fileID: 0}
|
AdjustSizeToContainsRect: {fileID: 0}
|
||||||
--- !u!114 &1320903217118218443
|
--- !u!114 &1320903217118218443
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -4898,6 +4826,10 @@ PrefabInstance:
|
|||||||
propertyPath: WindowBar
|
propertyPath: WindowBar
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6735928090187812461, guid: 9d6ed184d3a99cd49b371b22fec6714f, type: 3}
|
||||||
|
propertyPath: WindowPlane
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6988049406595588431, guid: 9d6ed184d3a99cd49b371b22fec6714f, type: 3}
|
- target: {fileID: 6988049406595588431, guid: 9d6ed184d3a99cd49b371b22fec6714f, type: 3}
|
||||||
propertyPath: m_Size
|
propertyPath: m_Size
|
||||||
value: 1
|
value: 1
|
||||||
@@ -5951,6 +5883,10 @@ PrefabInstance:
|
|||||||
propertyPath: WindowBar
|
propertyPath: WindowBar
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 860861549860063477, guid: 14851ab435cb18448974bf76e92d8952, type: 3}
|
||||||
|
propertyPath: WindowPlane
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 860861549860063477, guid: 14851ab435cb18448974bf76e92d8952, type: 3}
|
- target: {fileID: 860861549860063477, guid: 14851ab435cb18448974bf76e92d8952, type: 3}
|
||||||
propertyPath: m_AllContextPlane.Array.data[0].plane
|
propertyPath: m_AllContextPlane.Array.data[0].plane
|
||||||
value:
|
value:
|
||||||
@@ -6193,7 +6129,6 @@ MonoBehaviour:
|
|||||||
m_TargetWindowContent: 0
|
m_TargetWindowContent: 0
|
||||||
m_ContentPlaneWhenNoWindow: {fileID: 0}
|
m_ContentPlaneWhenNoWindow: {fileID: 0}
|
||||||
ItemPrefab: {fileID: 7740662971038264527}
|
ItemPrefab: {fileID: 7740662971038264527}
|
||||||
m_PerformanceMode: 0
|
|
||||||
--- !u!114 &6628618279245547126
|
--- !u!114 &6628618279245547126
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -6239,7 +6174,7 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 2035005425643518082}
|
m_GameObject: {fileID: 2035005425643518082}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 91b5b0c662a658545ba5cfa5a0dd4b70, type: 3}
|
m_Script: {fileID: 11500000, guid: 21cd7907b9c0ce64bb4ef9dac9a93969, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!224 &7265172763763404296 stripped
|
--- !u!224 &7265172763763404296 stripped
|
||||||
@@ -6446,6 +6381,10 @@ PrefabInstance:
|
|||||||
propertyPath: WindowBar
|
propertyPath: WindowBar
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 860861549860063477, guid: 14851ab435cb18448974bf76e92d8952, type: 3}
|
||||||
|
propertyPath: WindowPlane
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1397725728417784005, guid: 14851ab435cb18448974bf76e92d8952, type: 3}
|
- target: {fileID: 1397725728417784005, guid: 14851ab435cb18448974bf76e92d8952, type: 3}
|
||||||
propertyPath: m_SizeDelta.y
|
propertyPath: m_SizeDelta.y
|
||||||
value: 0
|
value: 0
|
||||||
@@ -6746,7 +6685,6 @@ MonoBehaviour:
|
|||||||
m_TargetWindowContent: 0
|
m_TargetWindowContent: 0
|
||||||
m_ContentPlaneWhenNoWindow: {fileID: 0}
|
m_ContentPlaneWhenNoWindow: {fileID: 0}
|
||||||
ItemPrefab: {fileID: 1942734057263046869}
|
ItemPrefab: {fileID: 1942734057263046869}
|
||||||
m_PerformanceMode: 0
|
|
||||||
--- !u!114 &8999231603941374278
|
--- !u!114 &8999231603941374278
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -6769,7 +6707,7 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 1828036881698774017}
|
m_GameObject: {fileID: 1828036881698774017}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 91b5b0c662a658545ba5cfa5a0dd4b70, type: 3}
|
m_Script: {fileID: 11500000, guid: 21cd7907b9c0ce64bb4ef9dac9a93969, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!224 &5155802057930152595 stripped
|
--- !u!224 &5155802057930152595 stripped
|
||||||
@@ -9174,17 +9112,6 @@ PrefabInstance:
|
|||||||
addedObject: {fileID: 7844091122059257835}
|
addedObject: {fileID: 7844091122059257835}
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 47ed122beb336ff4ba830546f35ad2c8, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 47ed122beb336ff4ba830546f35ad2c8, type: 3}
|
||||||
--- !u!114 &3836347942742320304 stripped
|
|
||||||
MonoBehaviour:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 6015220258457388142, guid: 47ed122beb336ff4ba830546f35ad2c8, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 7369904209281605854}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 0}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 91b5b0c662a658545ba5cfa5a0dd4b70, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!224 &6061975152605555874 stripped
|
--- !u!224 &6061975152605555874 stripped
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_CorrespondingSourceObject: {fileID: 3631975649388694652, guid: 47ed122beb336ff4ba830546f35ad2c8, type: 3}
|
m_CorrespondingSourceObject: {fileID: 3631975649388694652, guid: 47ed122beb336ff4ba830546f35ad2c8, type: 3}
|
||||||
@@ -10105,10 +10032,6 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 6061975152605555874}
|
m_TransformParent: {fileID: 6061975152605555874}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 914721809293730570, guid: 44ff85d9b4c334343aaa0bf65299378d, type: 3}
|
|
||||||
propertyPath: m_WindowManager
|
|
||||||
value:
|
|
||||||
objectReference: {fileID: 3836347942742320304}
|
|
||||||
- target: {fileID: 914721809293730570, guid: 44ff85d9b4c334343aaa0bf65299378d, type: 3}
|
- target: {fileID: 914721809293730570, guid: 44ff85d9b4c334343aaa0bf65299378d, type: 3}
|
||||||
propertyPath: ConsoleButtonName
|
propertyPath: ConsoleButtonName
|
||||||
value: "\u63A7\u5236\u53F0/\u65E5\u5FD7"
|
value: "\u63A7\u5236\u53F0/\u65E5\u5FD7"
|
||||||
@@ -10193,10 +10116,6 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5573581179708198155, guid: 44ff85d9b4c334343aaa0bf65299378d, type: 3}
|
|
||||||
propertyPath: m_WindowManager
|
|
||||||
value:
|
|
||||||
objectReference: {fileID: 3836347942742320304}
|
|
||||||
- target: {fileID: 5573581179708198155, guid: 44ff85d9b4c334343aaa0bf65299378d, type: 3}
|
- target: {fileID: 5573581179708198155, guid: 44ff85d9b4c334343aaa0bf65299378d, type: 3}
|
||||||
propertyPath: m_PerformanceMode
|
propertyPath: m_PerformanceMode
|
||||||
value: 0
|
value: 0
|
||||||
|
Reference in New Issue
Block a user