コード例 #1
0
    void Update()
    {
        // don't bother if not connected to decoder...
        if (!nt.isConnected())
        {
            tryToConnect(1); // fast connection retry?
            if (!nt.isConnected())
            {
                return;
            }
        }

        nframe++;
        // don't update the code-stuff if in slowdown mode..
        if (nframe % Math.Max(FRAMESPERCODEBIT, 1) != 0)
        {
            return;
        }

        wasRunning = isRunning;
        isRunning  = nt.updateStimulusState(nframe);
        if (!isRunning)
        {
            if (wasRunning && sequenceCompleteEvent != null) // we have just finished a nt sequence
            {
                sequenceCompleteEvent.Invoke();
            }
            return;

            nt.startExpt(10, 10, .1f);
        }
        stimulusState = nt.getStimulusState();
        Debug.Log(stimulusState);
        if (stimulusState != null && stimulusState.targetState >= 0)
        {
            logstr += stimulusState.targetState > 0 ? "*" : ".";
        }
        else
        {
            logstr += String.Format("{0:d} ", nframe);
        }
        if (logstr.Length > 60)
        {
            Debug.Log(logstr); logstr = "";
        }
        nt.sendStimulusState(lastframetime);
    }
コード例 #2
0
    void Update()
    {
        // don't bother if not connected to decoder...
        if (!this.nt.isConnected())
        {
            //Debug.Log("Noise-tag is not connected!");
            return;
        }

        nframe++;
        // don't update the code-stuff if in slowdown mode..
        //if (nframe % Math.Max(FRAMESPERCODEBIT,1) != 0) return;

        wasRunning = isRunning;
        isRunning  = this.nt.updateStimulusState(nframe);
        if (!isRunning)
        {
            if (wasRunning && sequenceCompleteEvent != null) // we have just finished a nt sequence
            {
                sequenceCompleteEvent.Invoke();
            }
            return;
        }
        stimulusState = nt.getStimulusState();
        //if (stimulusState != null ) Debug.Log(stimulusState);
        if (stimulusState != null && stimulusState.target_idx >= 0 && stimulusState.target_idx < stimulusState.stimulusState.Length)
        {
            logstr += stimulusState.stimulusState[stimulusState.target_idx] > 0 ? "*" : ".";
        }
        else
        {
            logstr += "_";
        }
        if (logstr.Length > 60)
        {
            Debug.Log(logstr); logstr = "";
        }
        nt.sendStimulusState(lastframetime);
    }