mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
deleted old "SearchForNext"
Julius hat was besseres gemacht :(
This commit is contained in:
@@ -89,47 +89,6 @@ public class WeaponManager : NetworkBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int searchForNextOld(List<GameObject> l, int lastActive = 0, int direction = 1) {
|
|
||||||
int size = l.Count;
|
|
||||||
bool condition = true;
|
|
||||||
int counter = 0;
|
|
||||||
foreach (GameObject obj in l) { if(obj == null) { counter++; } }
|
|
||||||
if(counter < 4) {
|
|
||||||
if (lastActive <= -1) { lastActive = size; }
|
|
||||||
if (lastActive >= l.Count) { lastActive = 0; }
|
|
||||||
for (int i = lastActive + direction; condition; i += direction) {
|
|
||||||
if (i >= l.Count) {
|
|
||||||
i = 0; size = lastActive;
|
|
||||||
}
|
|
||||||
else if (i < 0) {
|
|
||||||
i = size - 1; size = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log("1 " + i);
|
|
||||||
|
|
||||||
if (l[i] != null) {
|
|
||||||
if (l[lastActive] != null) {
|
|
||||||
l[lastActive].SetActive(false);
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
Debug.Log("2 " + i);
|
|
||||||
|
|
||||||
if (direction == 1) {
|
|
||||||
if (i <= size - 1) { condition = true; }
|
|
||||||
else { condition = false; }
|
|
||||||
} else if (direction == -1) {
|
|
||||||
if (i >= size - 1) { condition = true; }
|
|
||||||
else { condition = false; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GameObject getCurrentWeapon() {
|
public GameObject getCurrentWeapon() {
|
||||||
return activeWeapons[currentWeaponIndex].gameObject;
|
return activeWeapons[currentWeaponIndex].gameObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 2021.2.3f1
|
m_EditorVersion: 2021.2.0f1
|
||||||
m_EditorVersionWithRevision: 2021.2.3f1 (32358a8527b4)
|
m_EditorVersionWithRevision: 2021.2.0f1 (4bf1ec4b23c9)
|
||||||
|
|||||||
Reference in New Issue
Block a user