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> /// Do the drop effect. /// </summary> /// <param name="other"></param> private void DropEffect(Collider other) { // Throw Action Effect... { //JCS_ThrowAction ta = this.gameObject.AddComponent<JCS_ThrowAction>(); //ta.SetTargetTransform(other.transform); //ta.ActiveEffect(); } // Tweener Effect... { if (mTweener == null) { // default settings mTweener = this.gameObject.AddComponent <JCS_TransformTweener>(); mTweener.EasingY = JCS_TweenType.EASE_OUT_BACK; mTweener.DurationX = 2.0f; mTweener.DurationY = 5.0f; mTweener.DurationZ = 0; mTweener.StopTweenDistance = 0.2f; } mTweener.DoTweenContinue(other.transform); } if (mDestinationDestroy == null) { // default settings mDestinationDestroy = this.gameObject.AddComponent <JCS_DestinationDestroy>(); mDestinationDestroy.DestroyDistance = 0.5f; } mDestinationDestroy.SetTargetTransform(other.transform); }
private void DoPath() { GetNextPoint(); if (mContinueTween) { mTransformTweener.DoTweenContinue(mPoints[mTargetPointIndex]); } else { mTransformTweener.DoTween(mPoints[mTargetPointIndex].position); } }