Skip to content

Commit 18472e4

Browse files
committed
feat: Add Vector util
1 parent d814e06 commit 18472e4

30 files changed

+482
-408
lines changed

Assets/JCSUnity/Scripts/Actions/2D/AI/JCS_2DAIStateSystem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public enum JCS_AIMoveActionType
3939
[ReadOnly]
4040
private JCS_AIMoveActionType mAIMoveActionType = JCS_AIMoveActionType.NONE;
4141

42-
private JCS_Vector<JCS_AIAction> mAIActions = null;
42+
private JCS_Vec<JCS_AIAction> mAIActions = null;
4343

4444
/* Setter & Getter */
4545

@@ -49,7 +49,7 @@ public enum JCS_AIMoveActionType
4949

5050
private void Awake()
5151
{
52-
this.mAIActions = new JCS_Vector<JCS_AIAction>();
52+
this.mAIActions = new JCS_Vec<JCS_AIAction>();
5353

5454
// add all the ai action into the array.
5555
JCS_AIAction[] actions = this.GetComponents<JCS_AIAction>();

Assets/JCSUnity/Scripts/Actions/2D/Shooting/JCS_2DSequenceShootActionNoDetection.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ public class JCS_2DSequenceShootActionNoDetection : MonoBehaviour, JCS_IAction
6565
private float mShootGap = 0.1f;
6666

6767
//** Sequence Data **
68-
private JCS_Vector<int> mThread = null; // main thread
69-
private JCS_Vector<float> mTimers = null; // timer per thread
70-
private JCS_Vector<int> mShootCount = null; // how many shoot should process per thread
71-
private JCS_Vector<int> mShootCounter = null; // counter per thread
72-
private JCS_Vector<Vector3> mShootPos = null;
73-
private JCS_Vector<Vector3> mShootAngles = null;
68+
private JCS_Vec<int> mThread = null; // main thread
69+
private JCS_Vec<float> mTimers = null; // timer per thread
70+
private JCS_Vec<int> mShootCount = null; // how many shoot should process per thread
71+
private JCS_Vec<int> mShootCounter = null; // counter per thread
72+
private JCS_Vec<Vector3> mShootPos = null;
73+
private JCS_Vec<Vector3> mShootAngles = null;
7474

7575
/* Setter & Getter */
7676

@@ -108,12 +108,12 @@ private void Awake()
108108
mShootAction.OverrideShoot = true;
109109
mCursorShootAction.OverrideShoot = true;
110110

111-
mThread = new JCS_Vector<int>();
112-
mTimers = new JCS_Vector<float>();
113-
mShootCount = new JCS_Vector<int>();
114-
mShootCounter = new JCS_Vector<int>();
115-
mShootPos = new JCS_Vector<Vector3>();
116-
mShootAngles = new JCS_Vector<Vector3>();
111+
mThread = new JCS_Vec<int>();
112+
mTimers = new JCS_Vec<float>();
113+
mShootCount = new JCS_Vec<int>();
114+
mShootCounter = new JCS_Vec<int>();
115+
mShootPos = new JCS_Vec<Vector3>();
116+
mShootAngles = new JCS_Vec<Vector3>();
117117
}
118118

119119
private void Update()

Assets/JCSUnity/Scripts/Actions/2D/Shooting/JCS_SequenceShootAction.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public class JCS_SequenceShootAction : MonoBehaviour, JCS_IAction
8282
private JCS_DetectAreaObject mDetectedObject = null;
8383

8484
//** Sequence Data **
85-
private JCS_Vector<int> mThread = null; // main thread
86-
private JCS_Vector<float> mTimers = null; // timer per thread
87-
private JCS_Vector<int> mShootCount = null; // how many shoot should process per thread
88-
private JCS_Vector<int> mShootCounter = null; // counter per thread
89-
private JCS_Vector<Vector3> mShootPos = null;
90-
private JCS_Vector<Transform> mTargetsPerSequence = null;
91-
private JCS_Vector<bool> mShootDirection = null;
85+
private JCS_Vec<int> mThread = null; // main thread
86+
private JCS_Vec<float> mTimers = null; // timer per thread
87+
private JCS_Vec<int> mShootCount = null; // how many shoot should process per thread
88+
private JCS_Vec<int> mShootCounter = null; // counter per thread
89+
private JCS_Vec<Vector3> mShootPos = null;
90+
private JCS_Vec<Transform> mTargetsPerSequence = null;
91+
private JCS_Vec<bool> mShootDirection = null;
9292

9393
/* Setter & Getter */
9494

@@ -113,13 +113,13 @@ private void Awake()
113113
// override the shoot effect in the base one.
114114
mShootAction.OverrideShoot = true;
115115

116-
mThread = new JCS_Vector<int>();
117-
mTimers = new JCS_Vector<float>();
118-
mShootCount = new JCS_Vector<int>();
119-
mShootCounter = new JCS_Vector<int>();
120-
mShootPos = new JCS_Vector<Vector3>();
121-
mTargetsPerSequence = new JCS_Vector<Transform>();
122-
mShootDirection = new JCS_Vector<bool>();
116+
mThread = new JCS_Vec<int>();
117+
mTimers = new JCS_Vec<float>();
118+
mShootCount = new JCS_Vec<int>();
119+
mShootCounter = new JCS_Vec<int>();
120+
mShootPos = new JCS_Vec<Vector3>();
121+
mTargetsPerSequence = new JCS_Vec<Transform>();
122+
mShootDirection = new JCS_Vec<bool>();
123123

124124
// try to get the ability format.
125125
if (mAbilityFormat == null)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void LookAtMouse()
6767
{
6868
float speed = 10;
6969

70-
Vector3 direction = JCS_Util.VectorDirection(mDirection);
70+
Vector3 direction = JCS_Vector.Direction(mDirection);
7171

7272
// Generate a plane that intersects the transform's position with an upwards normal.
7373
Plane playerPlane = new Plane(direction, mShootAction.SpawnPoint.position);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void DoLookAt()
127127

128128
Vector3 lookPoint = mTargetTransform.position;
129129
// get direction according to the type.
130-
Vector3 direction = JCS_Util.VectorDirection(mLookDirection);
130+
Vector3 direction = JCS_Vector.Direction(mLookDirection);
131131

132132
transform.LookAt(lookPoint, direction * (int)mState);
133133

@@ -159,7 +159,7 @@ private void DoAsympLook()
159159
if (forward == Vector3.zero)
160160
return;
161161

162-
Vector3 direction = JCS_Util.VectorDirection(mLookDirection);
162+
Vector3 direction = JCS_Vector.Direction(mLookDirection);
163163

164164
Quaternion dir = Quaternion.LookRotation(forward, direction * (int)mState);
165165

Assets/JCSUnity/Scripts/Actions/JCS_DetectAreaAction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class JCS_DetectAreaAction : MonoBehaviour
3131
[SerializeField]
3232
private Collider[] mDetectCollider = null;
3333

34-
private JCS_Vector<JCS_DetectAreaObject> mDetectedObjects = null;
34+
private JCS_Vec<JCS_DetectAreaObject> mDetectedObjects = null;
3535

3636
/* Setter & Getter */
3737

@@ -67,7 +67,7 @@ private void Awake()
6767
}
6868

6969
// create list to manage all detected object
70-
mDetectedObjects = new JCS_Vector<JCS_DetectAreaObject>();
70+
mDetectedObjects = new JCS_Vec<JCS_DetectAreaObject>();
7171
}
7272

7373
/// <summary>

Assets/JCSUnity/Scripts/Actions/JCS_SimpleTrackAction.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void Update()
100100
/// <param name="val">Value to add.</param>
101101
public void DeltaTargetPosX(float val)
102102
{
103-
mTargetPos = JCS_Util.IncVecX(mTargetPos, val);
103+
mTargetPos = JCS_Vector.IncVecX(mTargetPos, val);
104104
}
105105

106106
/// <summary>
@@ -109,7 +109,7 @@ public void DeltaTargetPosX(float val)
109109
/// <param name="val">Value to add.</param>
110110
public void DeltaTargetPosY(float val)
111111
{
112-
mTargetPos = JCS_Util.IncVecY(mTargetPos, val);
112+
mTargetPos = JCS_Vector.IncVecY(mTargetPos, val);
113113
}
114114

115115
/// <summary>
@@ -118,7 +118,7 @@ public void DeltaTargetPosY(float val)
118118
/// <param name="val">Value to add.</param>
119119
public void DeltaTargetPosZ(float val)
120120
{
121-
mTargetPos = JCS_Util.IncVecZ(mTargetPos, val);
121+
mTargetPos = JCS_Vector.IncVecZ(mTargetPos, val);
122122
}
123123
}
124124
}

Assets/JCSUnity/Scripts/Actions/Spawning/JCS_BasicInitSpawner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,21 @@ public void SpawnATransform()
175175

176176

177177
// randomize the position a bit.
178-
Vector3 randPos = JCS_Util.ApplyRandVector3(
178+
Vector3 randPos = JCS_Vector.ApplyRandVector3(
179179
// use the current spawner position.
180180
objSpawned.transform.position,
181181
new Vector3(mRandPosRangeX, mRandPosRangeY, mRandPosRangeZ),
182182
new JCS_Bool3(mRandPosX, mRandPosY, mRandPosZ));
183183

184184
// randomize the rotation a bit.
185-
Vector3 randRot = JCS_Util.ApplyRandVector3(
185+
Vector3 randRot = JCS_Vector.ApplyRandVector3(
186186
// use the current spawner position.
187187
objSpawned.transform.eulerAngles,
188188
new Vector3(mRandRotRangeX, mRandRotRangeY, mRandRotRangeZ),
189189
new JCS_Bool3(mRandRotationX, mRandRotationY, mRandRotationZ));
190190

191191
// randomize the rotation a bit.
192-
Vector3 randScale = JCS_Util.ApplyRandVector3(
192+
Vector3 randScale = JCS_Vector.ApplyRandVector3(
193193
// use the current spawner position.
194194
objSpawned.transform.localScale,
195195
new Vector3(mRandScaleRangeX, mRandScaleRangeY, mRandScaleRangeZ),

Assets/JCSUnity/Scripts/Actions/Spawning/JCS_BasicWaveSpawner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,21 @@ public void SpawnATransform()
203203

204204

205205
// randomize the position a bit.
206-
Vector3 randPos = JCS_Util.ApplyRandVector3(
206+
Vector3 randPos = JCS_Vector.ApplyRandVector3(
207207
// use the current spawner position.
208208
objSpawned.transform.position,
209209
new Vector3(mRandPosRangeX, mRandPosRangeY, mRandPosRangeZ),
210210
new JCS_Bool3(mRandPosX, mRandPosY, mRandPosZ));
211211

212212
// randomize the rotation a bit.
213-
Vector3 randRot = JCS_Util.ApplyRandVector3(
213+
Vector3 randRot = JCS_Vector.ApplyRandVector3(
214214
// use the current spawner position.
215215
objSpawned.transform.eulerAngles,
216216
new Vector3(mRandRotRangeX, mRandRotRangeY, mRandRotRangeZ),
217217
new JCS_Bool3(mRandRotationX, mRandRotationY, mRandRotationZ));
218218

219219
// randomize the rotation a bit.
220-
Vector3 randScale = JCS_Util.ApplyRandVector3(
220+
Vector3 randScale = JCS_Vector.ApplyRandVector3(
221221
// use the current spawner position.
222222
objSpawned.transform.localScale,
223223
new Vector3(mRandScaleRangeX, mRandScaleRangeY, mRandScaleRangeZ),

Assets/JCSUnity/Scripts/Effects/JCS_Rotation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ private void DoRotation()
102102
Vector3 rotateDirection;
103103

104104
if (mBySelf)
105-
rotateDirection = JCS_Util.VectorDirection(mRotateDirection, this.transform);
105+
rotateDirection = JCS_Vector.Direction(mRotateDirection, this.transform);
106106
else
107-
rotateDirection = JCS_Util.VectorDirection(mRotateDirection);
107+
rotateDirection = JCS_Vector.Direction(mRotateDirection);
108108

109109
transform.Rotate(rotateDirection * mRotateSpeed * JCS_Time.DeltaTime(mDeltaTimeType));
110110
}

0 commit comments

Comments
 (0)