Exemplo n.º 1
0
        public override void AssignValues(List<ActionParameter> parameters)
        {
            soundObject = AssignFile <Sound> (parameters, parameterID, constantID, soundObject);
            runtimeSound = soundObject;

            if (runtimeSound == null && audioClip != null)
            {
                runtimeSound = KickStarter.sceneSettings.defaultSound;
            }
        }
Exemplo n.º 2
0
		protected virtual void Awake ()
		{
			GameObject newOb = new GameObject ();
			newOb.name = this.name + " (Grab point)";
			grabPoint = newOb.transform;
			grabPoint.parent = this.transform;

			if (moveSoundClip)
			{
				GameObject newSoundOb = new GameObject ();
				newSoundOb.name = this.name + " (Move sound)";
				newSoundOb.transform.parent = this.transform;
				newSoundOb.AddComponent <Sound>();
				newSoundOb.GetComponent<AudioSource>().playOnAwake = false;
				moveSound = newSoundOb.GetComponent <Sound>();
			}

			icon = GetMainIcon ();

			if (Camera.main)
			{
				cameraTransform = Camera.main.transform;
			}

			if (GetComponent <Sound>())
			{
				collideSound = GetComponent <Sound>();
			}

			if (GetComponent <Rigidbody>())
			{
				_rigidbody = GetComponent <Rigidbody>();
			}
			else
			{
				Debug.LogWarning ("A Rigidbody component is required for " + this.name);
			}
		}
Exemplo n.º 3
0
        public override void ShowGUI()
        {
            #if UNITY_WEBGL

            EditorGUILayout.HelpBox ("This Action is not available on the WebGL platform.", MessageType.Info);

            #elif UNITY_IOS || UNITY_ANDROID || UNITY_WP8

            filePath = EditorGUILayout.TextField ("Path to clip file:", filePath);
            canSkip = EditorGUILayout.Toggle ("Player can skip?", canSkip);

            #elif UNITY_5 || UNITY_PRO_LICENSE

            movieClip = (MovieTexture) EditorGUILayout.ObjectField ("Movie clip:", movieClip, typeof (MovieTexture), false);
            if (movieClip)
            {
                EditorGUILayout.HelpBox ("The clip must be placed in a folder named 'StreamingAssets'.", MessageType.Info);
            }

            movieClipType = (MovieClipType) EditorGUILayout.EnumPopup ("Play clip:", movieClipType);
            if (movieClipType == MovieClipType.OnMaterial)
            {
                material = (Material) EditorGUILayout.ObjectField ("Material to play on:", material, typeof (Material), true);
            }

            includeAudio = EditorGUILayout.Toggle ("Include audio?", includeAudio);
            if (includeAudio)
            {
                sound = (Sound) EditorGUILayout.ObjectField ("Audio source:", sound, typeof (Sound), true);
            }

            if (movieClipType == MovieClipType.OnMaterial)
            {
                willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait);
            }
            if (movieClipType == MovieClipType.FullScreen || willWait)
            {
                canSkip = EditorGUILayout.Toggle ("Player can skip?", canSkip);
                if (canSkip)
                {
                    skipKey = EditorGUILayout.TextField ("Skip with Input Button:", skipKey);
                }
            }

            #else
            EditorGUILayout.HelpBox ("On non-mobile platforms, this Action is only available in Unity 5 or Unity Pro.", MessageType.Warning);
            #endif

            AfterRunningOption ();
        }
Exemplo n.º 4
0
 public override void AssignValues(List<ActionParameter> parameters)
 {
     soundObject = AssignFile <Sound> (parameters, parameterID, constantID, soundObject);
 }
Exemplo n.º 5
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI ("Sound object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID = 0;
                soundObject = null;
            }
            else
            {
                soundObject = (Sound) EditorGUILayout.ObjectField ("Sound object:", soundObject, typeof(Sound), true);

                constantID = FieldToID <Sound> (soundObject, constantID);
                soundObject = IDToField <Sound> (soundObject, constantID, false);
            }

            soundAction = (SoundAction) EditorGUILayout.EnumPopup ("Sound action:", (SoundAction) soundAction);

            if (soundAction == SoundAction.Play || soundAction == SoundAction.FadeIn)
            {
                loop = EditorGUILayout.Toggle ("Loop?", loop);
                ignoreIfPlaying = EditorGUILayout.Toggle ("Ignore if already playing?", ignoreIfPlaying);
                audioClip = (AudioClip) EditorGUILayout.ObjectField ("New clip (optional)", audioClip, typeof (AudioClip), false);
            }

            if (soundAction == SoundAction.FadeIn || soundAction == SoundAction.FadeOut)
            {
                fadeTime = EditorGUILayout.Slider ("Fade time:", fadeTime, 0f, 10f);
            }

            if (soundAction == SoundAction.Stop)
            {
                affectChildren = EditorGUILayout.Toggle ("Stop child Sounds, too?", affectChildren);
            }

            AfterRunningOption ();
        }
Exemplo n.º 6
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            parameterID = Action.ChooseParameterGUI ("Sound object:", parameters, parameterID, ParameterType.GameObject);
            if (parameterID >= 0)
            {
                constantID = 0;
                soundObject = null;
            }
            else
            {
                soundObject = (Sound) EditorGUILayout.ObjectField ("Sound object:", soundObject, typeof(Sound), true);

                constantID = FieldToID <Sound> (soundObject, constantID);
                soundObject = IDToField <Sound> (soundObject, constantID, false);
            }

            newRelativeVolume = EditorGUILayout.Slider ("New volume:", newRelativeVolume, 0f, 1f);

            AfterRunningOption ();
        }
Exemplo n.º 7
0
 /**
  * <summary>Fades out any music being played.</summary>
  * <param name = "newSound">The Sound object to not affect</param>
  */
 public void EndOldMusic(Sound newSound)
 {
     if (soundType == SoundType.Music && audioSource.isPlaying && this != newSound)
     {
         if (!isFading || fadeType == FadeType.fadeIn)
         {
             FadeOut (0.1f);
         }
     }
 }
Exemplo n.º 8
0
 override public void AssignValues(List <ActionParameter> parameters)
 {
     soundObject = AssignFile <Sound> (parameters, parameterID, constantID, soundObject);
 }