public override void OnInspectorGUI() { DrawDefaultInspector(); VacuumSound script = (VacuumSound)target; if (GUILayout.Button("Start Engine")) { if (Application.isPlaying) { script.StartEngine(); } } if (GUILayout.Button("Stop Engine")) { if (Application.isPlaying) { script.StopEngine(); } } if (GUI.changed) { EditorUtility.SetDirty(vacuumSound); } serializedVacuumSound.ApplyModifiedProperties(); }
private void Start() { spring = GetComponent <SpringJoint>(); inputHandler = new MouseDragHandler(this, GetTriggerCollider(), spring); mat = GetComponent <Renderer>().material; sound = GetComponent <VacuumSound>(); DustSuckerSwitch.DustSuckerStatus += UpdateDustSuckerStatus; ConnectorDragAndDrop.DustSuckerConnectionLost += UpdateDustSuckerStatus; }
public override void OnUseUp(Hero hero) { Transform vacuum = hero.gameObject.transform.Find("perso").Find("vacuum").Find("vacuumActivable"); vacuum.gameObject.SetActive(false); Transform v = hero.gameObject.transform.Find("perso").Find("vacuum"); VacuumSound vs = v.GetComponent <VacuumSound>(); vs.VacuumUsed = false; }
private void Start() { CheckFields(); drag = GetComponent <DragScript>(); vacuumSound = GetComponent <VacuumSound>(); meltShader = Shader.Find(meltShaderID); DustSuckerSwitch.DustSuckerStatus += ChangeDustSuckerStatus; ConnectorDragAndDrop.DustSuckerConnectionLost += ChangeDustSuckerStatus; NitrousOxideSystems.NitrousStageChanged += ChangeNitrousStage; }
public override void OnInspectorGUI() { DrawDefaultInspector(); VacuumSound script = (VacuumSound)target; if (GUILayout.Button("Start Engine")) { script.StartEngine(); } if (GUILayout.Button("Stop Engine")) { script.StopEngine(); } }
/// <summary> /// Called everytime the inspected object is selected. /// </summary> private void OnEnable() { vacuumSound = (VacuumSound)target; serializedVacuumSound = new SerializedObject(vacuumSound); }