public float GetPotential(Vector3 samplePos, Vector3 sourcePos, float sourcePotential) { if (sourcePotential == 0f) { return(0f); } if (maxDistance == 0f) { return(sourcePotential); } if (easeFunc == null) { easeFunc = Interpolate.Ease(this.easeType); } // start, distance, elapsed, duration. var potential = easeFunc( 0f, Mathf.Abs(sourcePotential), maxDistance - Mathf.Min(Vector3.Distance(sourcePos, samplePos), maxDistance), maxDistance); return(potential * Mathf.Sign(sourcePotential)); }
public void RotateTo(Vector3 destination, float duration, Interpolate.EaseType easingFunction, Action <GameObject> onComplete, bool world) { rotationWorld = world; rotationInitial = rotationWorld ? transform.rotation.eulerAngles : transform.localRotation.eulerAngles; rotationDisplacement = destination - rotationInitial; var rotX = rotationDisplacement.x; // check the other way around the circle var rotY = rotationDisplacement.y; // for each component var rotZ = rotationDisplacement.z; var rotX2 = (rotationDisplacement.x + 360) % 360; var rotY2 = (rotationDisplacement.y + 360) % 360; var rotZ2 = (rotationDisplacement.z + 360) % 360; if (Mathf.Abs(rotX2) < Mathf.Abs(rotX)) { rotX = rotX2; } if (Mathf.Abs(rotY2) < Mathf.Abs(rotY)) { rotY = rotY2; } if (Mathf.Abs(rotZ2) < Mathf.Abs(rotZ)) { rotZ = rotZ2; } rotationDisplacement = new Vector3(rotX, rotY, rotZ); rotationFunc = Interpolate.Ease(easingFunction); rotationOnComplete = onComplete; rotationDurationTotal = duration; rotationDuration = 0; }
// Token: 0x0600044C RID: 1100 RVA: 0x00022BCC File Offset: 0x00020DCC private static Vector3 Ease(Interpolate.Function ease, Vector3 start, Vector3 distance, float elapsedTime, float duration) { start.x = ease(start.x, distance.x, elapsedTime, duration); start.y = ease(start.y, distance.y, elapsedTime, duration); start.z = ease(start.z, distance.z, elapsedTime, duration); return(start); }
void OnObjectMoved( FieldObject obj ) { if( obj.collider.tag == "Player" ) { camScript = obj.collider.GetComponent<IsometricCamera>(); if( null == camScript ) { Debug.LogError( "Could not find 'IsometricCamera' component attached to object tagged 'Player'" ); return; } EaseFn = Interpolate.Ease( EaseType ); if( null == EaseFn ) { Debug.LogError( "Failed to retrieve Ease function for EaseType '" + EaseType.ToString() + "'" ); return; } camScript.Distance = EaseFn( DistanceA, DistanceB-DistanceA, obj.percent, 1.0f ); camScript.Offset = Interpolate.Ease(EaseFn, OffsetA, OffsetB-OffsetA, obj.percent, 1.0f ); camScript.Rotation = Interpolate.Ease(EaseFn, RotationA, RotationB-RotationA, obj.percent, 1.0f ); } }
/// <summary> /// 페이드 아웃. /// </summary> public void FadeOut(float time, Interpolate.EaseType easeType) { this.isFadeIn = false; this.fadeTime1 = 0.0f; this.fadeTime2 = time; this.interpolate_Func = Interpolate.Ease(easeType); this.isFadeOut = true; }
public void FadeOut(float _time, Interpolate.EaseType _easyType) { isFadeOut = true; isFadeIn = false; fadeTime1 = 0.0f; fadeTime2 = _time; interPolateFunction = Interpolate.Ease(_easyType); }
public void FadeIn(float time, Interpolate.EaseType easeType) { isFadeOut = false; fadeTime1 = 0.0f; fadeTime2 = time; interpolate_Func = Interpolate.Ease(easeType); isFadeIn = true; }
//fadfeOut 기능 public void FadeOut(float time, Interpolate.EaseType easeType) { this.IsFadeOut = true; this.IsFadeIn = false; this.FadeTime1 = 0.0f; this.FadeTime2 = time; this.InterpolateFunction = Interpolate.Ease(easeType); }
public void ColorTo(Color destination, float duration, Interpolate.EaseType easingFunction) { colorInitial = GetComponent<Renderer>().material.color; colorDisplacement = destination - colorInitial; colorFunc = Interpolate.Ease(easingFunction); colorDurationTotal = duration; colorDuration = 0; }
void Awake() { climbing = Interpolate.Ease(easeClimbing); falling = Interpolate.Ease(easeFalling); teleporting = Interpolate.Ease(easeTeleporting); bumping = Interpolate.Ease(easeBumping); fade = Interpolate.Ease(easefade); }
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; }
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; }
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; }
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; }
private void ChooseLevel() { moveStart = Time.time; ease = Interpolate.Ease(Interpolate.EaseType.EaseInCubic); moveStartPos = current.transform.position; moveTargetPos = GetInsidePoint(current); loadWhenMoved = true; EnableInput = false; AudioSource.PlayClipAtPoint(soundChoose, transform.position); }
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; }
/// <summary> /// occasionally walks in the specified direction /// </summary> /// <returns></returns> IEnumerator Walk() { while(true) { travelDelta = walkDir; travelBase = transform.position; travelStart = Time.time; travelDuration = 1 / moveSpeed; travelEase = moveEase; yield return new WaitForSeconds(timeBetweenWalks); } }
// Token: 0x06000453 RID: 1107 RVA: 0x00022EFC File Offset: 0x000210FC private static Vector3 Bezier(Interpolate.Function ease, Vector3[] points, float elapsedTime, float duration) { for (int i = points.Length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { points[j].x = ease(points[j].x, points[j + 1].x - points[j].x, elapsedTime, duration); points[j].y = ease(points[j].y, points[j + 1].y - points[j].y, elapsedTime, duration); points[j].z = ease(points[j].z, points[j + 1].z - points[j].z, elapsedTime, duration); } } return(points[0]); }
public void Pushed(Vector3 delta) { if(!IsValidMovementDir(delta)) { Debug.LogError("Got pushed invalid! Shouldn't happen!"); return; } travelDelta = delta; travelBase = transform.position; travelStart = Time.time; travelDuration = 1 / moveSpeed; travelEase = moveEase; AudioSource.PlayClipAtPoint(pushedSound, Camera.main.transform.position); }
// Token: 0x0600044B RID: 1099 RVA: 0x00022B9D File Offset: 0x00020D9D private static IEnumerator NewEase(Interpolate.Function ease, Vector3 start, Vector3 end, float total, IEnumerable <float> driver) { Vector3 distance = end - start; foreach (float elapsedTime in driver) { yield return(Interpolate.Ease(ease, start, distance, elapsedTime, total)); } IEnumerator <float> enumerator = null; yield break; yield break; }
// Token: 0x06000452 RID: 1106 RVA: 0x00022ECC File Offset: 0x000210CC private static IEnumerable <Vector3> NewBezier <T>(Interpolate.Function ease, IList nodes, Interpolate.ToVector3 <T> toVector3, float maxStep, IEnumerable <float> steps) { if (nodes.Count >= 2) { Vector3[] points = new Vector3[nodes.Count]; foreach (float elapsedTime in steps) { for (int i = 0; i < nodes.Count; i++) { points[i] = toVector3((T)((object)nodes[i])); } yield return(Interpolate.Bezier(ease, points, elapsedTime, maxStep)); } IEnumerator <float> enumerator = null; points = null; } yield break; yield break; }
public void RotateTo(Vector3 destination, float duration, Interpolate.EaseType easingFunction, Action<GameObject> onComplete, bool world) { rotationWorld = world; rotationInitial = rotationWorld ? transform.rotation.eulerAngles : transform.localRotation.eulerAngles; rotationDisplacement = destination - rotationInitial; var rotX = rotationDisplacement.x; // check the other way around the circle var rotY = rotationDisplacement.y; // for each component var rotZ = rotationDisplacement.z; var rotX2 = (rotationDisplacement.x + 360) % 360; var rotY2 = (rotationDisplacement.y + 360) % 360; var rotZ2 = (rotationDisplacement.z + 360) % 360; if (Mathf.Abs(rotX2) < Mathf.Abs(rotX)) rotX = rotX2; if (Mathf.Abs(rotY2) < Mathf.Abs(rotY)) rotY = rotY2; if (Mathf.Abs(rotZ2) < Mathf.Abs(rotZ)) rotZ = rotZ2; rotationDisplacement = new Vector3(rotX, rotY, rotZ); rotationFunc = Interpolate.Ease(easingFunction); rotationOnComplete = onComplete; rotationDurationTotal = duration; rotationDuration = 0; }
// Update is called once per frame void Update() { if( Duration == 0.0f ) Duration = float.MinValue; EaseFn = Interpolate.Ease( EaseType ); // Negate the previous offset this.transform.position -= PreviousOffset; // Increment time based on our animation direction if( AnimatingUp ) ElapsedTime += Time.deltaTime; else ElapsedTime -= Time.deltaTime; // Flip our animation direction if the duration is exceeded if( ElapsedTime >= Duration ) { ElapsedTime = Duration; AnimatingUp = false; } else if( ElapsedTime <= 0.0f ) { ElapsedTime = 0.0f; AnimatingUp = true; } // Interpolate by a magnitude in the direction of the offset, // with the maximum being the magnitude of the given offset amount float maxOffsetMag = MaxOffset.magnitude; float curOffsetMag = EaseFn( 0.0f, maxOffsetMag, ElapsedTime, Duration ); // Apply the interpolated offset as a magnitude to the offset normal Vector3 offsetNormal = (MaxOffset - Vector3.zero).normalized; PreviousOffset = offsetNormal * curOffsetMag; transform.position += PreviousOffset; }
private Vector3 findPointInPathAtZ(Interpolate.Function ease, Vector3[] points, int slide, float z) { Vector3 pointBefore = Vector3.zero; Vector3 pointAfter = Vector3.zero; List <Vector3> temp = new List <Vector3>(); IEnumerator <Vector3> nodes = Interpolate.NewBezier(ease, points, slide).GetEnumerator(); // tao ra path gom cac diem while (nodes.MoveNext()) // lay cac diem cua path ra { temp.Add(nodes.Current); } for (int i = 0; i < temp.Count; ++i) // tiem diem truoc' va sau diem hang rao { if (temp[i].z < z) { pointBefore = temp[i]; pointAfter = temp[i - 1]; break; } } return(Vector3.Lerp(pointBefore, pointAfter, (z - pointBefore.z) / (pointAfter.z - pointBefore.z))); }
public void ColorTo(Color destination, float duration, Interpolate.EaseType easingFunction, Action<GameObject> onComplete) { colorInitial = renderer.material.color; colorDisplacement = destination - colorInitial; colorFunc = Interpolate.Ease(easingFunction); colorOnComplete = onComplete; colorDurationTotal = duration; colorDuration = 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); }
void Start() { board = GameObject.Find("Board").GetComponent<MatchBoard>(); ease = Interpolate.Ease(Interpolate.EaseType.EaseOutCubic); // choose a random square type System.Array types = System.Enum.GetValues(typeof(TileType)); type = (TileType)types.GetValue(Random.Range(1, types.Length)); detail = TileDetail.Get(type); UpdateName(); Material mat = GetComponentInChildren<MeshRenderer>().material; //mat.color = colors[(int)type - 1]; //mat.mainTexture = textures[(int)type - 1]; mat.mainTexture = detail.texture; }
private void InitMovement() { /// Performs initial movement (zooming out of level) MoveToLevel(current); moveStart = Time.time; ease = Interpolate.Ease(Interpolate.EaseType.EaseOutCubic); moveStartPos = GetInsidePoint(current); moveTargetPos = current.transform.position; }
// Token: 0x0600044A RID: 1098 RVA: 0x00022B78 File Offset: 0x00020D78 public static IEnumerator NewEase(Interpolate.Function ease, Vector3 start, Vector3 end, int slices) { IEnumerable <float> driver = Interpolate.NewCounter(0, slices + 1, 1); return(Interpolate.NewEase(ease, start, end, (float)(slices + 1), driver)); }
// Use this for initialization void Start() { zoomInOut = Interpolate.Ease(Interpolate.EaseType.EaseInCirc); zoomElapsedTime = 0; zoomBegin = 0; zoomDistance = 0; charController = this.GetComponent<CharacterController>(); tools = this.GetComponentInChildren<PlayerTools>(); footstepSound = this.GetComponent<AudioSource>(); }
public void MoveTo(Vector3 destination, float duration, Interpolate.EaseType easingFunction) { positionInitial = transform.localPosition; positionDisplacement = destination - positionInitial; positionFunc = Interpolate.Ease(easingFunction); positionDurationTotal = duration; positionDuration = 0; }
// Token: 0x06000451 RID: 1105 RVA: 0x00022E9C File Offset: 0x0002109C public static IEnumerable <Vector3> NewBezier(Interpolate.Function ease, Vector3[] points, int slices) { IEnumerable <float> steps = Interpolate.NewCounter(0, slices + 1, 1); return(Interpolate.NewBezier <Vector3>(ease, points, new Interpolate.ToVector3 <Vector3>(Interpolate.Identity), (float)(slices + 1), steps)); }
// Token: 0x06000450 RID: 1104 RVA: 0x00022E70 File Offset: 0x00021070 public static IEnumerable <Vector3> NewBezier(Interpolate.Function ease, Vector3[] points, float duration) { IEnumerable <float> steps = Interpolate.NewTimer(duration); return(Interpolate.NewBezier <Vector3>(ease, points, new Interpolate.ToVector3 <Vector3>(Interpolate.Identity), duration, steps)); }
// Token: 0x0600044F RID: 1103 RVA: 0x00022E40 File Offset: 0x00021040 public static IEnumerable <Vector3> NewBezier(Interpolate.Function ease, Transform[] nodes, int slices) { IEnumerable <float> steps = Interpolate.NewCounter(0, slices + 1, 1); return(Interpolate.NewBezier <Transform>(ease, nodes, new Interpolate.ToVector3 <Transform>(Interpolate.TransformDotPosition), (float)(slices + 1), steps)); }
// Token: 0x0600044E RID: 1102 RVA: 0x00022E14 File Offset: 0x00021014 public static IEnumerable <Vector3> NewBezier(Interpolate.Function ease, Transform[] nodes, float duration) { IEnumerable <float> steps = Interpolate.NewTimer(duration); return(Interpolate.NewBezier <Transform>(ease, nodes, new Interpolate.ToVector3 <Transform>(Interpolate.TransformDotPosition), duration, steps)); }
// -------- // MonoBehaviour methods // -------- void Start() { this.rectTransform = this.GetComponent<RectTransform>(); this.spriteRenderer = this.GetComponent<SpriteRenderer>(); this.interpolationFunction = Interpolate.Ease(mode); this.beginningStateIndex = this.currentStateIndex; }
void Awake() { ease = Interpolate.Ease(easeType); }
// public int maxTriggers; // int triggerCounter = 0; void Awake() { ease = Interpolate.Ease(baseSettings.easeType); }
// Token: 0x06000449 RID: 1097 RVA: 0x00022B58 File Offset: 0x00020D58 public static IEnumerator NewEase(Interpolate.Function ease, Vector3 start, Vector3 end, float duration) { IEnumerable <float> driver = Interpolate.NewTimer(duration); return(Interpolate.NewEase(ease, start, end, duration, driver)); }
// Update is called once per frame void Update() { if( !m_Active ) return; if( !light.enabled ) light.enabled = true; if( !strobeLight.enabled ) strobeLight.enabled = true; if( ascending ) elapsedTime += Time.deltaTime; else elapsedTime += -Time.deltaTime; elapsedTime = Mathf.Clamp( elapsedTime, 0.0f, m_Duration ); if( elapsedTime >= m_Duration && ascending ) { if( m_InterpolationType == InterpType.Ascending ) { elapsedTime = 0.0f; HandleLoopEnd(); } else { ascending = false; } } else if( elapsedTime <= 0.0f && !ascending ) { if( m_InterpolationType == InterpType.Descending ) elapsedTime = m_Duration; else ascending = true; HandleLoopEnd(); } EaseFn = Interpolate.Ease( EaseType ); strobeLight.m_TimeScale = EaseFn( m_TimeScaleMin, m_TimeScaleMax - m_TimeScaleMin, elapsedTime, m_Duration ); strobeLight.m_FlickerRate = EaseFn( m_FlickerRateMin, m_FlickerRateMax - m_FlickerRateMin, elapsedTime, m_Duration ); strobeLight.m_OnOffRatio = EaseFn( m_OnOffRatioMin, m_OnOffRatioMax - m_OnOffRatioMin, elapsedTime, m_Duration ); }
private void MoveToLevel(Level newLevel) { moveStartPos = current.transform.position; moveTargetPos = newLevel.transform.position; moveStart = Time.time; ease = Interpolate.Ease(Interpolate.EaseType.EaseOutCirc); if(current != null) { current.Unselected(); } current = newLevel; current.Selected(); AudioSource.PlayClipAtPoint(soundMove, transform.position); }