/// <returns>Transformed (real) bounds translated and scaled by local trasnform.</returns> public virtual Rect GetTransformedBounds() { UpdatePivotPoint(); var bounds = GetBounds(); bounds = MadMath.Scale(bounds, transform.localScale); bounds = MadMath.Translate(bounds, transform.localPosition); return(bounds); }
private bool Collides(MadLevelIcon icon, List <MadLevelIcon> iconList) { var b1 = icon.GetTransformedBounds(); foreach (var i in iconList) { var b2 = i.GetTransformedBounds(); if (MadMath.Overlaps(b1, b2)) { return(true); } } return(false); }
public void MoveToLocal(Vector2 position, MadiTween.EaseType easeType, float time) { if (time == 0) { cameraPos = MadMath.ClosestPoint(dragBounds, position); moveAnim = false; } else { moveAnimStartPosition = cachedCamPos; moveAnimEndPosition = position; moveAnimStartTime = Time.time; moveAnimDuration = time; moveAnimEaseType = easeType; moveAnim = true; } }
protected string GetEnumerationValue(int index) { switch (enumerationType) { case LevelsEnumerationType.Numbers: return((index + 1 + enumerationOffset).ToString()); case LevelsEnumerationType.Letters: return(EnumerationLetter(index + Mathf.Max(enumerationOffset, 0))); case LevelsEnumerationType.LettersLower: return(EnumerationLetter(index + Mathf.Max(enumerationOffset, 0)).ToLower()); case LevelsEnumerationType.Roman: return(MadMath.ToRoman(index + 1 + Mathf.Max(enumerationOffset, 0))); default: throw new ArgumentOutOfRangeException(); } }
void UpdateMoving() { if (!moveAnim) { return; } if (moveAnimStartTime + moveAnimDuration > Time.time) { float percentage = (Time.time - moveAnimStartTime) / moveAnimDuration; cachedCamPos = Ease(moveAnimEaseType, moveAnimStartPosition, moveAnimEndPosition, percentage); } else { cachedCamPos = moveAnimEndPosition; moveAnim = false; } cachedCamPos = MadMath.ClosestPoint(dragArea, cachedCamPos); }