Скрипты: Исправлена стилистика GameManager
This commit is contained in:
parent
3ade281440
commit
e9bfcb2cd0
@ -2784,7 +2784,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 51375d97c071d8c4f93cf2aa6881d048, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
coinText: {fileID: 6614787374390785080}
|
||||
_coinText: {fileID: 6614787374390785080}
|
||||
--- !u!114 &1102420991
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1,29 +1,25 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
public static List<PlayerState> players = new List<PlayerState>();
|
||||
#region Static Fields
|
||||
|
||||
public static List<PlayerState> players = new List<PlayerState>();
|
||||
public static List<PlayerState> activePlayers = new List<PlayerState>();
|
||||
public static List<PlayerState> tempDeadPlayers = new List<PlayerState>();
|
||||
public static List<PlayerState> deadPlayers = new List<PlayerState>();
|
||||
|
||||
public static List<TileOwner> deadOwners = new List<TileOwner>();
|
||||
|
||||
public static int coinsPerTree = 50;
|
||||
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI coinText;
|
||||
#endregion
|
||||
|
||||
[SerializeField] private TextMeshProUGUI _coinText;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
activePlayers.Clear();
|
||||
tempDeadPlayers.Clear();
|
||||
deadPlayers.Clear();
|
||||
players.Clear();
|
||||
DeathChecker.OnPlayerDeath += KillPlayer;
|
||||
DeathChecker.OnPlayerRes += ResPlayer;
|
||||
@ -31,12 +27,11 @@ public class GameManager : MonoBehaviour
|
||||
GameData.OnCoinsCollected += UpdateCoinUI;
|
||||
players = FindPlayers();
|
||||
SetupActivePlayers(players);
|
||||
//playersNOnStatic = players;
|
||||
}
|
||||
|
||||
private void UpdateCoinUI()
|
||||
{
|
||||
coinText.text = GameData.coins.ToString();
|
||||
_coinText.text = GameData.coins.ToString();
|
||||
}
|
||||
|
||||
private void SetupActivePlayers(List<PlayerState> allPlayers)
|
||||
@ -68,18 +63,19 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
player.ResetEnemies();
|
||||
}
|
||||
|
||||
deadOwners.Add(deadPlayer.ownerIndex);
|
||||
//deadPlayers.Add(deadPlayer);
|
||||
}
|
||||
|
||||
private List<PlayerState> FindPlayers()
|
||||
{
|
||||
List<PlayerState> resultPlayerList = new List<PlayerState>();
|
||||
var players = FindObjectsOfType<PlayerState>();
|
||||
foreach(var player in players)
|
||||
foreach (var player in players)
|
||||
{
|
||||
resultPlayerList.Add(player);
|
||||
}
|
||||
|
||||
return resultPlayerList;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user