/// <summary> Panel to show all active "Events" while playing </summary> /// <param name="inlineHelp">Should help be displayed?</param> void EventsPanel(bool inlineHelp) { ++EditorGUI.indentLevel; EditorGUILayout.BeginHorizontal(); { if (m_editorUtils.Button("AddEventButton", inlineHelp, GUILayout.Width(40)) && !string.IsNullOrEmpty(tmpTrigger)) { AmbienceManager.ActivateEvent(tmpTrigger); tmpTrigger = ""; } tmpTrigger = GUILayout.TextField(tmpTrigger); } EditorGUILayout.EndHorizontal(); foreach (string str in AmbienceManager.GetEvents()) { EditorGUILayout.BeginHorizontal(); { if (m_editorUtils.Button("RemoveEventButton", GUILayout.Width(40))) { AmbienceManager.DeactivateEvent(str); } GUILayout.Label(str); } EditorGUILayout.EndHorizontal(); } --EditorGUI.indentLevel; }
private void Update() { if (enemyReference1 == null && enemyReference2 == null && enemyReference3 == null) { AmbienceManager.DeactivateEvent("Combat"); } else { AmbienceManager.ActivateEvent("Combat"); } }
/// <summary> Checks position in LateUpdate after everything should have finished moving </summary> private void LateUpdate() { if (PlayerObject == null) { AmbienceManager manager = FindObjectOfType <AmbienceManager>(); if (manager) { PlayerObject = manager.m_playerObject; } else { Camera mainCamera = Camera.main; if (mainCamera) { PlayerObject = mainCamera.transform; } else { Debug.LogWarning("No Player Object specified, no AmbienceManager found, and no Camera. Unable to auto-select object.", this); return; } } } if (PlayerObject) { if (isWithin(PlayerObject.position)) { if (!lastWasSet) { lastWasSet = true; AmbienceManager.ActivateEvent(EventName); } } else { if (lastWasSet) { lastWasSet = false; AmbienceManager.DeactivateEvent(EventName); } } } }
public void RemoveHeartBeat() { AmbienceManager.RemoveSequence(Heartbeat); AmbienceManager.DeactivateEvent("Heartbeat"); }