예제 #1
0
        private void Start()
        {
            CmdConfigManager config = CmdConfigManager.Instance;

            if (config == null)
            {
                Debug.LogWarning("Missing CmdConfigManager. Is Main Scene loaded?"
                                 + "\nUsing default values from UDP Sender and Receiver components instead of configured values.");
            }

            UdpCmdConfigMgr configMgr = UdpCmdConfigMgr.Instance as UdpCmdConfigMgr;

            // Depending on the own state, this manager does not need a sender to itself, so it will be destroyed.
            // Additionally, the receiver is beeing configured.
            switch (configMgr.applicationType)
            {
            case CmdConfigManager.AppType.WALL:
                int wallUdpPort = configMgr.udpReceivingPort;                         // This port should be configured depending on application type.
                Receiver.ActivateReceiver(wallUdpPort);
                Destroy(SenderToWall.gameObject);
                SenderToWall = null;
                break;

            case CmdConfigManager.AppType.FLOOR:
                int floorUdpPort = configMgr.udpReceivingPort;                         // This should be configured depending on application type.
                Receiver.ActivateReceiver(floorUdpPort);
                Destroy(SenderToFloor.gameObject);
                SenderToFloor = null;
                break;
            }

            // All not disabled senders need to be configured and activated:
            if (SenderToWall != null)
            {
                string wallIp      = configMgr.udpAddress;            // SenderToWall.IpAddress
                int    wallUdpPort = configMgr.udpSendingPort;        // SenderToWall.Port;
                SenderToWall.ActivateSender(wallIp, wallUdpPort);
            }
            if (SenderToFloor != null)
            {
                string floorIp      = configMgr.udpAddress;            // SenderToFloor.IpAddress
                int    floorUdpPort = configMgr.udpSendingPort;        // SenderToFloor.Port
                SenderToFloor.ActivateSender(floorIp, floorUdpPort);
            }

            // Subscribe receiving events:
            Receiver.SubscribeReceiveEvent(OnReceivedMessage);
        }
예제 #2
0
        private void Awake()
        {
            targetTrans = transform;

            if (moveTrans == null)
            {
                moveTrans = targetTrans.parent;
            }

            // If the transform is set as child object, this algorithm wont work. (Except, by temporary saving this transform and setting it back after moving the parent)
            targetTrans.parent = null;

            _configMgr = CmdConfigManager.Instance as UdpCmdConfigMgr;

            //QualitySettings.vSyncCount = 2; // Make vSync 2 times before rendering -> Results in 30 FPS rendering.
            //Application.targetFrameRate = 30; // Only works, if vSync is off (vSyncCount = 0).
            //timeTillUpdate = (1f / 60f) * updateEachFrame;
        }
    void Awake()
    {
        // Overwriting the setting from TrackerHostSettings with the IP that was set via Command Line:
        UdpCmdConfigMgr cmdConfigMgr = CmdConfigManager.Instance as UdpCmdConfigMgr;

        if (cmdConfigMgr != null)
        {
            _hostSettings.Hostname = cmdConfigMgr.vrpnHost;
        }
        else
        {
            Debug.LogWarning("UdpCmdConfigMgr could not be found.");
        }

        _colors = new List <Color> ();
        _colors.Add(new Color(255, 0, 0));
        _colors.Add(new Color(0, 255, 0));
        _colors.Add(new Color(0, 0, 255));
    }
 private void Awake()
 {
     _configMgr = UdpCmdConfigMgr.Instance as UdpCmdConfigMgr;
 }