using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerSetup : MonoBehaviour { public static PlayerSetup Instance; private Player _currentPlayer; public Player CurrentPlayer => _currentPlayer; public string DefaultName = "Οενηενεφ"; private void Awake() { //transform.parent = null; if (Instance == null) { Instance = this; //DontDestroyOnLoad(gameObject); } else if (Instance != this) { Destroy(gameObject); } } public void CreateNewPlayer() { _currentPlayer = new Player(); _currentPlayer.Name = $"{DefaultName} {UnityEngine.Random.Range(1,999)}"; } public void SetPlayerName(string name) { if (_currentPlayer != null) _currentPlayer.Name = name; } public void AddPlayerScore(int score) { if (_currentPlayer != null) _currentPlayer.Score += score; } public void UnlockMonument(MonumentInfo info) { if (_currentPlayer != null) _currentPlayer.UnlockedMonumets.Add(info); } public bool TryFindMonument(MonumentInfo info) { return _currentPlayer.UnlockedMonumets.Contains(info); } }