Advertisement
kadyr

Untitled

Sep 18th, 2021
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Photon.Pun;
  5. public class NetworkMove : MonoBehaviour, IPunObservable
  6. {
  7. [SerializeField]
  8. private List<Material> skins = new List<Material>();
  9.  
  10. [SerializeField]
  11. private Renderer skinRender; // наш текущий скин
  12.  
  13. PhotonView _photonView;
  14.  
  15.  
  16. public bool finish;
  17. void Start()
  18. {
  19. _photonView = GetComponent<PhotonView>();
  20. if (!_photonView.IsMine)
  21. {
  22. GetComponent<PlayerLook>().enabled = false;
  23. GetComponent<GuyMove>().enabled = false;
  24. GetComponentInChildren<Camera>().gameObject.SetActive(false);
  25. }
  26. }
  27.  
  28. public void ChangeSkin(int skinNum)
  29. {
  30. skinRender.material = skins[skinNum];
  31. }
  32.  
  33. public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
  34. {
  35. if (stream.IsWriting)
  36. stream.SendNext(finish);
  37. else
  38. finish = (bool)stream.ReceiveNext();
  39. }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement