Example #1
0
        void Start()
        {
            _started = false;

            NodeInformation.Load();

            this.networkAddress = NodeInformation.master.ip;
            this.networkPort    = NodeInformation.master.port;

            if (NodeInformation.IsMaster())
            {
                isServer = true;
                this.StartServer();
                //Instantiate the origin-GameObject
                GameObject      objOrigin = Instantiate(origin, originParent);
                DataDistributor dd        = objOrigin.GetComponent <DataDistributor>();
                dd.ines   = this;
                dd.parent = originParent.gameObject;
                //Spawn the object for the clients
                NetworkServer.Spawn(objOrigin);

                //Test Master; if we remove this, then the master won't see anything (same goes for config)
                originSlave = FindOrigin();

                NodeInformation.SpawnScreenplanes(originSlave.transform.Find("ScreenPlanes"));

                trackerSettings = (TrackerSettings)originSlave.transform.Find("CameraHolder").GetComponent("TrackerSettings");
                trackerSettings.HostSettings = (TrackerHostSettings)GameObject.Find("NodeManager/TrackerHostSettings").GetComponent("TrackerHostSettings");

                trackerSettings = (TrackerSettings)originSlave.transform.Find("Flystick").GetComponent("TrackerSettings");
                trackerSettings.HostSettings = (TrackerHostSettings)GameObject.Find("NodeManager/TrackerHostSettings").GetComponent("TrackerHostSettings");
                //trackerSettings.gameObject.SetActive(false);
            }
            else
            {
                this.StartClient();
                //The camera manipulation happens in Update()
                //GameObject objOrigin = Instantiate(origin, originParent);
                //////Spawn the object for the clients
                //NetworkServer.Spawn(objOrigin);

                // deactivate music and sound for clients
                AudioListener.volume = 0f;
            }
        }
Example #2
0
        void Start()
        {
            NodeInformation.developmentMode = developmentMode;
            NodeInformation.Load();

            NetworkManager networkManager = GetComponent <NetworkManager>();

            networkManager.networkAddress = NodeInformation.master.ip;
            networkManager.networkPort    = NodeInformation.master.port;
            if (NodeInformation.isMaster())
            {
                networkManager.StartServer();
                //Instantiate the origin-GameObject
                GameObject objOrigin = Instantiate(origin, originParent);
                objOrigin.transform.localPosition = NodeInformation.own.originPosition;
                //Spawn the object for the clients
                NetworkServer.Spawn(objOrigin);

                //Test Master; if we remove this, then the master won't see anything (same goes for config)
                originSlave = FindOrigin();

                NodeInformation.SpawnScreenplanes(originSlave.transform.Find("ScreenPlanes"));

                trackerSettings = (TrackerSettings)originSlave.transform.Find("CameraHolder").GetComponent("TrackerSettings");
                trackerSettings.HostSettings = (TrackerHostSettings)GameObject.Find("NodeManager/TrackerHostSettings").GetComponent("TrackerHostSettings");

                trackerSettings = (TrackerSettings)originSlave.transform.Find("Flystick").GetComponent("TrackerSettings");
                trackerSettings.HostSettings = (TrackerHostSettings)GameObject.Find("NodeManager/TrackerHostSettings").GetComponent("TrackerHostSettings");
            }
            else
            {
                networkManager.StartClient();
                //The camera manipulation happens in Update()

                // deactivate music and sound for clients
                AudioListener.volume = 0f;
            }
        }