Skip to content

Commit 0828a67

Browse files
committed
style: Simplify name and constants
1 parent 191b661 commit 0828a67

31 files changed

+97
-46
lines changed

Assets/JCSUnity/Scripts/Actions/2D/JCS_2DTrackAction.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class JCS_2DTrackAction : MonoBehaviour , JCS_IAction
4747
//-- Smooth Track
4848
[Tooltip("Invers of speed, if smooth track is enable use this.")]
4949
[SerializeField]
50+
[Range(JCS_Constants.FRICTION_MIN, 10.0f)]
5051
private float mMoveFriction = 0.2f;
5152

5253
//-- Hard Track

Assets/JCSUnity/Scripts/Actions/3D/JCS_3DLookAtAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public enum State
7676

7777
[Tooltip("How it look at the target?")]
7878
[SerializeField]
79-
[Range(0.01f, 10.0f)]
79+
[Range(JCS_Constants.FRICTION_MIN, 10.0f)]
8080
private float mLookFriction = 0.4f;
8181

8282
// record the current rotation every frame, in order to set it back

Assets/JCSUnity/Scripts/Actions/3D/JCS_3DThrowAction.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public class JCS_3DThrowAction : MonoBehaviour
9393

9494
private float G
9595
{
96-
get { return JCS_Constants.GRAVITY * mGravityProduct; }
96+
get { return JCS_Physics.GRAVITY * mGravityProduct; }
9797
}
9898

9999
/* Functions */
@@ -110,7 +110,7 @@ private void Update()
110110
float dt = JCS_Time.ItTime(mTimeType);
111111

112112
// make it effect by gravity.
113-
this.mVelocity.y += JCS_Constants.GRAVITY * mGravityProduct * dt;
113+
this.mVelocity.y += JCS_Physics.GRAVITY * mGravityProduct * dt;
114114

115115
// add up velocity.
116116
this.transform.position += mVelocity * dt;
@@ -208,7 +208,7 @@ public static List<Vector3> GetArchByTime(
208208
// Calculate initial velocity.
209209
velocity.x = displacement.x / time;
210210
velocity.z = displacement.z / time;
211-
velocity.y = (displacement.y - (JCS_Constants.GRAVITY * gravityProduct * time * time / 2.0f)) / time;
211+
velocity.y = (displacement.y - (JCS_Physics.GRAVITY * gravityProduct * time * time / 2.0f)) / time;
212212

213213
/* 開始模擬 */
214214

@@ -224,7 +224,7 @@ public static List<Vector3> GetArchByTime(
224224
float dt = interval; // Interval is the delta time!
225225

226226
// make it effect by gravity.
227-
velocity.y += JCS_Constants.GRAVITY * gravityProduct * dt;
227+
velocity.y += JCS_Physics.GRAVITY * gravityProduct * dt;
228228

229229
// add up velocity.
230230
startPos += velocity * dt;

Assets/JCSUnity/Scripts/Actions/3D/JCS_3DTrackAction.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class JCS_3DTrackAction : MonoBehaviour, JCS_IAction
2626

2727
[Tooltip("Invers of speed.")]
2828
[SerializeField]
29+
[Range(JCS_Constants.FRICTION_MIN, 10.0f)]
2930
private float mMoveFriction = 1.0f;
3031

3132
[Tooltip("Type of the delta time.")]

Assets/JCSUnity/Scripts/Actions/JCS_SimpleTrackAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class JCS_SimpleTrackAction : JCS_UnityObject
3030

3131
[Tooltip("How fast it moves toward to the target position?")]
3232
[SerializeField]
33-
[Range(0.01f, 10.0f)]
33+
[Range(JCS_Constants.FRICTION_MIN, 10.0f)]
3434
private float mFriction = 0.2f;
3535

3636
[Tooltip("Type of the delta time.")]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class JCS_OneJump : MonoBehaviour
6262

6363
[Tooltip("Deacceleration after bouncing from the wall.")]
6464
[SerializeField]
65+
[Range(JCS_Constants.FRICTION_MIN, 5.0f)]
6566
private float mBounceFriction = 0.2f;
6667

6768
/* Setter & Getter */
@@ -104,7 +105,7 @@ private void FixedUpdate()
104105
float dt = JCS_Time.ItTime(mTimeType);
105106

106107
this.transform.position += mVelocity * dt;
107-
mVelocity.y += JCS_Constants.GRAVITY * dt * mItemGravity;
108+
mVelocity.y += JCS_Physics.GRAVITY * dt * mItemGravity;
108109
}
109110

110111
private void OnTriggerEnter(Collider other)

Assets/JCSUnity/Scripts/Effects/JCS_AlphaObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class JCS_AlphaObject : JCS_UnityObject
3636

3737
[Tooltip("How fast the alpha channel changes.")]
3838
[SerializeField]
39-
[Range(0.1f, 5.0f)]
39+
[Range(JCS_Constants.FRICTION_MIN, 5.0f)]
4040
private float mFadeFriction = 1.0f;
4141

4242
[Tooltip("Type of the delta time.")]

Assets/JCSUnity/Scripts/Effects/JCS_FadeObject.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class JCS_FadeObject : JCS_UnityObject
2424

2525
public Action<float> onFading = null;
2626

27-
private JCS_FadeType mFadeType = JCS_FadeType.FADE_IN; // defaul as visible
27+
private JCS_FadeType mFadeType = JCS_FadeType.IN; // defaul as visible
2828

2929
private float mAlpha = 1.0f;
3030

@@ -146,8 +146,8 @@ public bool IsFadeOut()
146146

147147
public void FadeOut() { FadeOut(mFadeTime); }
148148
public void FadeIn() { FadeIn(mFadeTime); }
149-
public void FadeOut(float time) { FadeEffect(JCS_FadeType.FADE_OUT, time); }
150-
public void FadeIn(float time) { this.FadeEffect(JCS_FadeType.FADE_IN, time); }
149+
public void FadeOut(float time) { FadeEffect(JCS_FadeType.OUT, time); }
150+
public void FadeIn(float time) { this.FadeEffect(JCS_FadeType.IN, time); }
151151

152152
/// <summary>
153153
/// Default function to point to,
@@ -169,8 +169,8 @@ private void FadeEffect(JCS_FadeType type, float time)
169169
if (!mOverrideFade)
170170
{
171171
// Check is already fade out or fade in!
172-
if ((mVisible && type == JCS_FadeType.FADE_IN) ||
173-
(!mVisible && type == JCS_FadeType.FADE_OUT))
172+
if ((mVisible && type == JCS_FadeType.IN) ||
173+
(!mVisible && type == JCS_FadeType.OUT))
174174
return;
175175
}
176176

@@ -179,13 +179,13 @@ private void FadeEffect(JCS_FadeType type, float time)
179179

180180
switch (type)
181181
{
182-
case JCS_FadeType.FADE_OUT:
182+
case JCS_FadeType.OUT:
183183
{
184184
mAlpha = mFadeInAmount;
185185
this.mVisible = false;
186186
}
187187
break;
188-
case JCS_FadeType.FADE_IN:
188+
case JCS_FadeType.IN:
189189
{
190190
mAlpha = mFadeOutAmount;
191191
this.mVisible = true;
@@ -212,7 +212,7 @@ private void DoFade()
212212

213213
switch (mFadeType)
214214
{
215-
case JCS_FadeType.FADE_OUT:
215+
case JCS_FadeType.OUT:
216216
{
217217
// Fade out effect complete
218218
if (mAlpha < mFadeOutAmount)
@@ -231,7 +231,7 @@ private void DoFade()
231231
}
232232
break;
233233

234-
case JCS_FadeType.FADE_IN:
234+
case JCS_FadeType.IN:
235235
{
236236
// Fade in effect complete
237237
if (mAlpha > mFadeInAmount)

Assets/JCSUnity/Scripts/Effects/JCS_FadeSound.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void SetAudioSource(AudioSource source)
9191
/// <param name="time"></param>
9292
public void FadeOut(float target_volume, float time)
9393
{
94-
if (mType == JCS_FadeType.FADE_OUT)
94+
if (mType == JCS_FadeType.OUT)
9595
{
9696
JCS_Debug.LogError("Already fade out");
9797
return;
@@ -108,7 +108,7 @@ public void FadeOut(float target_volume, float time)
108108
mTargetVolume = target_volume;
109109
mRecordVolume = mAudioSource.volume;
110110

111-
mType = JCS_FadeType.FADE_OUT;
111+
mType = JCS_FadeType.OUT;
112112
mEffect = true;
113113
}
114114

@@ -119,7 +119,7 @@ public void FadeOut(float target_volume, float time)
119119
/// <param name="time"></param>
120120
public void FadeIn(float target_volume, float time)
121121
{
122-
if (mType == JCS_FadeType.FADE_IN)
122+
if (mType == JCS_FadeType.IN)
123123
{
124124
JCS_Debug.LogError("Already fade in");
125125
return;
@@ -137,7 +137,7 @@ public void FadeIn(float target_volume, float time)
137137
mTargetVolume = target_volume;
138138
mRecordVolume = target_volume;
139139

140-
mType = JCS_FadeType.FADE_IN;
140+
mType = JCS_FadeType.IN;
141141
mEffect = true;
142142
}
143143

@@ -184,7 +184,7 @@ private void DoFadeSound()
184184
{
185185
switch (mType)
186186
{
187-
case JCS_FadeType.FADE_OUT:
187+
case JCS_FadeType.OUT:
188188
{
189189
mAudioSource.volume -= mRecordVolume / mFadeOutTime * JCS_Time.ItTime(mTimeType);
190190

@@ -195,7 +195,7 @@ private void DoFadeSound()
195195
}
196196
}
197197
break;
198-
case JCS_FadeType.FADE_IN:
198+
case JCS_FadeType.IN:
199199
{
200200
mAudioSource.volume += mRecordVolume / mFadeInTime * JCS_Time.ItTime(mTimeType);
201201

Assets/JCSUnity/Scripts/Effects/JCS_SlideEffect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class JCS_SlideEffect : JCS_UnityObject
7171

7272
[Tooltip("How fast the object slides.")]
7373
[SerializeField]
74-
[Range(0.01f, 10.0f)]
74+
[Range(JCS_Constants.FRICTION_MIN, 10.0f)]
7575
private float mFriction = 0.2f;
7676

7777
[Separator("Runtime Variables (JCS_SlideEffect)")]

0 commit comments

Comments
 (0)