@@ -24,7 +24,7 @@ public class JCS_ItemDroppable
2424 [ System . Serializable ]
2525 public struct ItemSet
2626 {
27- [ Tooltip ( "Possibilty droping this item, the higher the more possiblility" ) ]
27+ [ Tooltip ( "Possibilty droping this item, the higher the more possiblility. " ) ]
2828 [ Range ( 0.0f , 100.0f ) ]
2929 public float dropRate ;
3030
@@ -89,7 +89,7 @@ public struct ItemSet
8989
9090 [ Tooltip ( "Add this force to item." ) ]
9191 [ SerializeField ]
92- [ Range ( 0.01f , 5 .0f) ]
92+ [ Range ( 0.01f , 50 .0f) ]
9393 private float mRandomizeJumpForceForce = 0.0f ;
9494
9595 [ Header ( "- Rotate Effect " ) ]
@@ -100,6 +100,7 @@ public struct ItemSet
100100
101101 [ Tooltip ( "How fast the item rotates?" ) ]
102102 [ SerializeField ]
103+ [ Range ( - 5000.0f , 5000.0f ) ]
103104 private float mRotateSpeed = 1000.0f ;
104105
105106 [ Header ( "Spread Effect (JCS_ItemDroppable)" ) ]
@@ -110,25 +111,27 @@ public struct ItemSet
110111
111112 [ Tooltip ( "How far between a item to the item next to this item." ) ]
112113 [ SerializeField ]
113- [ Range ( 0.0f , 1 .0f) ]
114+ [ Range ( 0.0f , 300 .0f) ]
114115 private float mSpreadGap = 0.4f ;
115116
116- [ Tooltip ( "Did the effect include 3 dimensional? " ) ]
117+ [ Tooltip ( "Did the effect include 3 dimensional. " ) ]
117118 [ SerializeField ]
118119 private bool mIncludeDepth = false ;
119120
120121 [ Header ( "Destroy Effect (JCS_ItemDroppable)" ) ]
121122
122- [ Tooltip ( "Does the item fade out when is destroyed? " ) ]
123+ [ Tooltip ( "Does the item fade out when is destroyed. " ) ]
123124 [ SerializeField ]
124125 private bool mDestroyFadeOutEffect = true ;
125126
126- [ Tooltip ( "When does the item get destroyed? " ) ]
127+ [ Tooltip ( "When does the item get destroyed. " ) ]
127128 [ SerializeField ]
129+ [ Range ( 0.0f , 360.0f ) ]
128130 private float mDestroyTime = 30.0f ;
129131
130- [ Tooltip ( "How fast it fade out when get destroyed? " ) ]
132+ [ Tooltip ( "How fast it fade out when get destroyed. " ) ]
131133 [ SerializeField ]
134+ [ Range ( 0.0f , 30.0f ) ]
132135 private float mFadeTime = 1.0f ;
133136
134137 [ Header ( "Others (JCS_ItemDroppable)" ) ]
@@ -137,8 +140,8 @@ public struct ItemSet
137140 [ SerializeField ]
138141 private bool mConstWaveEffect = true ;
139142
140- [ Tooltip ( @"Do the item bounce back from the wall after hit
141- the wall or just stop there.") ]
143+ [ Tooltip ( @"Do the item bounce back from the wall after hit the wall or
144+ just stop there." ) ]
142145 [ SerializeField ]
143146 private bool mBounceBackfromWall = true ;
144147
@@ -281,10 +284,7 @@ public void DropItems(JCS_Item mustDropItem, int specIndex = -1, bool only = fal
281284 if ( specIndex < 0 || specIndex >= itemDrop )
282285 randDropIndex = JCS_Random . Range ( 0 , itemDrop ) ;
283286
284-
285- for ( index = 0 ;
286- index < itemDrop ;
287- ++ index )
287+ for ( index = 0 ; index < itemDrop ; ++ index )
288288 {
289289 JCS_Item item = null ;
290290
@@ -351,7 +351,7 @@ private void DropAnItem(
351351 bool waveEffect ,
352352 bool destroyFade )
353353 {
354- JCS_Item jcsi = ( JCS_Item ) JCS_Utility . SpawnGameObject (
354+ JCS_Item newItem = ( JCS_Item ) JCS_Utility . SpawnGameObject (
355355 item ,
356356 this . transform . position ,
357357 this . transform . rotation ) ;
@@ -360,13 +360,13 @@ private void DropAnItem(
360360
361361 if ( isGravity )
362362 {
363- JCS_OneJump jcsoj = jcsi . gameObject . AddComponent < JCS_OneJump > ( ) ;
363+ JCS_OneJump oj = newItem . gameObject . AddComponent < JCS_OneJump > ( ) ;
364364
365365 float gapDirection = mSpreadGap ;
366366 if ( isEvenIndex )
367367 gapDirection = - mSpreadGap ;
368368
369- jcsoj . BounceBackfromWall = BounceBackfromWall ;
369+ oj . BounceBackfromWall = BounceBackfromWall ;
370370
371371 float gapForce = 0 ;
372372
@@ -403,43 +403,55 @@ private void DropAnItem(
403403 jumpForce += JCS_Random . Range ( - mRandomizeJumpForceForce , mRandomizeJumpForceForce ) ;
404404 }
405405
406- jcsoj . DoForce ( gapForce , jumpForce , mIncludeDepth ) ;
406+ oj . DoForce ( gapForce , jumpForce , mIncludeDepth ) ;
407407
408408 if ( rotateDrop )
409409 {
410- JCS_ItemRotation jcsir = jcsi . gameObject . AddComponent < JCS_ItemRotation > ( ) ;
411- jcsir . RotateSpeed = mRotateSpeed ;
412- jcsir . Effect = true ;
410+ JCS_ItemRotation irx = newItem . gameObject . AddComponent < JCS_ItemRotation > ( ) ;
411+ irx . RotateSpeed = JCS_Random . Range ( - mRotateSpeed , mRotateSpeed ) ;
412+ irx . Effect = true ;
413+ irx . RotateDirection = JCS_Vector3Direction . FORWARD ;
413414
414415 // if z axis interact in game
415416 if ( mIncludeDepth )
416417 {
417- // add one more axis.
418- JCS_ItemRotation jcsir2 = jcsi . gameObject . AddComponent < JCS_ItemRotation > ( ) ;
419- jcsir2 . RotateSpeed = JCS_Random . Range ( - mRotateSpeed , mRotateSpeed ) ;
420- jcsir2 . Effect = true ;
421- jcsir2 . RotateDirection = JCS_Vector3Direction . UP ;
418+ // add rotation on y axis.
419+ JCS_ItemRotation iry = newItem . gameObject . AddComponent < JCS_ItemRotation > ( ) ;
420+ iry . RotateSpeed = JCS_Random . Range ( - mRotateSpeed , mRotateSpeed ) ;
421+ iry . Effect = true ;
422+ iry . RotateDirection = JCS_Vector3Direction . UP ;
423+
424+ // add rotation on z axis.
425+ JCS_ItemRotation irz = newItem . gameObject . AddComponent < JCS_ItemRotation > ( ) ;
426+ irz . RotateSpeed = JCS_Random . Range ( - mRotateSpeed , mRotateSpeed ) ;
427+ irz . Effect = true ;
428+ irz . RotateDirection = JCS_Vector3Direction . RIGHT ;
422429 }
423430 }
424431 }
425432
426433 if ( waveEffect )
427434 {
428- JCS_3DConstWaveEffect jcscw = jcsi . gameObject . AddComponent < JCS_3DConstWaveEffect > ( ) ;
429- jcscw . Effect = true ;
435+ JCS_3DConstWaveEffect cwe = newItem . gameObject . AddComponent < JCS_3DConstWaveEffect > ( ) ;
436+ cwe . SetObjectType ( newItem . GetObjectType ( ) ) ;
437+ cwe . Effect = true ;
430438 }
431439
432440 if ( destroyFade )
433441 {
434- JCS_DestroyObjectWithTime jcsao = jcsi . gameObject . AddComponent < JCS_DestroyObjectWithTime > ( ) ;
435- jcsao . FadeTime = mFadeTime ;
436- jcsao . DestroyTime = mDestroyTime ;
442+ JCS_DestroyObjectWithTime dowt = newItem . gameObject . AddComponent < JCS_DestroyObjectWithTime > ( ) ;
443+ dowt . FadeTime = mFadeTime ;
444+ dowt . DestroyTime = mDestroyTime ;
437445
438- // set the object type the same.
439- JCS_FadeObject fo = jcsao . GetFadeObject ( ) ;
446+ Renderer [ ] renderers = newItem . GetComponentsInChildren < Renderer > ( ) ;
440447
441- if ( fo )
448+ foreach ( Renderer rdr in renderers )
442449 {
450+ JCS_FadeObject fo = rdr . gameObject . AddComponent < JCS_FadeObject > ( ) ;
451+
452+ dowt . FadeObjects . Add ( fo ) ;
453+
454+ // set the object type the same.
443455 fo . SetObjectType ( item . GetObjectType ( ) ) ;
444456 fo . UpdateUnityData ( ) ;
445457 }
0 commit comments