Added PlayerMovement and other

This commit is contained in:
2026-06-20 16:32:20 +03:00
parent f5c79c7241
commit eca9be620a
25 changed files with 3630 additions and 2200 deletions
@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.Netcode;
using UnityEngine;
@@ -28,6 +29,9 @@ public class RoundManager : NetworkBehaviour
[SerializeField] private float roundStartDelay = 3f;
[SerializeField] private Transform[] spawnPoints;
private NetworkVariable<float> roundDuration = new NetworkVariable<float>(180f);
private NetworkVariable<float> roundTimeRemaining = new NetworkVariable<float>(0f);
private NetworkVariable<int> currentRound = new NetworkVariable<int>(0);
private NetworkVariable<bool> isRoundActive = new NetworkVariable<bool>(false);
@@ -35,24 +39,51 @@ public class RoundManager : NetworkBehaviour
private NetworkList<PlayerScore> playerScores;
void Awake()
{
Current = this;
playerScores = new NetworkList<PlayerScore>();
}
private bool isTimerRunning = false;
public override void OnNetworkSpawn()
{
currentRound.OnValueChanged += OnRoundChanged;
isRoundActive.OnValueChanged += OnRoundStateChanged;
// roundTimeRemaining.OnValueChanged += OnTimerChanged;
if (IsServer)
{
// StartTimerServerRPC();
StartCoroutine(StartRoundWithDelay());
}
}
private void Update()
{
if (!IsServer) return;
if(!IsRoundActive) return;
roundTimeRemaining.Value = Mathf.Max(0f, roundTimeRemaining.Value - Time.deltaTime);
if(roundTimeRemaining.Value <= 0f)
{
StartCoroutine(EndRound(0ul));
}
}
// public void OnTimerChanged(float _previousValue, float _newValue)
void Awake()
{
Current = this;
playerScores = new NetworkList<PlayerScore>();
roundTimeRemaining.Value = roundDuration.Value;
}
public void OnPlayerFellIntoPit(ulong _winnerClientId)
{
if (!IsServer) return;