//======================================== // Self-Define //------------------------------ //---------------------- // Public Functions /// <summary> /// Start sliding the screen in the scene. /// </summary> /// <param name="align"> align type </param> public void StartSlideIn(JCS_Align align, float time) { mTweener.DurationX = time; mTweener.DurationY = time; mTweener.DurationZ = time; // tween back to where we are. mTweener.DoTween(mStartingPosition); }
private void OnEnable() { if (mTargetTransform == null) { JCS_Debug.LogError( "Cannot set the calculate circle position with null target transform..."); return; } // on enable set the random position // with in the circle range. // get the position. Vector3 newPos = CalculateCirclePosition(); // set to the position. if (mReverseDirection) { // set the target transform. this.mDisableWidthCertainRangeEvent.SetTargetTransfrom(null); this.mDisableWidthCertainRangeEvent.TargetPosition = newPos; // starting position. SetPosition(this.mTargetTransform.position); } else { // set the target transform. this.mJCSTweener.SetTargetTransform(this.mTargetTransform); this.mDisableWidthCertainRangeEvent.SetTargetTransfrom(this.mTargetTransform); // starting position. SetPosition(newPos); } mJCSTweener.UpdateUnityData(); // reset alpha change. mJCSTweener.LocalAlpha = 1.0f; // enable the sprite renderer component. mJCSTweener.LocalEnabled = true; // reset tweener mJCSTweener.ResetTweener(); // update the unity data first. if (mReverseDirection) { /* * Reverse could only use DoTween, cannot * use DoTweenContinue. */ mJCSTweener.DoTween(newPos); } else { mJCSTweener.DoTweenContinue(this.mTargetTransform); } }
/// <summary> /// After a cetain time we target a new vector value to do /// tweener effect. /// </summary> private void TargetNewVectorValue() { // Do nothing if not done tweening. //if (!mTransformTweener.IsDoneTweening) // return; Vector3 newVal = mTransformTweener.GetSelfTransformTypeVector3(); // x if (!mFreeze.check1) { newVal.x = JCS_Random.Range(mMinVectorRange.x, mMaxVectorRange.x); } // y if (!mFreeze.check2) { newVal.y = JCS_Random.Range(mMinVectorRange.y, mMaxVectorRange.y); } // z if (!mFreeze.check3) { newVal.z = JCS_Random.Range(mMinVectorRange.z, mMaxVectorRange.z); } mTransformTweener.DoTween(newVal); #if (UNITY_EDITOR) targetValue = newVal; #endif }
//======================================== // Self-Define //------------------------------ //---------------------- // Public Functions /// <summary> /// Tween to the taget position and play sound effect /// </summary> public void Active() { if (!mTransformTweener.IsDoneTweening) { return; } if (this.transform.localPosition == mTargetPosition) { return; } mTransformTweener.DoTween(mTargetPosition); mSoundPlayer.PlayOneShotWhileNotPlaying(mActiveSound); if (mActiveCallbackFunc != null) { mActiveCallbackFunc.Invoke(); } this.mIsActive = true; }
private void DoPath() { GetNextPoint(); if (mContinueTween) { mTransformTweener.DoTweenContinue(mPoints[mTargetPointIndex]); } else { mTransformTweener.DoTween(mPoints[mTargetPointIndex].position); } }