예제 #1
0
파일: Perlin.cs 프로젝트: Zoxive/TrueCraft
 public Perlin()
 {
     this.Seed = new Random().Next();
     this.Octaves = 2;
     this.Amplitude = 2;
     this.Persistance = 1;
     this.Frequency = 1;
     this.Lacunarity = 2;
     this.Interpolation = InterpolateType.COSINE;
 }
예제 #2
0
 public static double Interpolate(double pointA, double pointB, double t, InterpolateType type)
 {
     switch (type)
     {
         //TODO: Incorporate Cubic Interpolation
         case InterpolateType.COSINE:
             return CosineInterpolate(pointA, pointB, t);
         case InterpolateType.LINEAR:
             return LinearInterpolate(pointA, pointB, t);
         default:
             return LinearInterpolate(pointA, pointB, t);
     }
 }
예제 #3
0
        private static IEnumerator ChangeRoundingResolutionOnCorner(QuickPolygon shape, int cornerID, float endValue, InterpolateType interpolateType, float duration)
        {
            if (shape.Shape.roundings.Length > cornerID)
            {
                float startValue  = shape.GetRoundingResolution(cornerID);
                float timeElapsed = 0;
                while (timeElapsed < duration)
                {
                    float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration);
                    shape.SetRoundingResolution(cornerID, newvalue, true);
                    yield return(new WaitForEndOfFrame());

                    timeElapsed += Time.deltaTime;
                }
                shape.SetRoundingResolution(cornerID, endValue, true);
            }
            else
            {
                Debug.LogError(MSG.Errors.WRONG_ROUNDING_CORNER);
            }
        }
예제 #4
0
        private static IEnumerator ChangeUniformRoundingResolution(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration)
        {
            float startValue  = shape.GetUniformRoundingResolution();
            float timeElapsed = 0;

            while (timeElapsed < duration)
            {
                float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration);
                shape.SetUniformRoundingResolution(newvalue, true);
                yield return(new WaitForEndOfFrame());

                timeElapsed += Time.deltaTime;
            }
            shape.SetUniformRoundingResolution(endValue, true);
        }
예제 #5
0
 public static void PlayChangeUniformScaleAnimation(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration)
 {
     activeAnimation = shape.StartCoroutine(ChangeUniformScale(shape, endValue, interpolateType, duration));
 }
예제 #6
0
        private static IEnumerator ChangeScale(QuickPolygon shape, float endWidth, float endHeight, InterpolateType interpolateType, float duration)
        {
            float startW      = shape.GetWidth();
            float startH      = shape.GetHeight();
            float timeElapsed = 0;

            while (timeElapsed < duration)
            {
                float newW = GetInterpolate(interpolateType, startW, endWidth, timeElapsed, duration);
                float newH = GetInterpolate(interpolateType, startH, endHeight, timeElapsed, duration);
                shape.SetScale(newW, newH, true);
                yield return(new WaitForEndOfFrame());

                timeElapsed += Time.deltaTime;
            }
            shape.SetScale(endWidth, endHeight, true);
        }
예제 #7
0
        private static IEnumerator ChangeDiamondMiddleHeight(QuickPolygon shape, float endValue, InterpolateType interpolateType, float duration)
        {
            float startValue  = shape.GetDiamondMiddleHeight();
            float timeElapsed = 0;

            while (timeElapsed < duration)
            {
                float newvalue = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration);
                shape.SetDiamondMiddleHeight(newvalue, true);
                yield return(new WaitForEndOfFrame());

                timeElapsed += Time.deltaTime;
            }
            shape.SetDiamondMiddleHeight(endValue, true);
        }
예제 #8
0
 public static void PlayChangeScaleAnimation(QuickPolygon shape, float endWidth, float endHeight, InterpolateType interpolateType, float duration)
 {
     activeAnimation = shape.StartCoroutine(ChangeScale(shape, endWidth, endHeight, interpolateType, duration));
 }
예제 #9
0
 public static Vector2 Vector2(InterpolateType interpolateType, Vector2 from, Vector2 to, float weight)
 {
     return(new Vector2(
                Slerpy.Interpolate.LinearWithType(interpolateType, from.x, to.x, weight),
                Slerpy.Interpolate.LinearWithType(interpolateType, from.y, to.y, weight)));
 }