Skip to content

Commit c78eebc

Browse files
committed
feat: Remove custom Bool3; replace with built-in
1 parent d304e00 commit c78eebc

12 files changed

Lines changed: 54 additions & 115 deletions

File tree

‎Assets/JCSUnity/Scripts/Actions/Freeze/JCS_FreezePositionAction.cs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2017 by Shen, Jen-Chieh $
88
*/
9+
using Unity.Mathematics;
910
using UnityEngine;
1011
using MyBox;
1112

@@ -34,7 +35,7 @@ public class JCS_FreezePositionAction : JCS_UnityObject
3435

3536
[Tooltip("Freeze the position in each axis.")]
3637
[SerializeField]
37-
private JCS_Bool3 mFreezePosition = JCS_Bool3.allFalse;
38+
private bool3 mFreezePosition = default;
3839

3940
/* Setter & Getter */
4041

@@ -54,7 +55,7 @@ public bool isLocalPosition
5455
mPositionToFreeze = position;
5556
}
5657
}
57-
public JCS_Bool3 freezePosition { get { return mFreezePosition; } set { mFreezePosition = value; } }
58+
public bool3 freezePosition { get { return mFreezePosition; } set { mFreezePosition = value; } }
5859

5960
/* Functions */
6061

@@ -85,11 +86,11 @@ private void DoFreezePosition()
8586
newPos = localPosition;
8687

8788
/* Freeze position */
88-
if (mFreezePosition.check1)
89+
if (mFreezePosition.x)
8990
newPos.x = mPositionToFreeze.x;
90-
if (mFreezePosition.check2)
91+
if (mFreezePosition.y)
9192
newPos.y = mPositionToFreeze.y;
92-
if (mFreezePosition.check3)
93+
if (mFreezePosition.z)
9394
newPos.z = mPositionToFreeze.z;
9495

9596
/* Apply new value to transform. */

‎Assets/JCSUnity/Scripts/Actions/Freeze/JCS_FreezeRotationAction.cs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2017 by Shen, Jen-Chieh $
88
*/
9+
using Unity.Mathematics;
910
using UnityEngine;
1011
using MyBox;
1112

@@ -34,7 +35,7 @@ public class JCS_FreezeRotationAction : JCS_UnityObject
3435

3536
[Tooltip("Freeze the rotation in each axis.")]
3637
[SerializeField]
37-
private JCS_Bool3 mFreezeRotation = JCS_Bool3.allFalse;
38+
private bool3 mFreezeRotation = default;
3839

3940
/* Setter & Getter */
4041

@@ -54,7 +55,7 @@ public bool isLocalRotation
5455
mRotationToFreeze = eulerAngles;
5556
}
5657
}
57-
public JCS_Bool3 freezeRotation { get { return mFreezeRotation; } set { mFreezeRotation = value; } }
58+
public bool3 freezeRotation { get { return mFreezeRotation; } set { mFreezeRotation = value; } }
5859

5960
/* Functions */
6061

@@ -76,11 +77,11 @@ private void DoFreezeRotation()
7677
newRot = localEulerAngles;
7778

7879
/* Freeze euler angles */
79-
if (mFreezeRotation.check1)
80+
if (mFreezeRotation.x)
8081
newRot.x = mRotationToFreeze.x;
81-
if (mFreezeRotation.check2)
82+
if (mFreezeRotation.y)
8283
newRot.y = mRotationToFreeze.y;
83-
if (mFreezeRotation.check3)
84+
if (mFreezeRotation.z)
8485
newRot.z = mRotationToFreeze.z;
8586

8687
if (mIsLocalRotation)

‎Assets/JCSUnity/Scripts/Actions/Freeze/JCS_FreezeScaleAction.cs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2017 by Shen, Jen-Chieh $
88
*/
9+
using Unity.Mathematics;
910
using UnityEngine;
1011
using MyBox;
1112

@@ -30,12 +31,12 @@ public class JCS_FreezeScaleAction : JCS_UnityObject
3031

3132
[Tooltip("Freeze the scale in each axis.")]
3233
[SerializeField]
33-
private JCS_Bool3 mFreezeScale = JCS_Bool3.allFalse;
34+
private bool3 mFreezeScale = default;
3435

3536
/* Setter & Getter */
3637

3738
public bool active { get { return mActive; } set { mActive = value; } }
38-
public JCS_Bool3 freezeScale { get { return mFreezeScale; } set { mFreezeScale = value; } }
39+
public bool3 freezeScale { get { return mFreezeScale; } set { mFreezeScale = value; } }
3940
public Vector3 scaleToFreeze { get { return mScaleToFreeze; } set { mScaleToFreeze = value; } }
4041

4142
/* Functions */
@@ -62,11 +63,11 @@ private void DoFreezeScale()
6263
Vector3 newScale = localScale;
6364

6465
/* Freeze scale */
65-
if (mFreezeScale.check1)
66+
if (mFreezeScale.x)
6667
newScale.x = mScaleToFreeze.x;
67-
if (mFreezeScale.check2)
68+
if (mFreezeScale.y)
6869
newScale.y = mScaleToFreeze.y;
69-
if (mFreezeScale.check3)
70+
if (mFreezeScale.z)
7071
newScale.z = mScaleToFreeze.z;
7172

7273
localScale = newScale;

‎Assets/JCSUnity/Scripts/Actions/Freeze/JCS_FreezeTransformAction.cs‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2017 by Shen, Jen-Chieh $
88
*/
9+
using Unity.Mathematics;
910
using UnityEngine;
1011
using MyBox;
1112

@@ -46,25 +47,25 @@ public class JCS_FreezeTransformAction : JCS_UnityObject
4647

4748
[Tooltip("Freeze the position in each axis.")]
4849
[SerializeField]
49-
private JCS_Bool3 mFreezePosition = JCS_Bool3.allFalse;
50+
private bool3 mFreezePosition = default;
5051

5152
[Tooltip("Freeze the rotation in each axis.")]
5253
[SerializeField]
53-
private JCS_Bool3 mFreezeRotation = JCS_Bool3.allFalse;
54+
private bool3 mFreezeRotation = default;
5455

5556
[Tooltip("Freeze the scale in each axis.")]
5657
[SerializeField]
57-
private JCS_Bool3 mFreezeScale = JCS_Bool3.allFalse;
58+
private bool3 mFreezeScale = default;
5859

5960
/* Setter & Getter */
6061

6162
public bool active { get { return mActive; } set { mActive = value; } }
6263
public Vector3 positionToFreeze { get { return mPositionToFreeze; } set { mPositionToFreeze = value; } }
6364
public Vector3 rotationToFreeze { get { return mRotationToFreeze; } set { mRotationToFreeze = value; } }
6465
public Vector3 scaleToFreeze { get { return mScaleToFreeze; } set { mScaleToFreeze = value; } }
65-
public JCS_Bool3 freezePosition { get { return mFreezePosition; } set { mFreezePosition = value; } }
66-
public JCS_Bool3 freezeRotation { get { return mFreezeRotation; } set { mFreezeRotation = value; } }
67-
public JCS_Bool3 freezeScale { get { return mFreezeScale; } set { mFreezeScale = value; } }
66+
public bool3 freezePosition { get { return mFreezePosition; } set { mFreezePosition = value; } }
67+
public bool3 freezeRotation { get { return mFreezeRotation; } set { mFreezeRotation = value; } }
68+
public bool3 freezeScale { get { return mFreezeScale; } set { mFreezeScale = value; } }
6869
public bool isLocalPosition
6970
{
7071
get { return mIsLocalPosition; }
@@ -140,11 +141,11 @@ private void DoFreezePosition()
140141
newPos = localPosition;
141142

142143
/* Freeze position */
143-
if (mFreezePosition.check1)
144+
if (mFreezePosition.x)
144145
newPos.x = mPositionToFreeze.x;
145-
if (mFreezePosition.check2)
146+
if (mFreezePosition.y)
146147
newPos.y = mPositionToFreeze.y;
147-
if (mFreezePosition.check3)
148+
if (mFreezePosition.z)
148149
newPos.z = mPositionToFreeze.z;
149150

150151
/* Apply new value to transform. */
@@ -164,11 +165,11 @@ private void DoFreezeRotation()
164165
newRot = localEulerAngles;
165166

166167
/* Freeze euler angles */
167-
if (mFreezeRotation.check1)
168+
if (mFreezeRotation.x)
168169
newRot.x = mRotationToFreeze.x;
169-
if (mFreezeRotation.check2)
170+
if (mFreezeRotation.y)
170171
newRot.y = mRotationToFreeze.y;
171-
if (mFreezeRotation.check3)
172+
if (mFreezeRotation.z)
172173
newRot.z = mRotationToFreeze.z;
173174

174175
if (mIsLocalRotation)
@@ -185,11 +186,11 @@ private void DoFreezeScale()
185186
Vector3 newScale = localScale;
186187

187188
/* Freeze scale */
188-
if (mFreezeScale.check1)
189+
if (mFreezeScale.x)
189190
newScale.x = mScaleToFreeze.x;
190-
if (mFreezeScale.check2)
191+
if (mFreezeScale.y)
191192
newScale.y = mScaleToFreeze.y;
192-
if (mFreezeScale.check3)
193+
if (mFreezeScale.z)
193194
newScale.z = mScaleToFreeze.z;
194195

195196
localScale = newScale;

‎Assets/JCSUnity/Scripts/Actions/JCS_RandomTweenerAction.cs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2017 by Shen, Jen-Chieh $
88
*/
9+
using Unity.Mathematics;
910
using UnityEngine;
1011
using MyBox;
1112

@@ -42,7 +43,7 @@ public class JCS_RandomTweenerAction : MonoBehaviour
4243

4344
[Tooltip("Freeze in a certain vector? (x, y, z)")]
4445
[SerializeField]
45-
private JCS_Bool3 mFreeze = JCS_Bool3.allFalse;
46+
private bool3 mFreeze = default;
4647

4748
/* Setter & Getter */
4849

@@ -70,13 +71,13 @@ private void TargetNewVectorValue()
7071
Vector3 newVal = mTransformTweener.GetSelfTransformTypeVector3();
7172

7273
// x
73-
if (!mFreeze.check1)
74+
if (!mFreeze.x)
7475
newVal.x = JCS_Random.Range(mMinVectorRange.x, mMaxVectorRange.x);
7576
// y
76-
if (!mFreeze.check2)
77+
if (!mFreeze.y)
7778
newVal.y = JCS_Random.Range(mMinVectorRange.y, mMaxVectorRange.y);
7879
// z
79-
if (!mFreeze.check3)
80+
if (!mFreeze.z)
8081
newVal.z = JCS_Random.Range(mMinVectorRange.z, mMaxVectorRange.z);
8182

8283
mTransformTweener.DoTween(newVal);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (c) 2016 by Shen, Jen-Chieh $
88
*/
99
using System.Collections.Generic;
10+
using Unity.Mathematics;
1011
using UnityEngine;
1112
using MyBox;
1213

@@ -179,21 +180,21 @@ public void SpawnATransform()
179180
// use the current spawner position.
180181
objSpawned.transform.position,
181182
new Vector3(mRandPosRangeX, mRandPosRangeY, mRandPosRangeZ),
182-
new JCS_Bool3(mRandPosX, mRandPosY, mRandPosZ));
183+
new bool3(mRandPosX, mRandPosY, mRandPosZ));
183184

184185
// randomize the rotation a bit.
185186
Vector3 randRot = JCS_Vector.ApplyRandVector3(
186187
// use the current spawner position.
187188
objSpawned.transform.eulerAngles,
188189
new Vector3(mRandRotRangeX, mRandRotRangeY, mRandRotRangeZ),
189-
new JCS_Bool3(mRandRotationX, mRandRotationY, mRandRotationZ));
190+
new bool3(mRandRotationX, mRandRotationY, mRandRotationZ));
190191

191192
// randomize the rotation a bit.
192193
Vector3 randScale = JCS_Vector.ApplyRandVector3(
193194
// use the current spawner position.
194195
objSpawned.transform.localScale,
195196
new Vector3(mRandScaleRangeX, mRandScaleRangeY, mRandScaleRangeZ),
196-
new JCS_Bool3(mRandScaleX, mRandScaleY, mRandScaleZ));
197+
new bool3(mRandScaleX, mRandScaleY, mRandScaleZ));
197198

198199
objSpawned.transform.position = randPos;
199200
objSpawned.transform.eulerAngles = randRot;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (c) 2017 by Shen, Jen-Chieh $
88
*/
99
using System.Collections.Generic;
10+
using Unity.Mathematics;
1011
using UnityEngine;
1112
using MyBox;
1213

@@ -207,21 +208,21 @@ public void SpawnATransform()
207208
// use the current spawner position.
208209
objSpawned.transform.position,
209210
new Vector3(mRandPosRangeX, mRandPosRangeY, mRandPosRangeZ),
210-
new JCS_Bool3(mRandPosX, mRandPosY, mRandPosZ));
211+
new bool3(mRandPosX, mRandPosY, mRandPosZ));
211212

212213
// randomize the rotation a bit.
213214
Vector3 randRot = JCS_Vector.ApplyRandVector3(
214215
// use the current spawner position.
215216
objSpawned.transform.eulerAngles,
216217
new Vector3(mRandRotRangeX, mRandRotRangeY, mRandRotRangeZ),
217-
new JCS_Bool3(mRandRotationX, mRandRotationY, mRandRotationZ));
218+
new bool3(mRandRotationX, mRandRotationY, mRandRotationZ));
218219

219220
// randomize the rotation a bit.
220221
Vector3 randScale = JCS_Vector.ApplyRandVector3(
221222
// use the current spawner position.
222223
objSpawned.transform.localScale,
223224
new Vector3(mRandScaleRangeX, mRandScaleRangeY, mRandScaleRangeZ),
224-
new JCS_Bool3(mRandScaleX, mRandScaleY, mRandScaleZ));
225+
new bool3(mRandScaleX, mRandScaleY, mRandScaleZ));
225226

226227
objSpawned.transform.position = randPos;
227228
objSpawned.transform.eulerAngles = randRot;

‎Assets/JCSUnity/Scripts/Interactive/2D/GameObjects/JCS_2DBullet.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* $Notice: See LICENSE.txt for modification and distribution information
77
* Copyright (c) 2016 by Shen, Jen-Chieh $
88
*/
9+
using Unity.Mathematics;
910
using UnityEngine;
1011

1112
namespace JCSUnity
@@ -218,7 +219,7 @@ private void DoDegreeChangeEffect()
218219
mRandDegreeRangeY,
219220
mRandDegreeRangeZ);
220221

221-
JCS_Bool3 checkers = new JCS_Bool3(
222+
var checkers = new bool3(
222223
mRandDegreeX,
223224
mRandDegreeY,
224225
mRandDegreeZ);

‎Assets/JCSUnity/Scripts/Struct/JCS_Bool3.cs‎

Lines changed: 0 additions & 47 deletions
This file was deleted.

‎Assets/JCSUnity/Scripts/Struct/JCS_Bool3.cs.meta‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)