Browse Source

Click sound when buttons are clicked

master
Christopher 8 years ago
parent
commit
f6fe5885c4
  1. 27
      Assets/Fungus/Scripts/Components/SaveGameHelper.cs
  2. 1230
      Assets/FungusExamples/SaveGame/SaveExample.unity
  3. 1028
      Assets/FungusExamples/SaveGame/SaveGameCanvas.prefab

27
Assets/Fungus/Scripts/Components/SaveGameHelper.cs

@ -16,8 +16,17 @@ namespace Fungus
[SerializeField] protected bool restartDeletesSave = false;
[SerializeField] protected AudioClip buttonClickClip;
[SerializeField] protected SaveGameObjects saveGameObjects = new SaveGameObjects();
protected AudioSource clickAudioSource;
protected virtual void Awake()
{
clickAudioSource = GetComponent<AudioSource>();
}
protected virtual void Start()
{
var saveManager = FungusManager.Instance.SaveManager;
@ -56,24 +65,38 @@ namespace Fungus
}
protected void PlayClickSound()
{
if (clickAudioSource != null)
{
clickAudioSource.Play();
}
}
#region Public methods
public SaveGameObjects SaveGameObjects { get { return saveGameObjects; } }
public virtual void Save()
{
PlayClickSound();
var saveManager = FungusManager.Instance.SaveManager;
saveManager.Save();
}
public virtual void Load()
{
PlayClickSound();
var saveManager = FungusManager.Instance.SaveManager;
saveManager.Load();
}
public virtual void Rewind()
{
PlayClickSound();
var saveManager = FungusManager.Instance.SaveManager;
saveManager.Rewind();
}
@ -88,11 +111,15 @@ namespace Fungus
saveManager.Delete();
}
PlayClickSound();
SceneManager.LoadScene(startScene);
}
public virtual void LoadScene(string sceneName)
{
PlayClickSound();
SceneManager.LoadScene(sceneName);
}

1230
Assets/FungusExamples/SaveGame/SaveExample.unity

File diff suppressed because it is too large Load Diff

1028
Assets/FungusExamples/SaveGame/SaveGameCanvas.prefab

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save