Exemplo n.º 1
0
 //fade 기능.
 public void FadeIn(float time, Interpolate.EaseType easeType)
 {
     this.IsFadeOut           = false;
     this.IsFadeIn            = true;
     this.FadeTime1           = 0.0f;
     this.FadeTime2           = time;
     this.Interpolatefunction = Interpolate.Ease(easeType);
 }
Exemplo n.º 2
0
 public void ScaleTo(Vector3 destination, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete)
 {
     scaleInitial       = transform.localScale;
     scaleDisplacement  = destination - scaleInitial;
     scaleFunc          = Interpolate.Ease(easingFunction);
     scaleOnComplete    = onComplete;
     scaleDurationTotal = duration;
     scaleDuration      = 0;
 }
Exemplo n.º 3
0
 public void ColorTo(Color destination, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete)
 {
     colorInitial       = graphic ? graphic.color : spriteRenderer ? spriteRenderer.color : renderer.material.color;
     colorDisplacement  = destination - colorInitial;
     colorFunc          = Interpolate.Ease(easingFunction);
     colorOnComplete    = onComplete;
     colorDurationTotal = duration;
     colorDuration      = 0;
 }
Exemplo n.º 4
0
 public void MoveTo(Vector3 destination, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete, bool world)
 {
     positionWorld         = world;
     positionInitial       = positionWorld ? transform.position : transform.localPosition;
     positionDisplacement  = destination - positionInitial;
     positionFunc          = Interpolate.Ease(easingFunction);
     positionOnComplete    = onComplete;
     positionDurationTotal = duration;
     positionDuration      = 0;
 }
Exemplo n.º 5
0
    public static void ColorTo(GameObject obj, Color destination, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete = null)
    {
        Tweening tweening = obj.GetComponent <Tweening>();

        if (!tweening)
        {
            tweening = obj.AddComponent <Tweening>();
        }

        tweening.ColorTo(destination, duration, easingFunction, onComplete);
    }
Exemplo n.º 6
0
    public static void MoveTo(GameObject obj, Vector3 destination, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete = null, bool world = false)
    {
        Tweening tweening = obj.GetComponent <Tweening>();

        if (!tweening)
        {
            tweening = obj.AddComponent <Tweening>();
        }

        tweening.MoveTo(destination, duration, easingFunction, onComplete, world);
    }
Exemplo n.º 7
0
 /// <summary>
 /// 페이드 사운드.
 /// </summary>
 public void FadeTo(string soundName, float time, Interpolate.EaseType ease)
 {
     try
     {
         SoundList clip = (SoundList)Enum.Parse(typeof(SoundList), soundName);
         this.FadeTo(DataManager.SoundData().GetCopy((int)clip), time, ease);
     }
     catch (System.Exception ex)
     {
         Debug.LogError("Can not find Correct SoundClip, Please Check Sound Name At Editor:[" + soundName + "] / " + ex.Message.ToString());
     }
 }
Exemplo n.º 8
0
 /*public Banner(string text, Vector3 position, Interpolate.EaseType easeType, float startValue, float endValue, float duration)
 {
     this.text = text;
     this.position = position;
     this.easeType = easeType;
     this.startValue = startValue;
     this.endValue = endValue;
     this.duration = duration;
 }*/
 public Banner(string text, float fontSize, Vector3 position, float scale, Interpolate.EaseType easeType, float[] introAction, float[] outroAction, float delay, BannerColor color)
 {
     this.text = text;
     this.position = position;
     this.easeType = easeType;
     this.introAction = introAction;
     this.outroAction = outroAction;
     this.delay = delay;
     this.scale = scale;
     this.fontSize = fontSize;
     this.color = color;
 }
 //Interpolate.EaseType easeType 보간 곡선
 /// <summary>
 /// clip을 주어지는 time과 ease로 FadeIn
 /// </summary>
 public void FadeIn(SoundClip clip, float time, Interpolate.EaseType ease)
 {
     if (this.IsDifferentSound(clip)) //다른 사운드가 맞다면
     {
         fadeA_audio.Stop();
         fadeB_audio.Stop();
         this.lastSound    = this.currentSound;
         this.currentSound = clip;
         PlayAudioSource(fadeA_audio, currentSound, 0.0f);
         this.currentSound.FadeIn(time, ease);
         this.currentPlayingType = MusicPlayingType.SourceA;
         if (this.currentSound.HasLoop())
         {
             this.isTicking = true;
             DoCheck();
         }
     }
 }
Exemplo n.º 10
0
 public void FadeIn(SoundClip clip, float time, Interpolate.EaseType ease)
 {
     if (IsDifferentSound(clip) == true)
     {
         fadeA_audio.Stop();
         fadeB_audio.Stop();
         lastSound    = currentSound;
         currentSound = clip;
         PlayAudioSource(fadeA_audio, currentSound, 0.0f);
         currentSound.FadeIn(time, ease);
         currentPlayingType = MusicPlayingType.SourceA;
         if (currentSound.HasLoop() == true)
         {
             isTicking = true;
             DoCheck();
         }
     }
 }
    public void FadeTo(SoundClip clip, float time, Interpolate.EaseType ease)
    {
        if (currentPlayingType == MusicPlayingType.None)
        {
            FadeIn(clip, time, ease);
        }
        else if (this.IsDifferentSound(clip))
        {
            if (currentPlayingType == MusicPlayingType.AtoB)
            {
                fadeA_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceB;
            }
            else if (currentPlayingType == MusicPlayingType.BtoA)
            {
                fadeB_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceA;
            }

            lastSound    = currentSound;
            currentSound = clip;
            lastSound.FadeOut(time, ease);
            currentSound.FadeIn(time, ease);


            //FadeTo A->B, B->A 사운드 교체
            if (currentPlayingType == MusicPlayingType.SourceA)
            {
                PlayAudioSource(fadeB_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.AtoB;
            }
            else if (currentPlayingType == MusicPlayingType.SourceB)
            {
                PlayAudioSource(fadeA_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.BtoA;
            }

            if (currentSound.HasLoop())
            {
                isTicking = true;
                DoCheck();
            }
        }
    }
Exemplo n.º 12
0
        public void DrawInspector(float duration)
        {
            if (!String.IsNullOrEmpty(name))
            {
                Color defaultColor = GUI.color;
                GUI.color = color;
                EditorGUILayout.LabelField(name);
                GUI.color = defaultColor;
            }

            if (EditorGUILayout.BeginFadeGroup(advancedMode ? 0.0f : 1.0f))
            {
                easeType = (Interpolate.EaseType)EditorGUILayout.EnumPopup("Ease Type", easeType);

                EditorGUILayout.BeginHorizontal();
                startTime  = EditorGUILayout.FloatField("Start Time", startTime);
                startValue = EditorGUILayout.FloatField("Start Value", startValue);

                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                stopTime  = EditorGUILayout.FloatField("Stop Time", stopTime);
                stopValue = EditorGUILayout.FloatField("Stop Value", stopValue);
                EditorGUILayout.EndHorizontal();
            }

            if (EditorGUILayout.BeginFadeGroup(advancedMode ? 1.0f : 0.0f))
            {
                EditorGUILayout.BeginHorizontal();
                Curve = EditorGUILayout.CurveField(Curve, color, new Rect(0, yMin, duration, yMax - yMin), null);
                yMin  = EditorGUILayout.FloatField(yMin);
                yMax  = EditorGUILayout.FloatField(yMax);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndFadeGroup();

            if (GUILayout.Button(advancedMode ? "Simple" : "Advanced"))
            {
                advancedMode = !advancedMode;
            }
        }
Exemplo n.º 13
0
    public void FadeTo(SoundClip _clip, float _time, Interpolate.EaseType _ease)
    {
        if (currentPlayingType == MusicPlayingType.None)
        {
            FadeIn(_clip, _time, _ease);
        }
        else if (IsDifferentSound(_clip) == true)
        {
            if (currentPlayingType == MusicPlayingType.AtoB)
            {
                fadeA_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceB;
            }
            else if (currentPlayingType == MusicPlayingType.BtoA)
            {
                fadeB_audio.Stop();
                currentPlayingType = MusicPlayingType.SourceA;
            }

            //fade to
            lastSound    = currentSound;
            currentSound = _clip;
            lastSound.FadeOut(_time, _ease);
            currentSound.FadeIn(_time, _ease);
            if (currentPlayingType == MusicPlayingType.SourceA)
            {
                PlayAudioSource(fadeB_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.AtoB;
            }
            else if (currentPlayingType == MusicPlayingType.SourceB)
            {
                PlayAudioSource(fadeA_audio, currentSound, 0.0f);
                currentPlayingType = MusicPlayingType.BtoA;
            }
            if (currentSound.HasLoop())
            {
                isTicking = true;
                DoCheck();
            }
        }
    }
Exemplo n.º 14
0
    public void FadeTo(SoundClip clip, float time, Interpolate.EaseType ease)
    {
        if (this.currentPlayingType == MusicPlayingType.None)
        {
            this.FadeIn(clip, time, ease);
        }
        else if (this.IsDifferentSound(clip) == true)
        {
            if (this.currentPlayingType == MusicPlayingType.AtoB)
            {
                this.fadeA_audio.Stop();
                this.currentPlayingType = MusicPlayingType.SourceB;
            }
            else if (this.currentPlayingType == MusicPlayingType.BtoA)
            {
                this.fadeB_audio.Stop();
                this.currentPlayingType = MusicPlayingType.SourceA;
            }

            //fade to
            this.lastSound    = this.currentSound;
            this.currentSound = clip;
            this.lastSound.FadeOut(time, ease);
            this.currentSound.FadeIn(time, ease);
            if (this.currentPlayingType == MusicPlayingType.SourceA)
            {
                PlayAudioSource(fadeB_audio, this.currentSound, 0.0f);
                this.currentPlayingType = MusicPlayingType.AtoB;
            }
            else if (this.currentPlayingType == MusicPlayingType.SourceB)
            {
                PlayAudioSource(fadeA_audio, this.currentSound, 0.0f);
                this.currentPlayingType = MusicPlayingType.BtoA;
            }
            if (this.currentSound.HasLoop())
            {
                this.isTicking = true;
                DoCheck();
            }
        }
    }
Exemplo n.º 15
0
        public void GetPotential_ShouldCalculateCorrectPotential(
            float distance,
            float maxDistance,
            float sourcePotential,
            Interpolate.EaseType easeType,
            float expectedPotential)
        {
            var go         = this.CreateGameObject();
            var calculator = go.AddComponent <EaseDistancePotentialCalculator>();

            calculator.easeType    = easeType;
            calculator.maxDistance = maxDistance;

            var sourcePos = Vector3.zero;
            var samplePos = Vector3.forward * distance;

            var potential = calculator.GetPotential(samplePos, sourcePos, sourcePotential);

            GameObject.DestroyImmediate(go);

            Assert.That(potential, Is.EqualTo(expectedPotential));
        }
Exemplo n.º 16
0
 public void FadeIn(int index, float time, Interpolate.EaseType ease)
 {
     FadeIn(DataManager.SoundData.GetCopyClip(index), time, ease);
 }
Exemplo n.º 17
0
        public static IEnumerator FadeAudio(AudioSource audio, float duration, Fade fadeType, Interpolate.EaseType easeType = Interpolate.EaseType.EaseOutExpo)
        {
            float start        = fadeType == Fade.In ? 0.0f : 1.0f;
            float distance     = fadeType == Fade.In ? 1.0f : -1.0f;
            float t            = 0.0f;
            var   easeFunction = Interpolate.Ease(easeType);

            while (t <= duration)
            {
                audio.volume = easeFunction(start, distance, t, duration);
                t           += Time.deltaTime;
                yield return(null);
            }
        }
Exemplo n.º 18
0
 public void FadeIn(int index, float time, Interpolate.EaseType ease)
 {
     this.FadeIn(DataManager.Sound().GetCopy(index), time, ease);
 }
Exemplo n.º 19
0
    public void FadeTo(SoundClip m, float time, Interpolate.EaseType ease)
    {
        if (this.currentPlayingType == MusicPlayingType.None)
        {
            this.FadeIn(m, time, ease);
        }
        else if (this.CheckPlay(m))
        {
            if (this.currentPlayingType == MusicPlayingType.AtoB)
            {
                this.fadeA_audioSource.Stop();
                this.currentPlayingType = MusicPlayingType.SourceB;
            }
            else if (this.currentPlayingType == MusicPlayingType.BtoA)
            {
                this.fadeB_audioSource.Stop();
                this.currentPlayingType = MusicPlayingType.SourceA;
            }

            this.lastSound    = this.currentSound;
            this.currentSound = m;
            if (this.currentSound != null)
            {
                this.currentSound.PreLoad();
            }
            this.lastSound.FadeOut(time, ease);
            this.currentSound.FadeIn(time, ease);
            if (this.currentPlayingType == MusicPlayingType.SourceA)
            {
                this.fadeB_audioSource.clip         = this.currentSound.GetClip();
                this.fadeB_audioSource.volume       = 0.0f;
                this.fadeB_audioSource.loop         = this.currentSound.isLoop;
                this.fadeB_audioSource.pitch        = this.currentSound.pitch;
                this.fadeB_audioSource.dopplerLevel = this.currentSound.dopplerLevel;
                this.fadeB_audioSource.rolloffMode  = this.currentSound.rollOffMode;
                this.fadeB_audioSource.minDistance  = this.currentSound.minDistance;
                this.fadeB_audioSource.maxDistance  = this.currentSound.maxDistance;
                this.fadeB_audioSource.spatialBlend = this.currentSound.spatialBlend;
                this.fadeB_audioSource.Play();
                this.currentPlayingType = MusicPlayingType.AtoB;
            }
            else if (this.currentPlayingType == MusicPlayingType.SourceB)
            {
                this.fadeA_audioSource.clip         = this.currentSound.GetClip();
                this.fadeA_audioSource.volume       = 0.0f;
                this.fadeA_audioSource.loop         = this.currentSound.isLoop;
                this.fadeA_audioSource.pitch        = this.currentSound.pitch;
                this.fadeA_audioSource.dopplerLevel = this.currentSound.dopplerLevel;
                this.fadeA_audioSource.rolloffMode  = this.currentSound.rollOffMode;
                this.fadeA_audioSource.minDistance  = this.currentSound.minDistance;
                this.fadeA_audioSource.maxDistance  = this.currentSound.maxDistance;
                this.fadeA_audioSource.spatialBlend = this.currentSound.spatialBlend;
                this.fadeA_audioSource.Play();
                this.currentPlayingType = MusicPlayingType.BtoA;
            }
            if (this.currentSound.HasLoop())
            {
                this.isTicking = true;
                DoTick();
            }
        }
    }
Exemplo n.º 20
0
    public static void ScaleBy(GameObject obj, Vector3 displacement, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete = null)
    {
        Vector3 destination = obj.transform.localScale + displacement;

        ScaleTo(obj, destination, duration, easingFunction, onComplete);
    }
Exemplo n.º 21
0
        public static WeightedItem WeightByInterpolation(this WeightedItem item, Vector3 origin, float maxDist, float scale, Interpolate.EaseType easeType)
        {
            var easeFunc = Interpolate.Ease(easeType);
            var start    = 0f;
            var dist     = scale;
            var duration = maxDist;

            var elapsed    = Vector3.Distance(origin, item.Target.TargetPosition);
            var distWeight = scale - easeFunc(start, dist, elapsed, duration);

            var newItem = new WeightedItem(item);

            newItem.Weight += distWeight;

            return(newItem);
        }
Exemplo n.º 22
0
    // Token: 0x0600044D RID: 1101 RVA: 0x00022C30 File Offset: 0x00020E30
    public static Interpolate.Function Ease(Interpolate.EaseType type)
    {
        Interpolate.Function result = null;
        switch (type)
        {
        case Interpolate.EaseType.Linear:
            result = new Interpolate.Function(Interpolate.Linear);
            break;

        case Interpolate.EaseType.EaseInQuad:
            result = new Interpolate.Function(Interpolate.EaseInQuad);
            break;

        case Interpolate.EaseType.EaseOutQuad:
            result = new Interpolate.Function(Interpolate.EaseOutQuad);
            break;

        case Interpolate.EaseType.EaseInOutQuad:
            result = new Interpolate.Function(Interpolate.EaseInOutQuad);
            break;

        case Interpolate.EaseType.EaseInCubic:
            result = new Interpolate.Function(Interpolate.EaseInCubic);
            break;

        case Interpolate.EaseType.EaseOutCubic:
            result = new Interpolate.Function(Interpolate.EaseOutCubic);
            break;

        case Interpolate.EaseType.EaseInOutCubic:
            result = new Interpolate.Function(Interpolate.EaseInOutCubic);
            break;

        case Interpolate.EaseType.EaseInQuart:
            result = new Interpolate.Function(Interpolate.EaseInQuart);
            break;

        case Interpolate.EaseType.EaseOutQuart:
            result = new Interpolate.Function(Interpolate.EaseOutQuart);
            break;

        case Interpolate.EaseType.EaseInOutQuart:
            result = new Interpolate.Function(Interpolate.EaseInOutQuart);
            break;

        case Interpolate.EaseType.EaseInQuint:
            result = new Interpolate.Function(Interpolate.EaseInQuint);
            break;

        case Interpolate.EaseType.EaseOutQuint:
            result = new Interpolate.Function(Interpolate.EaseOutQuint);
            break;

        case Interpolate.EaseType.EaseInOutQuint:
            result = new Interpolate.Function(Interpolate.EaseInOutQuint);
            break;

        case Interpolate.EaseType.EaseInSine:
            result = new Interpolate.Function(Interpolate.EaseInSine);
            break;

        case Interpolate.EaseType.EaseOutSine:
            result = new Interpolate.Function(Interpolate.EaseOutSine);
            break;

        case Interpolate.EaseType.EaseInOutSine:
            result = new Interpolate.Function(Interpolate.EaseInOutSine);
            break;

        case Interpolate.EaseType.EaseInExpo:
            result = new Interpolate.Function(Interpolate.EaseInExpo);
            break;

        case Interpolate.EaseType.EaseOutExpo:
            result = new Interpolate.Function(Interpolate.EaseOutExpo);
            break;

        case Interpolate.EaseType.EaseInOutExpo:
            result = new Interpolate.Function(Interpolate.EaseInOutExpo);
            break;

        case Interpolate.EaseType.EaseInCirc:
            result = new Interpolate.Function(Interpolate.EaseInCirc);
            break;

        case Interpolate.EaseType.EaseOutCirc:
            result = new Interpolate.Function(Interpolate.EaseOutCirc);
            break;

        case Interpolate.EaseType.EaseInOutCirc:
            result = new Interpolate.Function(Interpolate.EaseInOutCirc);
            break;
        }
        return(result);
    }
 public void FadeTo(int index, float time, Interpolate.EaseType ease)
 {
     FadeTo(DataManager.SoundData().GetCopy(index), time, ease);
 }
Exemplo n.º 24
0
        public static IEnumerable <WeightedItem> WeightByInterpolation(this IEnumerable <WeightedItem> items, Vector3 origin, float maxDist, float scale, Interpolate.EaseType easeType)
        {
            var easeFunc = Interpolate.Ease(easeType);
            var start    = 0f;
            var dist     = scale;
            var duration = maxDist;

            foreach (var item in items)
            {
                var elapsed    = Vector3.Distance(origin, item.Target.TargetPosition);
                var distWeight = scale - easeFunc(start, dist, elapsed, duration);

                var newItem = new WeightedItem(item);
                newItem.Weight += distWeight;

                yield return(newItem);
            }
        }
Exemplo n.º 25
0
 public void FadeToStored(float time, Interpolate.EaseType type)
 {
     this.FadeTo(this.storedSound, time, type);
     this.SetTime(this.storedTime);
 }
Exemplo n.º 26
0
 public void FadeTo(int _index, float _time, Interpolate.EaseType _ease)
 {
     FadeTo(DataManager.Sound().GetCopy(_index), _time, _ease);
 }
Exemplo n.º 27
0
    public static void RotateBy(GameObject obj, Vector3 displacement, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete = null, bool world = false)
    {
        Vector3 destination = obj.transform.localRotation.eulerAngles + displacement;

        RotateTo(obj, destination, duration, easingFunction, onComplete, world);
    }