Skip to content

Commit f523fca

Browse files
committed
feat: Extend Instance interface
1 parent 61ebaa0 commit f523fca

File tree

172 files changed

+3350
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+3350
-601
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private void Update()
7272
if (!mSoundPlayed)
7373
{
7474
// just play one time.
75-
JCS_SoundManager.instance.GlobalSoundPlayer().PlayOneShot(mDieSound);
75+
JCS_SoundManager.FirstInstance().GlobalSoundPlayer().PlayOneShot(mDieSound);
7676
mSoundPlayed = true;
7777
}
7878

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private void OnDestroy()
8282
return;
8383

8484
// if switching the scene, don't spawn new gameObject.
85-
if (JCS_SceneManager.instance.IsSwitchingScene())
85+
if (JCS_SceneManager.FirstInstance().IsSwitchingScene())
8686
return;
8787

8888

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public void LockOnInit(FindMethod method)
147147

148148
#if UNITY_EDITOR
149149
// print out the name.
150-
if (JCS_GameSettings.instance.DEBUG_MODE)
150+
if (JCS_GameSettings.FirstInstance().DEBUG_MODE)
151151
Debug.Log(closestliveObj.transform.name);
152152
#endif
153153
}
@@ -172,7 +172,7 @@ private bool AbleTarget(JCS_2DLiveObject liveObj)
172172

173173
JCS_2DLiveObject owenerLiveObject = mAttackerInfo.Attacker.GetComponent<JCS_2DLiveObject>();
174174

175-
if (!JCS_GameSettings.instance.TRIBE_DAMAGE_EACH_OTHER)
175+
if (!JCS_GameSettings.FirstInstance().TRIBE_DAMAGE_EACH_OTHER)
176176
{
177177
// check same tribe.
178178
if (JCS_Util.IsSameTribe(liveObj, owenerLiveObject))
@@ -202,7 +202,7 @@ private bool AbleTarget(JCS_2DLiveObject liveObj)
202202
private JCS_2DLiveObject FindClosest()
203203
{
204204
// find all living object in the scene
205-
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.instance.LIVE_OBJECT_LIST;
205+
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.FirstInstance().LIVE_OBJECT_LIST;
206206

207207
float distance = 0;
208208
bool firstAssign = false;
@@ -259,7 +259,7 @@ private JCS_2DLiveObject FindClosest()
259259
private JCS_2DLiveObject FindClosestRight()
260260
{
261261
// find all living object in the scene
262-
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.instance.LIVE_OBJECT_LIST;
262+
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.FirstInstance().LIVE_OBJECT_LIST;
263263

264264
float distance = 0;
265265
bool firstAssign = false;
@@ -356,7 +356,7 @@ private bool CheckIsTop(Transform trans)
356356
private JCS_2DLiveObject FindClosestLeft()
357357
{
358358
// find all living object in the scene
359-
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.instance.LIVE_OBJECT_LIST;
359+
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.FirstInstance().LIVE_OBJECT_LIST;
360360

361361
float distance = 0;
362362
bool firstAssign = false;
@@ -420,7 +420,7 @@ private JCS_2DLiveObject FindClosestLeft()
420420
private JCS_2DLiveObject FindClosestTop()
421421
{
422422
// find all living object in the scene
423-
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.instance.LIVE_OBJECT_LIST;
423+
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.FirstInstance().LIVE_OBJECT_LIST;
424424

425425
float distance = 0;
426426
bool firstAssign = false;
@@ -484,7 +484,7 @@ private JCS_2DLiveObject FindClosestTop()
484484
private JCS_2DLiveObject FindClosestBottom()
485485
{
486486
// find all living object in the scene
487-
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.instance.LIVE_OBJECT_LIST;
487+
JCS_2DLiveObject[] objs = JCS_2DLiveObjectManager.FirstInstance().LIVE_OBJECT_LIST;
488488

489489
float distance = 0;
490490
bool firstAssign = false;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void TriggerAction(float time)
162162
mTriggerAction = true;
163163

164164
// play the sound once.
165-
JCS_SoundManager.instance.GlobalSoundPlayer().PlayOneShot(mTriggerSound);
165+
JCS_SoundManager.FirstInstance().GlobalSoundPlayer().PlayOneShot(mTriggerSound);
166166
}
167167

168168
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public int[] PreCalculateSequenceDamage(int minDamage, int maxDamage, int hit, i
427427
}
428428

429429
// get the game setting first
430-
var gm = JCS_GameSettings.instance;
430+
var gm = JCS_GameSettings.FirstInstance();
431431

432432
int[] damages = new int[hit];
433433

Assets/JCSUnity/Scripts/Actions/3D/AI/JCS_3DWalkAction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private void Awake()
172172

173173
private void Start()
174174
{
175-
var wam = JCS_3DWalkActionManager.instance;
175+
var wam = JCS_3DWalkActionManager.FirstInstance();
176176
wam.AddWalkAction(this);
177177
}
178178

@@ -246,7 +246,7 @@ public void TargetOne(Transform target)
246246
if (target == null)
247247
return;
248248

249-
var wam = JCS_3DWalkActionManager.instance;
249+
var wam = JCS_3DWalkActionManager.FirstInstance();
250250

251251
if (mSearchCounter == mSearchCount)
252252
{

Assets/JCSUnity/Scripts/Actions/JCS_AppQuitOnLoadServerAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void Update()
4444
// script is the same as the 'JCS_ApplicationQuitOnLoadAction'.
4545
// But just a simple check before quiting the application
4646
// layer.
47-
if (JCS_PacketLostPreventer.instance.PacketIds.Count != 0)
47+
if (JCS_PacketLostPreventer.FirstInstance().PacketIds.Count != 0)
4848
return;
4949

5050
#if UNITY_EDITOR

Assets/JCSUnity/Scripts/Actions/JCS_ApplyDamageTextToLiveObjectAction.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,10 @@ private void OnTriggerEnter(Collider other)
214214
if (attacker != null)
215215
{
216216
JCS_2DLiveObject owenerLiveObject = mAttackerInfo.Attacker.GetComponent<JCS_2DLiveObject>();
217+
217218
if (owenerLiveObject != null)
218219
{
219-
if (!JCS_GameSettings.instance.TRIBE_DAMAGE_EACH_OTHER)
220+
if (!JCS_GameSettings.FirstInstance().TRIBE_DAMAGE_EACH_OTHER)
220221
{
221222
// if both player does not need to add in to list.
222223
// or if both enemy does not need to add in to list.

Assets/JCSUnity/Scripts/Actions/JCS_DetectArea.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private void OnTriggerEnter(Collider other)
5959
if (!dao.GetLiveObject().CanDamage)
6060
return;
6161

62-
if (!JCS_GameSettings.instance.TRIBE_DAMAGE_EACH_OTHER)
62+
if (!JCS_GameSettings.FirstInstance().TRIBE_DAMAGE_EACH_OTHER)
6363
{
6464
// if both player does not need to add in to list.
6565
// or if both enemy does not need to add in to list.

Assets/JCSUnity/Scripts/Actions/JCS_HitDamageAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private void DamageLiveObject(JCS_2DLiveObject liveObject)
9090
if (!liveObject.CanDamage)
9191
return;
9292

93-
if (!JCS_GameSettings.instance.TRIBE_DAMAGE_EACH_OTHER)
93+
if (!JCS_GameSettings.FirstInstance().TRIBE_DAMAGE_EACH_OTHER)
9494
{
9595
// if both player does not need to add in to list.
9696
// or if both enemy does not need to add in to list.

0 commit comments

Comments
 (0)