Exemple #1
0
 void OnEnable()
 {
     if (onEnable != null)
     {
         InAudio.PostEvent(gameObject, onEnable);
     }
 }
Exemple #2
0
        public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            Debug.Log("Exit " + Name);
            canSetVolume = false;
            var go = animator.gameObject;

            InAudio.PostEvent(go, OnExitState.ToPost);

            int toPlayCount = OnExitState.ToPlay.Count;
            var toPlay      = OnExitState.ToPlay;

            for (int i = 0; i < toPlayCount; i++)
            {
                InAudio.Play(go, toPlay[i]);
            }

            int toStopCount = OnExitState.ToStop.Count;
            var toStop      = OnExitState.ToStop;

            for (int i = 0; i < toStopCount; i++)
            {
                InAudio.Stop(go, toStop[i]);
            }

            //Set Values to Max
        }
Exemple #3
0
        public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            var go    = animator.gameObject;
            int count = Parameters.ParameterList.Count;

            for (int i = 0; i < count; i++)
            {
                var elem = Parameters.ParameterList[i];
                elem.StartVolume = InAudio._getEventWorker().GetMinVolume(go, elem.Node);
                //Debug.Log("Enter " + name + " " + elem.StartVolume);
            }
            canSetVolume = true;
            Debug.Log("Enter " + Name);

            InAudio.PostEvent(go, OnEnterState.ToPost);

            int toPlayCount = OnEnterState.ToPlay.Count;
            var toPlay      = OnEnterState.ToPlay;

            for (int i = 0; i < toPlayCount; i++)
            {
                //Debug.Log("Play" + toPlay[i].Name);
                InAudio.Play(go, toPlay[i]);
            }

            int toStopCount = OnEnterState.ToStop.Count;
            var toStop      = OnEnterState.ToStop;

            for (int i = 0; i < toStopCount; i++)
            {
                InAudio.Stop(go, toStop[i]);
            }
        }
 void Start()
 {
     InAudio.PostEvent(gameObject, onStart);
     if (onEnableMusic != null)
     {
         HandleMusic(onStartMusic, "OnStart");
     }
 }
 void OnDisable()
 {
     InAudio.PostEvent(gameObject, onDisable);
     if (onDisableMusic != null)
     {
         HandleMusic(onDisableMusic, "OnDisable");
     }
 }
 void OnDestroy()
 {
     InAudio.PostEvent(gameObject, onDestroy);
     if (onDestroyMusic != null)
     {
         HandleMusic(onDestroyMusic, "OnDestroy");
     }
 }
 void OnCollisionExit(Collision collision)
 {
     if (CollisionList.CollisionReaction)
     {
         if (IsInLayerMask(collision.gameObject, CollisionList.Layers))
         {
             InAudio.PostEvent(gameObject, CollisionList.EventsExit);
         }
     }
 }
 void OnTriggerExit(Collider collider)
 {
     if (CollisionList.TriggerReaction)
     {
         if (IsInLayerMask(collider.gameObject, CollisionList.Layers))
         {
             InAudio.PostEvent(gameObject, CollisionList.EventsExit);
         }
     }
 }
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (CollisionList.CollisionReaction)
     {
         if (IsInLayerMask(collision.gameObject, CollisionList.Layers))
         {
             InAudio.PostEvent(gameObject, CollisionList.EventsEnter);
         }
     }
 }
Exemple #10
0
    IEnumerator PlayWin()
    {
        gameOver = true;
        Services.Get <MusicPlayer>().GetComponent <AudioSource>().Stop();
        InAudio.PostEvent(gameObject, Winning);
        yield return(new WaitForSeconds(4));

        Application.LoadLevel(Application.loadedLevel == 2 ? 3 : 2);
        gameOver = false;
    }
Exemple #11
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (enabled)
     {
         if (ActivateOnMouseOver != null)
         {
             InAudio.PostEvent(gameObject, ActivateOnMouseOver);
         }
         if (playNodeWhileMouseOver != null)
         {
             InAudio.Play(gameObject, playNodeWhileMouseOver);
         }
     }
 }
 public void OnPointerClick(PointerEventData eventData)
 {
     if (enabled)
     {
         if (onClick != null)
         {
             InAudio.PostEvent(gameObject, onClick);
         }
         if (onClickSound != null)
         {
             InAudio.PlayPersistent(gameObject.transform.position, onClickSound);
         }
     }
 }
Exemple #13
0
        public override void OnStateMachineExit(Animator animator, int stateMachinePathHash)
        {
            var go = animator.gameObject;

            InAudio.PostEvent(go, OnExitMachine.ToPost);

            int toPlayCount = OnExitMachine.ToPlay.Count;
            var toPlay      = OnExitMachine.ToPlay;

            for (int i = 0; i < toPlayCount; i++)
            {
                InAudio.Play(go, toPlay[i]);
            }

            int toStopCount = OnExitMachine.ToPlay.Count;
            var toStop      = OnExitMachine.ToStop;

            for (int i = 0; i < toStopCount; i++)
            {
                InAudio.Stop(go, toStop[i]);
            }
        }
Exemple #14
0
        public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
        {
            canSetVolume = false;
            Debug.Log("Enter Machine");
            var go = animator.gameObject;

            InAudio.PostEvent(go, OnEnterMachine.ToPost);

            int toPlayCount = OnEnterMachine.ToPlay.Count;
            var toPlay      = OnEnterMachine.ToPlay;

            for (int i = 0; i < toPlayCount; i++)
            {
                InAudio.Play(go, toPlay[i]);
            }

            int toStopCount = OnEnterMachine.ToPlay.Count;
            var toStop      = OnEnterMachine.ToStop;

            for (int i = 0; i < toStopCount; i++)
            {
                InAudio.Stop(go, toStop[i]);
            }
        }
Exemple #15
0
 void Start()
 {
     InAudio.PostEvent(gameObject, onStart);
 }
Exemple #16
0
 void OnDisable()
 {
     InAudio.PostEvent(gameObject, onDisable);
 }
Exemple #17
0
 void OnDestroy()
 {
     InAudio.PostEvent(gameObject, onDestroy);
 }
Exemple #18
0
        public static bool Draw(InAudioEventNode audioevent)
        {
            if (ListAdapter == null)
            {
                ListAdapter               = new EventActionListAdapter();
                ListAdapter.DrawEvent     = DrawItem;
                ListAdapter.ClickedInArea = ClickedInArea;
            }

            if (lastEvent != audioevent)
            {
                ListAdapter.Event = audioevent;

                audioEventAction = null;
                if (audioevent._actionList.Count > 0)
                {
                    audioEventAction = audioevent._actionList[0];
                }
            }
            EditorGUILayout.BeginVertical();

            lastEvent = audioevent;
            InUndoHelper.GUIUndo(audioevent, "Name Change", ref audioevent.Name, () =>
                                 EditorGUILayout.TextField("Name", audioevent.Name));

            bool repaint = false;

            if (audioevent._type == EventNodeType.Event)
            {
                EditorGUIHelper.DrawID(audioevent._guid);

                if (Application.isPlaying)
                {
                    eventObjectTarget = EditorGUILayout.ObjectField("Event preview target", eventObjectTarget, typeof(GameObject), true) as GameObject;

                    if (eventObjectTarget != null)
                    {
                        bool prefab = PrefabUtility.GetPrefabParent(eventObjectTarget) == null && PrefabUtility.GetPrefabObject(eventObjectTarget) != null;
                        if (!prefab)
                        {
                            EditorGUILayout.BeginHorizontal();
                            if (GUILayout.Button("Post event"))
                            {
                                InAudio.PostEvent(eventObjectTarget, audioevent);
                            }
                            if (GUILayout.Button("Stop All Sounds/Music in Event"))
                            {
                                InAudio.StopAll(eventObjectTarget);
                                foreach (var eventAction in audioevent._actionList)
                                {
                                    var music = eventAction.Target as InMusicGroup;
                                    if (music != null)
                                    {
                                        InAudio.Music.Stop(music);
                                    }
                                }
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Cannot post events on Prefab", MessageType.Error);
                        }
                    }
                    EditorGUILayout.Separator();
                }



                InUndoHelper.GUIUndo(audioevent, "Delay", ref audioevent.Delay, () =>
                                     Mathf.Max(EditorGUILayout.FloatField("Delay", audioevent.Delay), 0));

                NewEventArea(audioevent);

                EditorGUILayout.Separator();
                EditorGUILayout.Separator();

                scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

                repaint = DrawContent();

                EditorGUILayout.EndScrollView();
                DrawSelected(audioEventAction);
            }
            else if (audioevent._type == EventNodeType.Folder)
            {
                if (audioevent.PlacedExternaly)
                {
                    EditorGUILayout.Separator();

                    GUI.enabled = false;
                    EditorGUILayout.ObjectField("Placed on", audioevent.gameObject, typeof(GameObject), false);
                    GUI.enabled = true;

                    EditorGUILayout.Separator();
                }
            }

            EditorGUILayout.EndVertical();

            if (toRemove != null)
            {
                InUndoHelper.DoInGroup(() =>
                {
                    //Remove the required piece
                    int index = audioevent._actionList.FindIndex(toRemove);
                    AudioEventWorker.DeleteActionAtIndex(audioevent, index);
                });
                toRemove = null;
            }
            else //Remove all actions that does not excist.
            {
                audioevent._actionList.RemoveAll(p => p == null);
            }
            return(repaint);
        }
Exemple #19
0
 protected override void PlayAttackSoundOnce()
 {
     InAudio.PostEvent(gameObject, SceneManager.instance.PickmanAttackEvent);
 }