Added GetAllPlayers function

This commit is contained in:
Jadis
2022-09-10 21:42:28 +03:00
committed by GitHub
parent 53fda7a510
commit 34fea1a131

View File

@@ -1,5 +1,6 @@
using UnityEngine; using UnityEngine;
using Opsive.UltimateCharacterController.Character; using Opsive.UltimateCharacterController.Character;
using System.Collections.Generic;
namespace DevourClient.Helpers namespace DevourClient.Helpers
{ {
@@ -61,5 +62,19 @@ using Opsive.UltimateCharacterController.Character;
return player; return player;
} }
public static List<GameObject> GetAllPlayers()
{
GameObject[] currentPlayers = GameObject.FindGameObjectsWithTag("Player");
List<GameObject> result = new List<GameObject>();
for (int i = 0; i < currentPlayers.Length; i++)
{
result.Add(currentPlayers[i]);
}
return result;
}
} }
} }