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
@@ -11,22 +11,32 @@ public class PlayerShoot : NetworkBehaviour
private PlayerHealth playerHealth;
public override void OnNetworkSpawn()
private bool isActive = false;
public void Init()
{
if (IsOwner)
{
playerHealth = GetComponent<PlayerHealth>();
if (playerHealth == null)
{
Debug.LogError("PlayerHealth component not found on player");
}
}
isActive = true;
}
// public override void OnNetworkSpawn()
// {
// if (IsOwner)
// {
// playerHealth = GetComponent<PlayerHealth>();
// if (playerHealth == null)
// {
// Debug.LogError("PlayerHealth component not found on player");
// }
// }
// }
void Update()
{
if (!IsOwner) return;
if(!isActive) return;
playerHealth = GetComponent<PlayerHealth>();
if(playerHealth == null || playerHealth.isDead.Value) return;
if (Input.GetMouseButtonDown(0))
@@ -59,7 +69,7 @@ public class PlayerShoot : NetworkBehaviour
[ClientRpc]
private void SpawnHitEffectClientRpc(Vector3 _hitPosition)
{
Debug.Log($"Spawning hit effect at {_hitPosition}");
// Debug.Log($"Spawning hit effect at {_hitPosition}");
Instantiate(hitEffectPrefab, _hitPosition, Quaternion.identity);
}
}