У меня такая проблема, что когда игрок умирает, у себя на камере он умирает, но для других игроков этого не происходит.
Как сделать так, чтобы смерть синхронизировалась у всех?
скрипт игрока:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;
using Photon.Pun;
public class Human : MonoBehaviour
{
public PhotonView view;
public bool IsDead;
public Human PlayerController;
public GameObject DeadRagdoll;
public GameObject PlayerModel;
public GameObject PlayerFPSController;
[SerializeField] private Animator ThisHuman;
[SerializeField] private GameObject Player;
void Awake()
{
view = GetComponent<PhotonView>();
if (!view.IsMine)
{
PlayerController.enabled = false;
}
}
void Start()
{
IsDead = false;
PlayerModel.SetActive(true);
}
private void Update()
{
if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D))
{
ThisHuman.SetBool("IsWalk1", true);
}
else
{
ThisHuman.SetBool("IsWalk1", false);
}
if (Input.GetKey(KeyCode.LeftShift))
{
ThisHuman.SetBool("IsRun1", true);
}
else
{
ThisHuman.SetBool("IsRun1", false);
}
if (IsDead == true)
{
PhotonNetwork.Instantiate(DeadRagdoll.name, PlayerFPSController.transform.position, Quaternion.identity);
PhotonNetwork.Destroy(PlayerModel);
PlayerFPSController.GetComponent<FirstPersonController>().enabled = false;
}
}
}