Cailean Finn
1 year ago
11 changed files with 2995 additions and 10781 deletions
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: d8709408101c1814ca12055baffaf441 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
File diff suppressed because it is too large
@ -0,0 +1,204 @@ |
|||
using Minis; |
|||
using UnityEngine; |
|||
using UnityEngine.InputSystem; |
|||
using UnityEngine.VFX; |
|||
|
|||
public class MidiMap : MonoBehaviour |
|||
{ |
|||
|
|||
public VisualEffect m_VFX; |
|||
|
|||
// Point VFX Parameters
|
|||
private int m_PLifeMax; |
|||
private int m_PRate; |
|||
private int m_PNoise; |
|||
private int m_PSpeed; |
|||
private int m_PRatio; |
|||
private int m_PGravity; |
|||
private int m_PFreq; |
|||
private int m_PTurb; |
|||
|
|||
// Line VFX Parameters
|
|||
private int m_LToggle; |
|||
private int m_LRate; |
|||
private int m_LLifetime; |
|||
private int m_LRange; |
|||
private int m_LThickness; |
|||
|
|||
// Bubble VFX Parameters
|
|||
private int m_BSize; |
|||
private int m_BRate; |
|||
private int m_BLifetime; |
|||
private int m_BTurb; |
|||
private int m_BFreq; |
|||
private int m_BForce; |
|||
private int m_BToggle; |
|||
|
|||
|
|||
float f_PLifeMax = 0f; |
|||
float f_PRate = 0f; |
|||
float f_PNoise = 0f; |
|||
float f_PSpeed = 0f; |
|||
float f_PRatio = 0f; |
|||
float f_PGravity = 0f; |
|||
float f_PFreq = 0f; |
|||
float f_PTurb = 0f; |
|||
|
|||
float f_LRate = 0f; |
|||
float f_LLifetime = 0f; |
|||
bool f_LToggle = false; |
|||
float f_LRange = 0f; |
|||
float f_LThickness = 0f; |
|||
|
|||
float f_BSize = 0f; |
|||
float f_BRate = 0f; |
|||
float f_BFreq = 0f; |
|||
float f_BLifetime = 0f; |
|||
float f_BTurb = 0f; |
|||
bool f_BToggle = false; |
|||
|
|||
float f_BForceX = 0f; |
|||
float f_BForceY = 0f; |
|||
float f_BForceZ = 0f; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
float testMIDI = 0f; |
|||
float testMIDInoise = 0f; |
|||
|
|||
float m_Slider = 0f; |
|||
bool m_BSlider = false; |
|||
float m_Potent = 0f; |
|||
|
|||
|
|||
float[] m_SliderIn = new float[8]; |
|||
float[] m_PotIn = new float[8]; |
|||
|
|||
void Start() |
|||
{ |
|||
|
|||
m_PLifeMax = Shader.PropertyToID("Point Lifetime Max"); |
|||
m_PRate = Shader.PropertyToID("Point Rate"); |
|||
m_PRatio = Shader.PropertyToID("Turbulences Ratio"); |
|||
m_PNoise = Shader.PropertyToID("Noise"); |
|||
m_PSpeed = Shader.PropertyToID("Turbulences Speed"); |
|||
m_PFreq = Shader.PropertyToID("Turbulences Frequency"); |
|||
m_PGravity = Shader.PropertyToID("Gravity Point"); |
|||
m_PTurb = Shader.PropertyToID("Turbulences"); |
|||
|
|||
m_LToggle = Shader.PropertyToID("Toggle Line"); |
|||
m_LRate = Shader.PropertyToID("Line Rate"); |
|||
m_LLifetime = Shader.PropertyToID("Line Lifetime"); |
|||
m_LRange = Shader.PropertyToID("Line Range"); |
|||
m_LThickness = Shader.PropertyToID("Line Thickness"); |
|||
|
|||
m_BFreq = Shader.PropertyToID("Bubble Turbulences Frequency"); |
|||
m_BRate = Shader.PropertyToID("Bubble Rate"); |
|||
m_BLifetime = Shader.PropertyToID("Bubble Lifetime"); |
|||
m_BTurb = Shader.PropertyToID("Bubble Turbulences"); |
|||
m_BForce = Shader.PropertyToID("Bubble Force"); |
|||
m_BToggle = Shader.PropertyToID("Toggle Bubble"); |
|||
m_BSize = Shader.PropertyToID("Bubble Size"); |
|||
|
|||
|
|||
InputSystem.onDeviceChange += (device, change) => |
|||
{ |
|||
if (change != InputDeviceChange.Added) { |
|||
|
|||
return; |
|||
} |
|||
|
|||
var midiDevice = device as Minis.MidiDevice; |
|||
|
|||
if (midiDevice == null) |
|||
{ |
|||
|
|||
return; } |
|||
|
|||
midiDevice.onWillControlChange += (device, change) => |
|||
{ |
|||
if(device.controlNumber == 61) |
|||
{ |
|||
if (m_BSlider) |
|||
{ |
|||
m_BSlider = false; |
|||
return; |
|||
} |
|||
// Left
|
|||
m_Slider -= 1; |
|||
if(m_Slider < 0) { m_Slider = 2; } |
|||
m_BSlider = true; |
|||
} |
|||
|
|||
if (device.controlNumber == 62) |
|||
{ |
|||
// Right
|
|||
if (m_BSlider) |
|||
{ |
|||
m_BSlider = false; |
|||
return; |
|||
} |
|||
|
|||
m_Slider += 1; |
|||
if (m_Slider > 2) { m_Slider = 0; } |
|||
m_BSlider = true; |
|||
} |
|||
|
|||
|
|||
|
|||
if(device.controlNumber < 8) |
|||
{ |
|||
m_SliderIn[device.controlNumber] = (float)change; |
|||
} |
|||
|
|||
if (device.controlNumber >= 16 && device.controlNumber <=23) |
|||
{ |
|||
|
|||
m_PotIn[device.controlNumber - 16] = (float)change; |
|||
} |
|||
|
|||
|
|||
}; |
|||
}; |
|||
|
|||
|
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
foreach (var item in m_PotIn) |
|||
{ |
|||
Debug.Log(item); |
|||
} |
|||
SetupVFX(); |
|||
|
|||
} |
|||
|
|||
void SetupVFX() |
|||
{ |
|||
var eventAttribute = m_VFX.CreateVFXEventAttribute(); |
|||
m_VFX.SetFloat(m_PRate, f_PRate); |
|||
m_VFX.SetFloat(m_PLifeMax, f_PLifeMax); |
|||
m_VFX.SetFloat(m_PNoise, f_PNoise); |
|||
m_VFX.SetFloat(m_PTurb, f_PTurb); |
|||
m_VFX.SetFloat(m_PSpeed, f_PSpeed); |
|||
|
|||
m_VFX.SetFloat(m_LRate, f_LRate); |
|||
m_VFX.SetFloat(m_LLifetime, f_LLifetime); |
|||
m_VFX.SetBool(m_LToggle, f_LToggle); |
|||
m_VFX.SetFloat(m_LRange, f_LRange); |
|||
m_VFX.SetFloat(m_LThickness, f_LThickness); |
|||
|
|||
m_VFX.SetFloat(m_BSize, f_BSize); |
|||
m_VFX.SetFloat(m_BRate, f_BRate); |
|||
m_VFX.SetFloat(m_BFreq, f_BFreq); |
|||
m_VFX.SetFloat(m_BLifetime, f_BLifetime); |
|||
m_VFX.SetFloat(m_BTurb, f_BTurb); |
|||
m_VFX.SetBool(m_BToggle, f_BToggle); |
|||
|
|||
m_VFX.SetVector3(m_BForce, new Vector3(f_BForceX, f_BForceY, f_BForceZ)); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,11 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 4fdf832098836b94ab5452c25c084bcd |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
@ -0,0 +1,155 @@ |
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} |
|||
m_Name: MIDI Timeline |
|||
m_EditorClassIdentifier: |
|||
m_Version: 0 |
|||
m_Tracks: |
|||
- {fileID: 2246285225922495411} |
|||
m_FixedDuration: 0 |
|||
m_EditorSettings: |
|||
m_Framerate: 60 |
|||
m_ScenePreview: 1 |
|||
m_DurationMode: 0 |
|||
m_MarkerTrack: {fileID: 0} |
|||
--- !u!114 &2246285225922495411 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: d21dcc2386d650c4597f3633c75a1f98, type: 3} |
|||
m_Name: Animation Track |
|||
m_EditorClassIdentifier: |
|||
m_Version: 3 |
|||
m_AnimClip: {fileID: 0} |
|||
m_Locked: 0 |
|||
m_Muted: 0 |
|||
m_CustomPlayableFullTypename: |
|||
m_Curves: {fileID: 0} |
|||
m_Parent: {fileID: 11400000} |
|||
m_Children: [] |
|||
m_Clips: |
|||
- m_Version: 1 |
|||
m_Start: 0 |
|||
m_ClipIn: 0 |
|||
m_Asset: {fileID: 4194534005624568023} |
|||
m_Duration: 341.569673708295 |
|||
m_TimeScale: 1 |
|||
m_ParentTrack: {fileID: 2246285225922495411} |
|||
m_EaseInDuration: 0 |
|||
m_EaseOutDuration: 0 |
|||
m_BlendInDuration: -1 |
|||
m_BlendOutDuration: -1 |
|||
m_MixInCurve: |
|||
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 |
|||
m_MixOutCurve: |
|||
serializedVersion: 2 |
|||
m_Curve: |
|||
- serializedVersion: 3 |
|||
time: 0 |
|||
value: 1 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
- serializedVersion: 3 |
|||
time: 1 |
|||
value: 0 |
|||
inSlope: 0 |
|||
outSlope: 0 |
|||
tangentMode: 0 |
|||
weightedMode: 0 |
|||
inWeight: 0 |
|||
outWeight: 0 |
|||
m_PreInfinity: 2 |
|||
m_PostInfinity: 2 |
|||
m_RotationOrder: 4 |
|||
m_BlendInCurveMode: 0 |
|||
m_BlendOutCurveMode: 0 |
|||
m_ExposedParameterNames: [] |
|||
m_AnimationCurves: {fileID: 0} |
|||
m_Recordable: 0 |
|||
m_PostExtrapolationMode: 1 |
|||
m_PreExtrapolationMode: 1 |
|||
m_PostExtrapolationTime: Infinity |
|||
m_PreExtrapolationTime: 0 |
|||
m_DisplayName: Scene |
|||
m_Markers: |
|||
m_Objects: [] |
|||
m_InfiniteClipPreExtrapolation: 0 |
|||
m_InfiniteClipPostExtrapolation: 0 |
|||
m_InfiniteClipOffsetPosition: {x: 0, y: 0, z: 0} |
|||
m_InfiniteClipOffsetEulerAngles: {x: 0, y: 0, z: 0} |
|||
m_InfiniteClipTimeOffset: 0 |
|||
m_InfiniteClipRemoveOffset: 0 |
|||
m_InfiniteClipApplyFootIK: 1 |
|||
mInfiniteClipLoop: 0 |
|||
m_MatchTargetFields: 63 |
|||
m_Position: {x: 0, y: 0, z: 0} |
|||
m_EulerAngles: {x: 0, y: 0, z: 0} |
|||
m_AvatarMask: {fileID: 0} |
|||
m_ApplyAvatarMask: 1 |
|||
m_TrackOffset: 0 |
|||
m_InfiniteClip: {fileID: 0} |
|||
m_OpenClipOffsetRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_Rotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_ApplyOffsets: 0 |
|||
--- !u!114 &4194534005624568023 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 1 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 030f85c3f73729f4f976f66ffb23b875, type: 3} |
|||
m_Name: AnimationPlayableAsset |
|||
m_EditorClassIdentifier: |
|||
m_Clip: {fileID: -623603649343465320, guid: 58aae735d649cbd4f9ae23a86c0d7e0a, type: 3} |
|||
m_Position: {x: 0, y: 0, z: 0} |
|||
m_EulerAngles: {x: 0, y: 0, z: 0} |
|||
m_UseTrackMatchFields: 1 |
|||
m_MatchTargetFields: 63 |
|||
m_RemoveStartOffset: 1 |
|||
m_ApplyFootIK: 1 |
|||
m_Loop: 0 |
|||
m_Version: 1 |
|||
m_Rotation: {x: 0, y: 0, z: 0, w: 1} |
@ -0,0 +1,8 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 219b44f685a6aa1428df393ac25c6755 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
@ -0,0 +1,16 @@ |
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &1 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 53 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
assetDefaultFramerate: 60 |
|||
m_DefaultFrameRate: 60 |
Loading…
Reference in new issue