/// <summary> /// Perform movement of "wheel" of letters to find, and change the position to a "next one". /// </summary> /// <param name="_dropArea"></param> /// <param name="_position"></param> /// <param name="_callback"></param> void positionigAreaDropElement(DropSingleArea _dropArea, DropAreaPositions _position, TweenCallback _callback = null) { float durantion = 0.4f; Sequence _sequence = DOTween.Sequence(); bool needFade = false; if (_position == DropAreaPositions.CompletedPos) { needFade = true; } // - Actual elimination _dropArea.transform.DOLocalRotate(getRotation(_position), durantion); _sequence.Append(_dropArea.transform.DOLocalMove(getPosition(_position), durantion)).OnComplete(delegate() { if (needFade) { _sequence.Append(_dropArea.GetComponent <MeshRenderer>().materials[0].DOFade(0, durantion)); _sequence.Append(_dropArea.LetterLable.transform.DOLocalMove(new Vector3(getPosition(_position).x, -2, getPosition(_position).z), durantion)); // pro only // sequence.Append(Aree[actualAreaIndex].LetterLable.DOFade(0, 0.4f)); //if (_dropArea.DrawSprite) // _dropArea.DrawSprite.DOFade(0, 0.4f); if (_dropArea.DrawText) { _dropArea.DrawText.DOFade(0, 0.4f); } } if (_callback != null) { _callback(); } }); }
/// <summary> /// Return right position. /// </summary> /// <param name="_position"></param> /// <returns></returns> Vector3 getRotation(DropAreaPositions _position) { switch (_position) { case DropAreaPositions.ActivePos: return(new Vector3(90, 0, 0)); case DropAreaPositions.NextPos: return(new Vector3(90, -30, 0)); case DropAreaPositions.NextsPos: return(new Vector3(90, -30, 30)); case DropAreaPositions.CompletedPos: return(new Vector3(90, 0, 0)); default: Debug.LogError("Position not found"); break; } return(new Vector3(0, -10, 0)); // underground... }
/// <summary> /// Return right position. /// </summary> /// <param name="_position"></param> /// <returns></returns> Vector3 getPosition(DropAreaPositions _position) { switch (_position) { case DropAreaPositions.ActivePos: return(new Vector3(0, 0.1f, 0)); case DropAreaPositions.NextPos: return(new Vector3(-6, 0.1f, -1.5f)); case DropAreaPositions.NextsPos: return(new Vector3(-12, 0.1f, -6)); case DropAreaPositions.CompletedPos: return(new Vector3(6, 0.1f, 0)); default: Debug.LogError("Position not found"); break; } return(new Vector3(0, -10, 0)); // underground... }
/// <summary> /// Return right position. /// </summary> /// <param name="_position"></param> /// <returns></returns> Vector3 getRotation(DropAreaPositions _position) { int arrivalDir = 1; // Always arrive from the left, regardless of RTL switch (_position) { case DropAreaPositions.ActivePos: return(new Vector3(90, 0, 0)); case DropAreaPositions.NextPos: return(new Vector3(90, -30 * arrivalDir, 0)); case DropAreaPositions.NextsPos: return(new Vector3(90, -30 * arrivalDir, 30)); case DropAreaPositions.CompletedPos: return(new Vector3(90, 0, 0)); default: Debug.LogError("Position not found"); break; } return(new Vector3(0, -10, 0)); // underground... }