Potential Bug/problem
after messing with it, it seems that i cant use the current audio setup because if you simply play a sound on the camera where the games music is from, it will replace the sound of the camera with the button sound and it would effectively stop the music
so I've removed the play Audio option until some sort of work around could be made so the button sounds can play without interrupting other sounds
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
using UnityEngine;
using System.Collections.Generic;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GUI)]
[Tooltip("GUI button. Sends an Event when pressed. Optionally store the button state in a Bool Variable.")]
public class GUIAdvancedButton : GUIContentAction
{
public FsmEvent sendEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeButtonState;
//
[ActionSection("Store String Value?")]
public FsmString stringVariable;
public FsmString stringValue;
//
[ActionSection("Store Int Value?")]
public FsmInt intVariable;
public FsmInt intValue;
//
public override void Reset()
{
base.Reset();
sendEvent = null;
storeButtonState = null;
style = "Button";
}
public override void OnGUI()
{
base.OnGUI();
bool pressed = false;
if (GUI.Button(rect, content, style.Value))
{
Fsm.Event(sendEvent);
stringVariable.Value = stringValue.Value;
intVariable.Value = intValue.Value;
pressed = true;
}
if (storeButtonState != null)
{
storeButtonState.Value = pressed;
}
}
}
}
save as GUIAdvancedButton