2026-01-30 19:04:14 +05:30
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
2026-02-09 14:38:16 +05:30
|
|
|
using UnityEngine.UI;
|
2026-01-30 19:04:14 +05:30
|
|
|
|
|
|
|
|
public class PlayerCountCanvas : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
Transform cam;
|
|
|
|
|
[SerializeField] private TMP_Text playerCountText;
|
2026-02-09 14:38:16 +05:30
|
|
|
[SerializeField] private PlayerPawn playerPawn;
|
|
|
|
|
[SerializeField] private Button indicatorBtn;
|
|
|
|
|
|
|
|
|
|
private GameplayManager gameplayManager;
|
|
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
|
{
|
|
|
|
|
indicatorBtn.onClick.AddListener(() => OnClickPlayer());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
|
{
|
|
|
|
|
indicatorBtn.onClick.RemoveListener(() => OnClickPlayer());
|
|
|
|
|
}
|
2026-01-30 19:04:14 +05:30
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
cam = GameObject.FindGameObjectWithTag("MainCamera").transform;
|
|
|
|
|
}
|
|
|
|
|
void LateUpdate()
|
|
|
|
|
{
|
|
|
|
|
transform.LookAt(cam.forward + transform.position);
|
|
|
|
|
}
|
|
|
|
|
public void SetPlayerCount(int count)
|
|
|
|
|
{
|
|
|
|
|
playerCountText.text = count.ToString();
|
|
|
|
|
}
|
2026-02-09 14:38:16 +05:30
|
|
|
|
|
|
|
|
public void OnClickPlayer()
|
|
|
|
|
{
|
|
|
|
|
// quick fix: Character selection too hard based on view
|
|
|
|
|
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
|
|
|
|
if (gameplayManager.GameManager.CurrentGameState == GameState.IsPaused || playerPawn.IsBotPlayer || !playerPawn.CanSelectPlayer) return;
|
|
|
|
|
|
|
|
|
|
gameplayManager.OnPawnSelected(playerPawn);
|
|
|
|
|
}
|
2026-01-30 19:04:14 +05:30
|
|
|
}
|