TO SQUASH: menu callbacks
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e6007beb4bc7af9fa054fc69ad4bbad
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -982,6 +982,148 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &943115079
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 943115082}
|
||||
- component: {fileID: 943115081}
|
||||
- component: {fileID: 943115080}
|
||||
m_Layer: 0
|
||||
m_Name: MenuCallbackHolder
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!82 &943115080
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 943115079}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 1
|
||||
MaxDistance: 500
|
||||
Pan2D: 0
|
||||
rolloffMode: 0
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &943115081
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 943115079}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8e6c3bcd6a2eb7ec5aab68f9b18daea7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::MenuCallbackHolder
|
||||
--- !u!4 &943115082
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 943115079}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -0.40235, y: -0.00364, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1085380534
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1266,6 +1408,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::MenuKey
|
||||
keyTurnOpen: {fileID: 8300000, guid: 8d953339321c6886f835ecf534bbc5b0, type: 3}
|
||||
keyTurnClose: {fileID: 8300000, guid: 29735eba95c0c2b9c900b7fe0d5a8e11, type: 3}
|
||||
callbackHolder: {fileID: 943115081}
|
||||
--- !u!82 &1133197553
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1878,3 +2021,4 @@ SceneRoots:
|
||||
- {fileID: 2040464652}
|
||||
- {fileID: 932608982}
|
||||
- {fileID: 1954113843}
|
||||
- {fileID: 943115082}
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class MenuCallbackHolder
|
||||
public class MenuCallbackHolder: MonoBehaviour
|
||||
{
|
||||
private System.Action[] callbacks;
|
||||
|
||||
public MenuCallbackHolder()
|
||||
private AudioSource audioSource;
|
||||
|
||||
private AudioClip zapAudioClip;
|
||||
|
||||
private static readonly string zapAudioClipPath = "Audio/1496_YummyStorm";
|
||||
|
||||
void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
zapAudioClip = Resources.Load<AudioClip>(zapAudioClipPath);
|
||||
|
||||
callbacks = new System.Action[]
|
||||
{
|
||||
PlayButtonCallback,
|
||||
@@ -38,25 +47,28 @@ public class MenuCallbackHolder
|
||||
public void InstruccionsButtonCallback()
|
||||
{
|
||||
Debug.Log("Instructions button pressed");
|
||||
// UnityEngine.SceneManagement.SceneManager.LoadScene("Instructions");
|
||||
// TODO: Implement instructions scene.
|
||||
}
|
||||
|
||||
public void SetupButtonCallback()
|
||||
{
|
||||
Debug.Log("Setup button pressed");
|
||||
// UnityEngine.SceneManagement.SceneManager.LoadScene("Setup");
|
||||
// TODO: Implement setup dialog.
|
||||
}
|
||||
|
||||
public void ZapButtonCallback()
|
||||
{
|
||||
Debug.Log("Zap Scores button pressed");
|
||||
// UnityEngine.SceneManagement.SceneManager.LoadScene("Zap");
|
||||
audioSource.PlayOneShot(zapAudioClip);
|
||||
|
||||
// TODO: Add a confirmation dialog before resetting scores
|
||||
GameSetup.ZapScores();
|
||||
}
|
||||
|
||||
public void AboutButtonCallback()
|
||||
{
|
||||
Debug.Log("About button pressed");
|
||||
// UnityEngine.SceneManagement.SceneManager.LoadScene("About");
|
||||
// TODO: Implement about dialog.
|
||||
}
|
||||
|
||||
public void QuitButtonCallback()
|
||||
|
||||
@@ -6,6 +6,8 @@ public class MenuKey : MonoBehaviour
|
||||
|
||||
public AudioClip keyTurnClose;
|
||||
|
||||
public MenuCallbackHolder callbackHolder;
|
||||
|
||||
private AudioSource audioSource;
|
||||
|
||||
private Animator animator;
|
||||
@@ -22,8 +24,6 @@ public class MenuKey : MonoBehaviour
|
||||
|
||||
private float translationTargetY = 0f;
|
||||
|
||||
private MenuCallbackHolder callbackHolder;
|
||||
|
||||
private static float animationDuration = 0.45f;
|
||||
|
||||
private static float[] rowPositions = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
|
||||
@@ -33,7 +33,6 @@ public class MenuKey : MonoBehaviour
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
animator = GetComponent<Animator>();
|
||||
callbackHolder = new MenuCallbackHolder();
|
||||
|
||||
// Precompute the row positions based on the number of rows and the desired spacing.
|
||||
for (int i = 0; i < rowPositions.Length; i++)
|
||||
|
||||
Reference in New Issue
Block a user