Skip to content

Commit 20c92cb

Browse files
committed
Update core.
1 parent 2a449b6 commit 20c92cb

File tree

9 files changed

+87
-89
lines changed

9 files changed

+87
-89
lines changed

Assets/JCSUnity/Scripts/Effects/3D/JCS_3DConstWaveEffect.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public class JCS_3DConstWaveEffect
4848
[SerializeField]
4949
private JCS_Axis mAxis = JCS_Axis.AXIS_Y;
5050

51-
5251
[Header("- Randomize Setting (JCS_3DConstWaveEffect)")]
5352

5453
[Tooltip("Randomize a bit the amplitude value at start.")]
@@ -61,7 +60,6 @@ public class JCS_3DConstWaveEffect
6160
[Range(0.0f, 100.0f)]
6261
private float mRandomizeFrequencyAtStart = 0.0f;
6362

64-
6563
/* Setter & Getter */
6664

6765
public bool Effect { get { return this.mEffect; } set { this.mEffect = value; } }
@@ -74,7 +72,6 @@ public class JCS_3DConstWaveEffect
7472
public float RandomizeAmplitudeAtStart { get { return this.mRandomizeAmplitudeAtStart; } set { this.mRandomizeAmplitudeAtStart = value; } }
7573
public float RandomizeFrequencyAtStart { get { return this.mRandomizeFrequencyAtStart; } set { this.mRandomizeFrequencyAtStart = value; } }
7674

77-
7875
/* Functions */
7976

8077
protected override void Awake()

Assets/JCSUnity/Scripts/Effects/Item/JCS_Item.cs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ public class JCS_Item
2929
[Header("** Check Variables (JCS_Item) **")]
3030

3131
[Tooltip(@"Collider detect can be picked.
32-
u can set this directly in order to get the pick effect too.
33-
Once u set this, the object will do tween
34-
effect to this transform.")]
32+
You can set this directly in order to get the pick effect too. Once you set this,
33+
the object will do tween effect to this transform.")]
3534
[SerializeField]
3635
protected Collider mPickCollider = null;
3736

@@ -57,16 +56,15 @@ u can set this directly in order to get the pick effect too.
5756
[SerializeField]
5857
protected bool mAutoPickColliderTouched = false;
5958

60-
[Tooltip(@"When the item are on the ground, pick it up when there
61-
is object that we target.")]
59+
[Tooltip(@"When the item are on the ground, pick it up when there is
60+
object that we target.")]
6261
[SerializeField]
6362
protected bool mAutoPickWhileCan = false;
6463

6564

6665
[Header("** Sound Settings (JCS_Item) **")]
6766

68-
[Tooltip(@"Play one shot while not playing any
69-
other sound. (Pick Sound)")]
67+
[Tooltip(@"Play one shot while not playing any other sound. (Pick Sound)")]
7068
[SerializeField]
7169
protected bool mPlayOneShotWhileNotPlayingForPickSound = true;
7270

@@ -95,7 +93,6 @@ other sound. (Pick Sound)")]
9593
[SerializeField]
9694
private JCS_DestinationDestroy mDestinationDestroy = null;
9795

98-
9996
/* Setter & Getter */
10097

10198
public bool AutoPickColliderTouched { get { return this.mAutoPickColliderTouched; } set { this.mAutoPickColliderTouched = value; } }
@@ -108,13 +105,11 @@ other sound. (Pick Sound)")]
108105
public void SetPickCallback(PickCallback func) { this.mPickCallback = func; }
109106
public PickCallback GetPickCallback() { return this.mPickCallback; }
110107

111-
112108
/* Functions */
113109

114110
protected override void Awake()
115111
{
116-
// update the data once
117-
// depends on what game object is.
112+
// Update the data once depends on what game object is.
118113
base.Awake();
119114

120115
mBoxCollider = this.GetComponent<BoxCollider>();
@@ -139,7 +134,6 @@ protected virtual void OnTriggerStay(Collider other)
139134
{
140135
// picked
141136
Pick(other);
142-
143137
return;
144138
}
145139

@@ -156,9 +150,7 @@ protected virtual void OnMouseDown()
156150

157151
if (mPickCollider == null)
158152
{
159-
JCS_Debug.LogError(
160-
"Cannot pick the item cuz there is no collider set.");
161-
153+
JCS_Debug.LogError("Cannot pick the item cuz there is no collider set");
162154
return;
163155
}
164156

@@ -222,26 +214,28 @@ private void DoPick(Collider other)
222214
{
223215
DropEffect(other);
224216

217+
JCS_SoundPlayer sp = JCS_SoundManager.instance.GetGlobalSoundPlayer();
218+
225219
/* Play Pick Sound */
226220
if (mPlayOneShotWhileNotPlayingForPickSound)
227-
JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShotWhileNotPlaying(mPickSound);
221+
sp.PlayOneShotWhileNotPlaying(mPickSound);
228222
else
229-
JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShot(mPickSound);
223+
sp.PlayOneShot(mPickSound);
230224

231225
// call item effect.
232226
mPickCallback.Invoke(other);
233227

234228
/* Play Effect Sound */
235229
if (mPlayOneShotWhileNotPlayingForEffectSound)
236-
JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShotWhileNotPlaying(mEffectSound);
230+
sp.PlayOneShotWhileNotPlaying(mEffectSound);
237231
else
238-
JCS_SoundManager.instance.GetGlobalSoundPlayer().PlayOneShot(mEffectSound);
232+
sp.PlayOneShot(mEffectSound);
239233

240234
mCanPick = false;
241235
}
242236

243237
/// <summary>
244-
///
238+
/// Do the drop effect.
245239
/// </summary>
246240
/// <param name="other"></param>
247241
private void DropEffect(Collider other)

Assets/JCSUnity/Scripts/Effects/Item/JCS_ItemDroppable.cs

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

Assets/JCSUnity/Scripts/Effects/Item/JCS_ItemIgnore.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ public class JCS_ItemIgnore
2323
[SerializeField]
2424
private bool mEffectToAllChild = true;
2525

26-
2726
/* Setter & Getter */
2827

2928
public bool EffectToAllChild { get { return this.mEffectToAllChild; } set { this.mEffectToAllChild = value; } }
3029

31-
3230
/* Functions */
3331

3432
private void Start()
@@ -42,9 +40,7 @@ private void AddEffectToAllChild()
4240
return;
4341

4442
// add to all the child as the same effect
45-
for (int index = 0;
46-
index < this.transform.childCount;
47-
++index)
43+
for (int index = 0; index < this.transform.childCount; ++index)
4844
{
4945
transform.GetChild(index).gameObject.AddComponent<JCS_ItemIgnore>();
5046
}

Assets/JCSUnity/Scripts/Effects/Item/JCS_ItemRotation.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public class JCS_ItemRotation
2323
// gravity object
2424
private JCS_OneJump mOneJump = null;
2525

26-
2726
/* Setter & Getter */
2827

2928
/* Functions */

0 commit comments

Comments
 (0)