PlacementBugFixed

This commit is contained in:
brausjonas
2023-02-27 20:08:23 +01:00
parent a60a8f503f
commit 03f9d92aab
8 changed files with 21 additions and 12 deletions
+2 -2
View File
@@ -3632,7 +3632,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &584878063
RectTransform:
m_ObjectHideFlags: 0
@@ -3668,7 +3668,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.92941177, b: 0.78039217, a: 0.84313726}
m_Color: {r: 0.5566038, g: 0.50850105, b: 0.4069509, a: 0.84313726}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
+14 -1
View File
@@ -68,10 +68,12 @@ public class Client : MonoBehaviour
public void CalculatePlacement()
{
Player[] temp = new Player[playerAmount];
bool[] samePlacement = new bool[playerAmount];
for (int j = 0; j < temp.Length; j++)
{
temp[j] = players[j];
samePlacement[j] = false;
}
for (int i = 0; i < temp.Length - 1; i++)
@@ -86,16 +88,27 @@ public class Client : MonoBehaviour
{
(temp[f], temp[f + 1]) = (temp[f + 1], temp[f]);
}
else if(temp[f].stars == temp[f + 1].stars && temp[f].coins == temp[f + 1].coins)
{
samePlacement[f] = true;
}
}
}
int currentPlacement = 1;
for (int j = 0; j < temp.Length; j++)
{
for (int i = 0; i < temp.Length; i++)
{
if (temp[j] == players[i])
{
playerInfoElements[i].textPlacement.text = j+1 + ".";
// playerInfoElements[i].textPlacement.text = j+1 + ".";
playerInfoElements[i].textPlacement.text = currentPlacement + ".";
if (!samePlacement[j])
{
currentPlacement++;
}
}
}
}