Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
- [RequireComponent(typeof(GuiManager))]
- public class PlayerSetup : NetworkBehaviour {
- [SerializeField]
- Behaviour[] ComponentToDisable;
- void disableComponents()
- {
- if (!isLocalPlayer) // jezeli nie kontrolujemy auta
- {
- for (int i = 0; i < ComponentToDisable.Length; i++)
- {
- ComponentToDisable[i].enabled = false;
- }
- }
- else // jezeli kontrolujemy auto
- {
- GetComponent<GuiManager>().CreateGUI();
- if(Camera.main != null)
- {
- Camera.main.enabled = false;
- }
- }
- }
- void Start () {
- disableComponents();
- }
- void Update () {
- }
- private void OnDestroy()
- {
- if (Camera.main != null)
- {
- Camera.main.enabled = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement