Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
2,842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class FixThings : MonoBehaviour
  5. {
  6.     public NetworkView nv;
  7.     public Camera cam;
  8.     public AudioListener listener;
  9.     public GameObject fp;
  10.     public GameObject tp;
  11.  
  12.     void OnEnable()
  13.     {
  14.         DontDestroyOnLoad(this.gameObject);
  15.     }
  16.  
  17.     void Awake()
  18.     {
  19.         DontDestroyOnLoad(this.gameObject);
  20.     }
  21.  
  22.     // Use this for initialization
  23.     void Start()
  24.     {
  25.         DontDestroyOnLoad(this.gameObject);
  26.         if (nv.isMine)
  27.         {
  28.             cam.enabled = true;
  29.             listener.enabled = true;
  30.             fp.SetActive(true);
  31.             tp.SetActive(false);
  32.         }
  33.         else
  34.         {
  35.             cam.enabled = false;
  36.             listener.enabled = false;
  37.             fp.SetActive(false);
  38.             tp.SetActive(true);
  39.         }
  40.         this.enabled = false;
  41.     }
  42.  
  43.     void Update()
  44.     {
  45.         if (nv.isMine)
  46.         {
  47.             cam.enabled = true;
  48.             listener.enabled = true;
  49.             fp.SetActive(true);
  50.             tp.SetActive(false);
  51.         }
  52.         else
  53.         {
  54.             cam.enabled = false;
  55.             listener.enabled = false;
  56.             fp.SetActive(false);
  57.             tp.SetActive(true);
  58.         }
  59.         this.enabled = false;
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement