Volume Slider up and working
This commit is contained in:
parent
7d7cee0c2f
commit
400c5a1183
70
Assets/MainMixer.mixer
Normal file
70
Assets/MainMixer.mixer
Normal file
@ -0,0 +1,70 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!241 &24100000
|
||||
AudioMixerController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: MainMixer
|
||||
m_OutputGroup: {fileID: 0}
|
||||
m_MasterGroup: {fileID: 24300002}
|
||||
m_Snapshots:
|
||||
- {fileID: 24500006}
|
||||
m_StartSnapshot: {fileID: 24500006}
|
||||
m_SuspendThreshold: -80
|
||||
m_EnableSuspend: 1
|
||||
m_UpdateMode: 0
|
||||
m_ExposedParameters:
|
||||
- guid: 35004a0ad115b824c9584e7c2895e271
|
||||
name: MasterVolume
|
||||
m_AudioMixerGroupViews:
|
||||
- guids:
|
||||
- 97f889d19ac6b6d4b98b96f97d7330ea
|
||||
name: View
|
||||
m_CurrentViewIndex: 0
|
||||
m_TargetSnapshot: {fileID: 24500006}
|
||||
--- !u!243 &24300002
|
||||
AudioMixerGroupController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Master
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: 97f889d19ac6b6d4b98b96f97d7330ea
|
||||
m_Children: []
|
||||
m_Volume: 35004a0ad115b824c9584e7c2895e271
|
||||
m_Pitch: 5541d605c07ccf94b9cfc677ef236671
|
||||
m_Send: 00000000000000000000000000000000
|
||||
m_Effects:
|
||||
- {fileID: 24400004}
|
||||
m_UserColorIndex: 0
|
||||
m_Mute: 0
|
||||
m_Solo: 0
|
||||
m_BypassEffects: 0
|
||||
--- !u!244 &24400004
|
||||
AudioMixerEffectController:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_EffectID: fc2685071358ecc49868e720c19ea9c4
|
||||
m_EffectName: Attenuation
|
||||
m_MixLevel: 6f27870a3e3d9d645a5ceddf85353674
|
||||
m_Parameters: []
|
||||
m_SendTarget: {fileID: 0}
|
||||
m_EnableWetMix: 0
|
||||
m_Bypass: 0
|
||||
--- !u!245 &24500006
|
||||
AudioMixerSnapshotController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Snapshot
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_SnapshotID: b5d756f01c2c8b6469581612ef318259
|
||||
m_FloatValues: {}
|
||||
m_TransitionOverrides: {}
|
||||
8
Assets/MainMixer.mixer.meta
Normal file
8
Assets/MainMixer.mixer.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de87b833901494b4c90efb705ec209f6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 24100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Models/Rocks/Materials.meta
Normal file
8
Assets/Models/Rocks/Materials.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53056f94da94bf547aa8c99f5ddc65c3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -4172,7 +4172,6 @@ GameObject:
|
||||
- component: {fileID: 1303706980}
|
||||
- component: {fileID: 1303706982}
|
||||
- component: {fileID: 1303706983}
|
||||
- component: {fileID: 1303706984}
|
||||
m_Layer: 0
|
||||
m_Name: MainMenu
|
||||
m_TagString: Untagged
|
||||
@ -4223,26 +4222,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: -500, y: -110, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 20}
|
||||
--- !u!95 &1303706984
|
||||
Animator:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1303706979}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: 89edfa6231406074dbd4d9efe794169e, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!1 &1333764063 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 8256007898828206372, guid: cdba33ca476098a4caafd2d568d4250c,
|
||||
@ -5965,6 +5944,12 @@ PrefabInstance:
|
||||
propertyPath: m_audioClip
|
||||
value:
|
||||
objectReference: {fileID: 8300000, guid: ca051ddfd9879bb4783087293eb7e5a4, type: 3}
|
||||
- target: {fileID: 4094901255911055533, guid: 92a7b11ea4b35924a9caf2ab6d443449,
|
||||
type: 3}
|
||||
propertyPath: OutputAudioMixerGroup
|
||||
value:
|
||||
objectReference: {fileID: 24300002, guid: de87b833901494b4c90efb705ec209f6,
|
||||
type: 2}
|
||||
- target: {fileID: 8571589110344635516, guid: 92a7b11ea4b35924a9caf2ab6d443449,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
@ -6014,6 +5999,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mainMenu: {fileID: 1303706979}
|
||||
fadeSpeed: 150
|
||||
--- !u!224 &1779102552
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -6134,6 +6120,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1810604141}
|
||||
- component: {fileID: 1810604142}
|
||||
- component: {fileID: 1810604143}
|
||||
m_Layer: 0
|
||||
m_Name: Slider
|
||||
m_TagString: Untagged
|
||||
@ -6208,13 +6195,38 @@ MonoBehaviour:
|
||||
m_FillRect: {fileID: 150728461}
|
||||
m_HandleRect: {fileID: 686350915}
|
||||
m_Direction: 0
|
||||
m_MinValue: 0
|
||||
m_MinValue: 0.0001
|
||||
m_MaxValue: 1
|
||||
m_WholeNumbers: 0
|
||||
m_Value: 0
|
||||
m_Value: 1
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1810604143}
|
||||
m_TargetAssemblyTypeName: MixerController, Assembly-CSharp
|
||||
m_MethodName: SetVolume
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &1810604143
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1810604140}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 35ffad655b1a0944c9b1b68647c3e5b6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mixer: {fileID: 24100000, guid: de87b833901494b4c90efb705ec209f6, type: 2}
|
||||
--- !u!4 &1865335141 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 8121516479021020154, guid: f581ecc1591d0c14c8e5258dc7c52ccd,
|
||||
|
||||
13
Assets/Scripts/MixerController.cs
Normal file
13
Assets/Scripts/MixerController.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
public class MixerController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AudioMixer mixer;
|
||||
|
||||
public void SetVolume(float sliderValue)
|
||||
{
|
||||
mixer.SetFloat("MasterVolume", Mathf.Log10(sliderValue) * 20);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/MixerController.cs.meta
Normal file
11
Assets/Scripts/MixerController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35ffad655b1a0944c9b1b68647c3e5b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -6,17 +6,32 @@ using UnityEngine.UI;
|
||||
public class MainMenu : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject mainMenu;
|
||||
[SerializeField] float fadeSpeed;
|
||||
RectMask2D mainMenuMask;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
mainMenuMask = mainMenu.GetComponent<RectMask2D>();
|
||||
}
|
||||
public void CreditButtonPress()
|
||||
{
|
||||
StartCoroutine("MainMenuFadeOut", 0f);
|
||||
}
|
||||
|
||||
public IEnumerator MainMenuFadeOut()
|
||||
{
|
||||
float paddingAmount;
|
||||
Vector4 padding;
|
||||
|
||||
while (mainMenuMask.padding.y <= 20)
|
||||
{
|
||||
mainMenuMask.padding=new Vector4(mainMenuMask.padding.x, mainMenuMask.padding.y+1, mainMenuMask.padding.z, mainMenuMask.padding.w);
|
||||
Debug.Log(mainMenuMask.padding.y);
|
||||
paddingAmount = mainMenuMask.padding.y + (fadeSpeed * Time.deltaTime);
|
||||
padding = new Vector4(mainMenuMask.padding.x, paddingAmount, mainMenuMask.padding.z, mainMenuMask.padding.w);
|
||||
mainMenuMask.padding = padding;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user