Skip to content

Instantly share code, notes, and snippets.

@webthingee
Created January 2, 2019 23:18
Show Gist options
  • Save webthingee/02296a941edf06ddc66712a6573d3e0c to your computer and use it in GitHub Desktop.
Save webthingee/02296a941edf06ddc66712a6573d3e0c to your computer and use it in GitHub Desktop.
Lists
private void AdjustGoFirst()
{
if (!list.Exists(turn => turn.gameObject.name.Contains("Player")))
{
Player.instance.GetComponent<PlayerTurn>().Init();
return;
}
int playerListIndex = list.FindIndex(turn => turn.gameObject.name.Contains("Player"));
if (playerListIndex == 0) return;
CharactersTurn playerTurn = list[playerListIndex].GetComponent<CharactersTurn>();
list.RemoveAt(playerListIndex);
list.Insert(0, playerTurn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment