GameJam Progress Day 2
This commit is contained in:
27
Assets/Scripts/UI/DebugAudio.cs
Normal file
27
Assets/Scripts/UI/DebugAudio.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DebugAudio : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
public MusicManager musicManager;
|
||||
public AudioClip[] audioClips;
|
||||
public bool current = true;
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
this.musicManager.CrossfadeToTrack(this.current ? this.audioClips[0] : this.audioClips[1]);
|
||||
this.current = !this.current;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/DebugAudio.cs.meta
Normal file
11
Assets/Scripts/UI/DebugAudio.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f14db97d0c91f44c91ec10eb10bf03c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Scripts/UI/LoadSceneOnClick.cs
Normal file
15
Assets/Scripts/UI/LoadSceneOnClick.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class LoadSceneOnClick : MonoBehaviour
|
||||
{
|
||||
public string sceneName;
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
Debug.Log("Load scene: " + this.sceneName);
|
||||
SceneManager.LoadScene(this.sceneName, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/LoadSceneOnClick.cs.meta
Normal file
11
Assets/Scripts/UI/LoadSceneOnClick.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a67f998c91f21a4c8f9b7ae2e3f7465
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/Scripts/UI/SetPlayerMode.cs
Normal file
22
Assets/Scripts/UI/SetPlayerMode.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SetPlayerMode : MonoBehaviour
|
||||
{
|
||||
|
||||
public int playerMode;
|
||||
private GameSettings settings;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
this.settings = GameObject.Find("/settings").GetComponent<GameSettings>();
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
this.settings.playerMode = this.playerMode;
|
||||
SceneManager.LoadScene("main", LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/SetPlayerMode.cs.meta
Normal file
11
Assets/Scripts/UI/SetPlayerMode.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6da432edf830e4a40be944b99c24096b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/UI/ToggleMusic.cs
Normal file
32
Assets/Scripts/UI/ToggleMusic.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ToggleMusic : MonoBehaviour
|
||||
{
|
||||
|
||||
private MusicManager musicManager;
|
||||
private AudioSource audioSource;
|
||||
public Material greenMat, redMat;
|
||||
public Renderer buttonVisuals;
|
||||
public AudioClip clickSound;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
this.audioSource = GetComponent<AudioSource>();
|
||||
this.musicManager = GameObject.Find("/BackgroundMusic").GetComponent<MusicManager>();
|
||||
bool audioState = this.musicManager.musicEnabled;
|
||||
|
||||
this.buttonVisuals.material = audioState ? this.greenMat : this.redMat;
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
bool newState = this.musicManager.ToggleMusic();
|
||||
|
||||
this.buttonVisuals.material = newState ? this.greenMat : this.redMat;
|
||||
this.audioSource.pitch = newState ? 1.5f : .75f;
|
||||
this.audioSource.PlayOneShot(this.clickSound);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/ToggleMusic.cs.meta
Normal file
11
Assets/Scripts/UI/ToggleMusic.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71e919d26e0f05840a23051a286dae56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user