void Update ()
	{
		if (change && pickerS != null) {
			picker = pickerS;
			change = false;
		}

		//Client code
		if (Network.player == owner) {
			clientColor = picker.currentColor;
			if (Network.isServer) {
				//Too bad a server can't send an rpc to itself using "RPCMode.Server"!
				//This is a Unity "feature", see `Tips`
				Vector3 color_ = new Vector3 (clientColor.r, clientColor.g, clientColor.b);
				SendClorInput (color_);
			} else if (Network.isClient) {
				Vector3 color_ = new Vector3 (clientColor.r, clientColor.g, clientColor.b);
				SendClorInput (color_); //Use this (and line 64) for simple "prediction"
				GetComponent<NetworkView>().RPC ("SendClorInput", RPCMode.Server, color_);
			}
			
		}
		
		//Server movement code
		if (Network.isServer || Network.player == owner) {//To also enable this on the client itself, use: "|| Network.player==owner){|"
			renderer.material.color = serverColor;
		}
		
	}
Пример #2
0
    void Update()
    {
        if (change && pickerS != null)
        {
            picker = pickerS;
            change = false;
        }

        //Client code
        if (Network.player == owner)
        {
            clientColor = picker.currentColor;
            if (Network.isServer)
            {
                //Too bad a server can't send an rpc to itself using "RPCMode.Server"!
                //This is a Unity "feature", see `Tips`
                Vector3 color_ = new Vector3(clientColor.r, clientColor.g, clientColor.b);
                SendClorInput(color_);
            }
            else if (Network.isClient)
            {
                Vector3 color_ = new Vector3(clientColor.r, clientColor.g, clientColor.b);
                SendClorInput(color_);                  //Use this (and line 64) for simple "prediction"
                GetComponent <NetworkView>().RPC("SendClorInput", RPCMode.Server, color_);
            }
        }

        //Server movement code
        if (Network.isServer || Network.player == owner)          //To also enable this on the client itself, use: "|| Network.player==owner){|"
        {
            renderer.material.color = serverColor;
        }
    }
    void Update()
    {
        if (change && pickerS != null)
        {
            picker = pickerS;
            change = false;
        }

        //Client code
        if (Network.player == owner)
        {
            string id         = GetComponent <NetworkView>().viewID.ToString();
            int    networkID_ = -1;
            int.TryParse(id.Replace("AllocatedID: ", ""), out networkID_);
            bool enable_ = ComboBox_scripts.newNetIDStatic [ComboBox_scripts.selectedItem_].Equals(networkID_);
            // Select only the gameObject from the combo box
            if (enable_)
            {
                clientColor = picker.currentColor;
                if (Network.isServer)
                {
                    //Too bad a server can't send an rpc to itself using "RPCMode.Server"!
                    //This is a Unity "feature", see `Tips`
                    Vector3 color_ = new Vector3(clientColor.r, clientColor.g, clientColor.b);
                    SendClorInput(color_);
                }
                else if (Network.isClient)
                {
                    Vector3 color_ = new Vector3(clientColor.r, clientColor.g, clientColor.b);
                    SendClorInput(color_);                      //Use this (and line 64) for simple "prediction"
                    GetComponent <NetworkView>().RPC("SendClorInput", RPCMode.Server, color_);
                }
            }
        }

        //Server movement code
        if (Network.isServer || Network.player == owner)          //To also enable this on the client itself, use: "|| Network.player==owner){|"
        {
            renderer.material.color = serverColor;
        }
    }
	void Update ()
	{
		if (change && pickerS != null) {
			picker = pickerS;
			change = false;
		}

		//Client code
		if (Network.player == owner) {
			string id = GetComponent<NetworkView>().viewID.ToString ();
			int networkID_ = -1; 
			int.TryParse (id.Replace ("AllocatedID: ", ""), out networkID_);		
			bool enable_ = ComboBox_scripts.newNetIDStatic [ComboBox_scripts.selectedItem_].Equals (networkID_);
			// Select only the gameObject from the combo box
			if (enable_) {
				clientColor = picker.currentColor;
				if (Network.isServer) {
					//Too bad a server can't send an rpc to itself using "RPCMode.Server"!
					//This is a Unity "feature", see `Tips`
					Vector3 color_ = new Vector3 (clientColor.r, clientColor.g, clientColor.b);
					SendClorInput (color_);
				} else if (Network.isClient) {
					Vector3 color_ = new Vector3 (clientColor.r, clientColor.g, clientColor.b);
					SendClorInput (color_); //Use this (and line 64) for simple "prediction"
					GetComponent<NetworkView>().RPC ("SendClorInput", RPCMode.Server, color_);
				}
			
			}
		}
		
		//Server movement code
		if (Network.isServer || Network.player == owner) {//To also enable this on the client itself, use: "|| Network.player==owner){|"
			renderer.material.color = serverColor;
		}
		
	}
Пример #5
0
 private void Awake()
 {
     _hsvColorPicker  = FindObjectOfType <HSVPicker>();
     _voxelController = FindObjectOfType <VoxelController>();
 }
Пример #6
0
 private void Start()
 {
     picker = pPicker;
 }
	private void Start(){
		picker = pPicker;
	}
Пример #8
0
 private void Awake()
 {
     _hsvColorPicker = FindObjectOfType<HSVPicker>();
     _voxelController = FindObjectOfType<VoxelController>();
 }