finalised main menu
This commit is contained in:
parent
69e68e4879
commit
a5b2f863fe
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f5eb8065324d13246b9599875b38f78e
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,75 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class MainMenuUI : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header( "Timing" )]
|
||||||
|
[SerializeField]
|
||||||
|
private float _fadeTime;
|
||||||
|
|
||||||
|
[Header("References")]
|
||||||
|
[SerializeField]
|
||||||
|
private SceneLoader _loader;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private CanvasGroup _navigation;
|
||||||
|
|
||||||
|
private CanvasGroup _current;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
ShowMenu( _navigation );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartGame()
|
||||||
|
{
|
||||||
|
_loader.LoadScene( SceneType.Gameplay );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowMenu(CanvasGroup newMenu)
|
||||||
|
{
|
||||||
|
if ( newMenu == _current )
|
||||||
|
return;
|
||||||
|
|
||||||
|
StartCoroutine( FadeMenu( _current, newMenu ) );
|
||||||
|
_current = newMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator FadeMenu( CanvasGroup from, CanvasGroup to )
|
||||||
|
{
|
||||||
|
float a = 1.0f;
|
||||||
|
|
||||||
|
if ( from != null )
|
||||||
|
{
|
||||||
|
from.interactable = false;
|
||||||
|
|
||||||
|
while ( a > 0.0f )
|
||||||
|
{
|
||||||
|
from.alpha = a;
|
||||||
|
a -= Time.unscaledDeltaTime / _fadeTime;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
from.gameObject.SetActive(false);
|
||||||
|
from.interactable = true;
|
||||||
|
from.alpha = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
to.gameObject.SetActive(true);
|
||||||
|
to.alpha = 0.0f;
|
||||||
|
to.interactable = false;
|
||||||
|
|
||||||
|
a = 0;
|
||||||
|
while ( a < 1.0f )
|
||||||
|
{
|
||||||
|
to.alpha = a;
|
||||||
|
a += Time.unscaledDeltaTime / _fadeTime;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
to.alpha = 1.0f;
|
||||||
|
to.interactable = true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e1c889bb1f00ccd4890844e2e4c30a57
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -401,31 +401,31 @@ AnimatorController:
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: Highlighted
|
- m_Name: Highlighted
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: Pressed
|
- m_Name: Pressed
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: Selected
|
- m_Name: Selected
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
- m_Name: Disabled
|
- m_Name: Disabled
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
|
@ -720,7 +720,35 @@ AnimationClip:
|
||||||
m_EulerCurves: []
|
m_EulerCurves: []
|
||||||
m_PositionCurves: []
|
m_PositionCurves: []
|
||||||
m_ScaleCurves: []
|
m_ScaleCurves: []
|
||||||
m_FloatCurves: []
|
m_FloatCurves:
|
||||||
|
- curve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0.083333336
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
attribute: m_Alpha
|
||||||
|
path: Squish
|
||||||
|
classID: 225
|
||||||
|
script: {fileID: 0}
|
||||||
m_PPtrCurves: []
|
m_PPtrCurves: []
|
||||||
m_SampleRate: 60
|
m_SampleRate: 60
|
||||||
m_WrapMode: 0
|
m_WrapMode: 0
|
||||||
|
@ -728,14 +756,21 @@ AnimationClip:
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
m_Extent: {x: 0, y: 0, z: 0}
|
m_Extent: {x: 0, y: 0, z: 0}
|
||||||
m_ClipBindingConstant:
|
m_ClipBindingConstant:
|
||||||
genericBindings: []
|
genericBindings:
|
||||||
|
- serializedVersion: 2
|
||||||
|
path: 2750837211
|
||||||
|
attribute: 1574349066
|
||||||
|
script: {fileID: 0}
|
||||||
|
typeID: 225
|
||||||
|
customType: 0
|
||||||
|
isPPtrCurve: 0
|
||||||
pptrCurveMapping: []
|
pptrCurveMapping: []
|
||||||
m_AnimationClipSettings:
|
m_AnimationClipSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||||
m_AdditiveReferencePoseTime: 0
|
m_AdditiveReferencePoseTime: 0
|
||||||
m_StartTime: 0
|
m_StartTime: 0
|
||||||
m_StopTime: 1
|
m_StopTime: 0.083333336
|
||||||
m_OrientationOffsetY: 0
|
m_OrientationOffsetY: 0
|
||||||
m_Level: 0
|
m_Level: 0
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
|
@ -750,7 +785,35 @@ AnimationClip:
|
||||||
m_KeepOriginalPositionXZ: 0
|
m_KeepOriginalPositionXZ: 0
|
||||||
m_HeightFromFeet: 0
|
m_HeightFromFeet: 0
|
||||||
m_Mirror: 0
|
m_Mirror: 0
|
||||||
m_EditorCurves: []
|
m_EditorCurves:
|
||||||
|
- curve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0.083333336
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
attribute: m_Alpha
|
||||||
|
path: Squish
|
||||||
|
classID: 225
|
||||||
|
script: {fileID: 0}
|
||||||
m_EulerEditorCurves: []
|
m_EulerEditorCurves: []
|
||||||
m_HasGenericRootTransform: 0
|
m_HasGenericRootTransform: 0
|
||||||
m_HasMotionFloatCurves: 0
|
m_HasMotionFloatCurves: 0
|
||||||
|
|
Loading…
Reference in New Issue