public static void StopEvent(AkEvent akEvent) { if (akEvents.Remove(akEvent)) { akEvent.data.Stop(akEvent.gameObject); } }
private void AddAkEvent(AkEvent akEvent) { akEvents.Add(akEvent); // In the case where objects are being placed in edit mode and then previewed, their positions won't yet be updated so we ensure they're updated here. AkSoundEngine.SetObjectPosition(akEvent.gameObject, akEvent.transform); }
private void RemoveAkEvent(AkEvent akEvent) { if (akEvent != null) { akEvents.Remove(akEvent); } }
public void StopEvent(AkEvent akEvent) { if (!IsEventPlaying(akEvent)) { return; } akEvent.data.Stop(akEvent.gameObject); }
void Start() { storyCollider = GetComponent <Collider>(); storyManager = GameObject.FindGameObjectWithTag("StoryManager").GetComponent <StoryManager>(); audioSource = GetComponent <AkEvent>(); cameraHandler = Camera.main.GetComponent <CameraHandler>(); rainHandler = GameObject.FindGameObjectWithTag("RainManager").GetComponent <HandleRain>(); }
public void OnEnable() { m_akEvent = target as AkEvent; m_UnityEventHandlerInspector.Init(serializedObject); eventID = serializedObject.FindProperty("eventID"); enableActionOnEvent = serializedObject.FindProperty("enableActionOnEvent"); actionOnEventType = serializedObject.FindProperty("actionOnEventType"); curveInterpolation = serializedObject.FindProperty("curveInterpolation"); transitionDuration = serializedObject.FindProperty("transitionDuration"); m_guidProperty = new SerializedProperty[1]; m_guidProperty[0] = serializedObject.FindProperty("valueGuid.Array"); //Needed by the base class to know which type of component its working with m_typeName = "Event"; m_objectType = AkWwiseProjectData.WwiseObjectType.EVENT; //Build a list of all supported callback type names and values int[] callbacktypes = (int[])Enum.GetValues(typeof(AkCallbackType)); int[] unsupportedCallbackValues = { (int)AkCallbackType.AK_SpeakerVolumeMatrix, (int)AkCallbackType.AK_MusicSyncAll, (int)AkCallbackType.AK_CallbackBits, (int)AkCallbackType.AK_EnableGetSourcePlayPosition, (int)AkCallbackType.AK_EnableGetMusicPlayPosition, (int)AkCallbackType.AK_EnableGetSourceStreamBuffering, (int)AkCallbackType.AK_Monitoring, (int)AkCallbackType.AK_AudioSourceChange, (int)AkCallbackType.AK_Bank, (int)AkCallbackType.AK_AudioInterruption }; m_supportedCallbackFlags = new string[callbacktypes.Length - unsupportedCallbackValues.Length]; m_supportedCallbackValues = new int [callbacktypes.Length - unsupportedCallbackValues.Length]; int index = 0; for (int i = 0; i < callbacktypes.Length; i++) { if (!Contain(unsupportedCallbackValues, callbacktypes[i])) { m_supportedCallbackFlags[index] = Enum.GetName(typeof(AkCallbackType), callbacktypes[i]).Substring(3); m_supportedCallbackValues[index] = callbacktypes[i]; index++; } } }
public void PlayEvent(AkEvent akEvent) { if (IsEventPlaying(akEvent)) { return; } uint playingID = AkSoundEngine.PostEvent((uint)akEvent.eventID, akEvent.gameObject, (uint)AkCallbackType.AK_EndOfEvent, CallbackHandler, akEvent); if (playingID != AkSoundEngine.AK_INVALID_PLAYING_ID) { AddAkEvent(akEvent); } }
public virtual void Init() { timerSev = TimerSev.Instance; camTrasn = Camera.main.transform; _transform = transform; _gameObject = gameObject; animator = GetComponent <Animator>(); hpRoot = transform.Find("hpRoot"); ctrl = GetComponent <CharacterController>(); Transform st = transform.Find("Sound"); soundObj = st == null ? null : st.gameObject; sound = soundObj == null ? null : soundObj.GetComponent <AkEvent>(); }
public void PlayEvent(AkEvent akEvent) { if (IsEventPlaying(akEvent)) { return; } UnityEngine.Debug.Log("PlayEvent(" + akEvent.eventID + "): " + akEvent.gameObject.name + " " + akEvent.transform.position); var playingID = AkSoundEngine.PostEvent((uint)akEvent.eventID, akEvent.gameObject, (uint)AkCallbackType.AK_EndOfEvent, CallbackHandler, akEvent); if (playingID != AkSoundEngine.AK_INVALID_PLAYING_ID) { AddAkEvent(akEvent); } }
public static void PlayEvent(AkEvent akEvent) { if (akEvents.Contains(akEvent)) { return; } var playingID = akEvent.data.Post(akEvent.gameObject, (uint)AkCallbackType.AK_EndOfEvent, CallbackHandler, akEvent); if (playingID != AkSoundEngine.AK_INVALID_PLAYING_ID) { akEvents.Add(akEvent); // In the case where objects are being placed in edit mode and then previewed, their positions won't yet be updated so we ensure they're updated here. AkSoundEngine.SetObjectPosition(akEvent.gameObject, akEvent.transform); } }
public void StopEvent(AkEvent akEvent) { if (!IsEventPlaying(akEvent)) { return; } AKRESULT result = AkSoundEngine.ExecuteActionOnEvent((uint)akEvent.eventID, AkActionOnEventType.AkActionOnEventType_Stop, akEvent.gameObject, 0); if (result == AKRESULT.AK_Success) { RemoveAkEvent(akEvent); } else { Debug.LogWarning("WwiseUnity: AkEditorEventPlayer: Failed to stop event: " + akEvent.name + "(id: " + akEvent.eventID + ")!"); } }
public void Activate(string effectName, Transform target) { Transform currentEffect = m_effectsList[effectName]; if (effectName == "Grab") { currentEffect.SetParent(target, true); } currentEffect.position = target.position; currentEffect.GetComponent <ParticleSystem>().Play(); AkEvent wwiseEvent = currentEffect.GetComponent <AkEvent>(); if (wwiseEvent) { wwiseEvent.HandleEvent(currentEffect.gameObject); } }
public void OnEnable() { m_akEvent = target as AkEvent; m_UnityEventHandlerInspector.Init(serializedObject); eventID = serializedObject.FindProperty("eventID"); enableActionOnEvent = serializedObject.FindProperty("enableActionOnEvent"); actionOnEventType = serializedObject.FindProperty("actionOnEventType"); curveInterpolation = serializedObject.FindProperty("curveInterpolation"); transitionDuration = serializedObject.FindProperty("transitionDuration"); m_guidProperty = new SerializedProperty[1]; m_guidProperty[0] = serializedObject.FindProperty("valueGuid.Array"); //Needed by the base class to know which type of component its working with m_typeName = "Event"; m_objectType = AkWwiseProjectData.WwiseObjectType.EVENT; //Build a list of all supported callback type names and values int[] callbacktypes = (int[])Enum.GetValues (typeof(AkCallbackType)); int[] unsupportedCallbackTypes = (int[])Enum.GetValues (typeof(AkUnsupportedCallbackType)); m_supportedCallbackFlags = new string[callbacktypes.Length - unsupportedCallbackTypes.Length]; m_supportedCallbackValues = new int [callbacktypes.Length - unsupportedCallbackTypes.Length]; int index = 0; for(int i = 0; i < callbacktypes.Length; i++) { if(!Contain(unsupportedCallbackTypes, callbacktypes[i])) { m_supportedCallbackFlags[index] = Enum.GetName(typeof(AkCallbackType), callbacktypes[i]).Substring(3); m_supportedCallbackValues[index] = callbacktypes[i]; index++; } } }
public bool IsEventPlaying(AkEvent akEvent) { return(akEvents.Contains(akEvent)); }
public override void InitSev() { bgAudioEvent = GameRoot.Instance.transform.Find("BGAudio").GetComponent <AkEvent>(); uiAudioEvent = GameRoot.Instance.transform.Find("UIAudio").GetComponent <AkEvent>(); Debug.Log("Init AudioSev..."); }
public override void OnChildInspectorGUI() { serializedObject.Update(); m_UnityEventHandlerInspector.OnGUI(); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); GUILayout.BeginVertical("Box"); { EditorGUILayout.PropertyField(enableActionOnEvent, new GUIContent("Action On Event: ")); if (enableActionOnEvent.boolValue) { EditorGUILayout.PropertyField(actionOnEventType, new GUIContent("Action On EventType: ")); EditorGUILayout.PropertyField(curveInterpolation, new GUIContent("Curve Interpolation: ")); EditorGUILayout.Slider(transitionDuration, 0.0f, 60.0f, new GUIContent("Fade Time (secs): ")); } } GUILayout.EndVertical(); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); GUILayout.BeginVertical("Box"); { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(callbackData); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); GUILayout.BeginVertical("Box"); { GUIStyle style = new GUIStyle(GUI.skin.button); float inspectorWidth = Screen.width - GUI.skin.box.margin.left - GUI.skin.box.margin.right; if (targets.Length == 1) { AkEvent akEvent = (AkEvent)target; bool eventPlaying = AkEditorEventPlayer.Instance.IsEventPlaying(akEvent); if (eventPlaying) { if (GUILayout.Button("Stop", style, GUILayout.MaxWidth(inspectorWidth))) { GUIUtility.hotControl = 0; AkEditorEventPlayer.Instance.StopEvent(akEvent); } } else { if (GUILayout.Button("Play", style, GUILayout.MaxWidth(inspectorWidth))) { GUIUtility.hotControl = 0; AkEditorEventPlayer.Instance.PlayEvent(akEvent); } } } else { bool playingEventsSelected = false; bool stoppedEventsSelected = false; for (int i = 0; i < targets.Length; ++i) { AkEvent akEventTarget = targets[i] as AkEvent; if (akEventTarget != null) { if (AkEditorEventPlayer.Instance.IsEventPlaying(akEventTarget)) { playingEventsSelected = true; } else { stoppedEventsSelected = true; } if (playingEventsSelected && stoppedEventsSelected) { break; } } } if (stoppedEventsSelected && GUILayout.Button("Play Multiple", style, GUILayout.MaxWidth(inspectorWidth))) { for (int i = 0; i < targets.Length; ++i) { AkEvent akEventTarget = targets[i] as AkEvent; if (akEventTarget != null) { AkEditorEventPlayer.Instance.PlayEvent(akEventTarget); } } } if (playingEventsSelected && GUILayout.Button("Stop Multiple", style, GUILayout.MaxWidth(inspectorWidth))) { for (int i = 0; i < targets.Length; ++i) { AkEvent akEventTarget = targets[i] as AkEvent; if (akEventTarget != null) { AkEditorEventPlayer.Instance.StopEvent(akEventTarget); } } } } if (GUILayout.Button("Stop All", style, GUILayout.MaxWidth(inspectorWidth))) { GUIUtility.hotControl = 0; AkEditorEventPlayer.Instance.StopAll(); } } GUILayout.EndVertical(); }
// Any extra asset stuff not handled or loaded by the Asset Bundle should be sorted here. // This is also a good place to set up any references, if you need to. // References within SkillState scripts can be done through EntityStateConfigs instead. internal static void PopulateAssets() { if (!mainAssetBundle) { Debug.LogError(SamusPlugin.MODNAME + ": AssetBundle not found. Unable to Populate Assets."); SamusPlugin.cancel = true; return; } Tracker = mainAssetBundle.LoadAsset <GameObject>("samusTrackingIndicator"); Missile = mainContentPack.projectilePrefabs[3]; //Missile = (GameObject)result; if (Missile) { Missile.GetComponent <RoR2.Projectile.ProjectileSingleTargetImpact>().impactEffect = LegacyResourcesAPI.Load <GameObject>("prefabs/effects/impacteffects/missileexplosionvfx"); GameObject refer = LegacyResourcesAPI.Load <GameObject>("prefabs/projectiles/missileprojectile"); AkEvent[] akEvents = refer.GetComponents <AkEvent>(); AkGameObj akGameObj1 = Missile.AddComponent <AkGameObj>(); akGameObj1 = refer.GetComponent <AkGameObj>(); foreach (AkEvent item in akEvents) { AkEvent b = Missile.AddComponent <AkEvent>(); b = item; } } //contentPack.FindAsset("projectilePrefabs", "SamusaltMissile", out object result2); altMissile = mainContentPack.projectilePrefabs[0]; if (altMissile) { altMissile.GetComponent <RoR2.Projectile.ProjectileSingleTargetImpact>().impactEffect = LegacyResourcesAPI.Load <GameObject>("prefabs/effects/impacteffects/MissileExplosionVFX"); GameObject refer = LegacyResourcesAPI.Load <GameObject>("prefabs/projectiles/engiharpoon"); AkGameObj akGameObj = altMissile.AddComponent <AkGameObj>(); AkEvent akEvent = altMissile.AddComponent <AkEvent>(); akGameObj = refer.GetComponent <AkGameObj>(); akEvent = refer.GetComponent <AkEvent>(); } //contentPack.FindAsset("projectilePrefabs", "SamusSuperMissile", out object res); sMissile = mainContentPack.projectilePrefabs[6]; if (sMissile) { sMissile.GetComponent <RoR2.Projectile.ProjectileImpactExplosion>().impactEffect = LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ImpactEffects/ExplosionVFX"); GameObject refer = LegacyResourcesAPI.Load <GameObject>("prefabs/projectiles/mageicebolt"); AkEvent akEvent = sMissile.AddComponent <AkEvent>(); akEvent = refer.GetComponent <AkEvent>(); } //contentPack.FindAsset("projectilePrefabs", "SamusBeam", out object ree); beam = mainContentPack.projectilePrefabs[1]; if (beam) { GameObject refer = LegacyResourcesAPI.Load <GameObject>("prefabs/projectiles/mageicebolt"); AkEvent akEvent = beam.AddComponent <AkEvent>(); akEvent = refer.GetComponent <AkEvent>(); } beamghost = beam.GetComponent <RoR2.Projectile.ProjectileController>().ghostPrefab; bomb = mainContentPack.projectilePrefabs[2]; if (bomb) { bomb.GetComponent <SphereCollider>().material = LegacyResourcesAPI.Load <GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile").GetComponent <SphereCollider>().material; bomb.GetComponent <RoR2.Projectile.ProjectileImpactExplosion>().impactEffect = LegacyResourcesAPI.Load <GameObject>("prefabs/effects/omnieffect/omniexplosionvfxcommandogrenade"); bomb.GetComponent <RoR2.Projectile.ProjectileImpactExplosion>().lifetimeExpiredSound = LegacyResourcesAPI.Load <RoR2.NetworkSoundEventDef>("networksoundeventdefs/nsecommandogrenadebounce"); } bool a; if (mainContentPack.projectilePrefabs[1].GetComponent <AkEvent>() != null) { a = true; } else { a = false; } cBeam = mainAssetBundle.LoadAsset <GameObject>("beamproj"); //Debug.Log(a); //defaultDance = mainAssetBundle.LoadAsset<AnimationClip>("DanceMoves"); //CustomEmotesAPI.AddCustomAnimation(defaultDance, true); if (VRAPI.VR.enabled) { VRAPI.VR.PreventRendererDisable("DGSamusBody", "ball2Mesh"); VRDomHand = mainAssetBundle.LoadAsset <GameObject>("samusGun"); MotionControls.AddHandPrefab(VRDomHand); VRnDomHand = mainAssetBundle.LoadAsset <GameObject>("samusHand"); MotionControls.AddHandPrefab(VRnDomHand); //gun = VRassets.LoadAsset<RuntimeAnimatorController>("gun"); //ray = VRassets.LoadAsset<RuntimeAnimatorController>("ray"); combatVisor = mainAssetBundle.LoadAsset <GameObject>("combatVisor"); combatHUD = mainAssetBundle.LoadAsset <GameObject>("combatHud"); ballHUD = mainAssetBundle.LoadAsset <GameObject>("ballHUD"); bossHUD = mainAssetBundle.LoadAsset <GameObject>("bossHud"); HUDHandler = mainAssetBundle.LoadAsset <GameObject>("hudHandler"); } }