Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        SerialHandler_ = GameObject.Find("SerialHandler").GetComponent <SerialHandler>();

        ForceText_ = transform.Find("ForceText").GetComponent <Text>();
        PreceText_ = transform.Find("PreceText").GetComponent <Text>();
    }
 // Use this for initialization
 void Start()
 {
     serialHandler = GameObject.Find("SerialHandler").GetComponent <SerialHandler>();
     StartCoroutine("moveToRankingScene");
     audioController = GameObject.Find("AudioController");
     serialHandler.SetSceneState(SerialHandler.SceneStateE.sceneStateAppreciate);
 }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        //Read Input from keyboard
        if (Input.GetKeyDown(interaction.keyCode))
        {
            interaction.value = !interaction.value;
        }

        if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;
        }

        if (interaction.value)
        {
            animator.SetInteger("AnimState", 1);
            interaction.counter += Time.deltaTime;
            if (interaction.counter > interaction.timeOut)
            {
                interaction.value   = !interaction.value;
                interaction.counter = 0;
            }
        }
        else
        {
            animator.SetInteger("AnimState", 0);
        }
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     serialHandler = GameObject.Find("SerialHandler").GetComponent <SerialHandler>();
     //信号を受信したときに、そのメッセージの処理を行う
     serialHandler.OnDataReceived += OnDataReceived;
     serialHandler.SetSceneState(SerialHandler.SceneStateE.sceneStatePlaying);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Switch mode to disconnected
 /// </summary>
 public void SwitchToDisconnected()
 {
     IsModeConnected = false;
     SerialHandler.ClosePort();
     SeriesCollection[0].Values.Clear();
     SerialHandler.IncomingData.Clear();
     Timestamp = "";
     if (SeriesCollection.Count == 1)
     {
         SeriesCollection.Add(
             new LineSeries
         {
             Title           = "Low",
             Values          = new ChartValues <ObservablePoint>(),
             LineSmoothness  = 0.1,
             StrokeThickness = 0.5
         });
         SeriesCollection.Add(
             new LineSeries
         {
             Title           = "High",
             Values          = new ChartValues <ObservablePoint>(),
             LineSmoothness  = 0.1,
             StrokeThickness = 0.5
         });
     }
     dataX = 0;
 }
Exemplo n.º 6
0
    void Start()
    {
        SerialHandler_ = GameObject.Find("systemManager").GetComponent <SerialHandler>();

        line = diagram.AddLine("force", Color.yellow);

        time = 0;
    }
 // Use this for initialization
 void Start()
 {
     serialHandler = GameObject.Find("SerialHandler").GetComponent <SerialHandler>();
     countText     = GetComponent <Text>();
     sound         = GetComponent <AudioSource>();
     StartCoroutine("countDownStartTime", maxCount);
     serialHandler.SetSceneState(SerialHandler.SceneStateE.sceneStateWaitingStart);
 }
Exemplo n.º 8
0
	void Awake()
	{
		if(instance == null) {
			instance = this;
		} else {
			Destroy( this );
		}
	}
Exemplo n.º 9
0
 void Awake()
 {
     serial = gameObject.GetComponent <SerialHandler>();
     if (serial == null)
     {
         Debug.LogError("No SerialHandler script on this object");
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Sets up serial port connection
        /// </summary>
        /// <returns>True if connection was successfully established</returns>
        public bool SetUpSerial()
        {
            SerialHandler = SerialFacade.GetInstance();
            SerialHandler.SetVM(this);
            SerialHandler.IncomingData.CollectionChanged += SerialIncomingData_CollectionChanged;

            IsSerialWorking = SerialHandler.SetupConnection();
            return(IsSerialWorking);
        }
Exemplo n.º 11
0
 void ReadInput()
 {
     //interaction.value = (Input.GetKeyDown(interaction.keyCode));
     //|| (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1));
     if ((Input.GetKeyDown(interaction.keyCode)) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
     {
         interaction.value = true;
     }
 }
Exemplo n.º 12
0
 void Start()
 {
     _serial                 = new SerialHandler();
     _serial.portName        = COMPort;
     _serial.baudRate        = 115200;
     _data[0]                = (byte)'d';
     _serial.OnDataReceived += OnDataReceived;
     _serial.Open(false);
 }
Exemplo n.º 13
0
 void Start()
 {
     lightComponent = GetComponent <Light>();
     serialHandler  = new SerialHandler();
     serialHandler.OnDataReceived += OnDataReceived;
     serialHandler.SendLog        += WriteLog;
     serialHandler.Init("Write serial port name", 115200);
     serialHandler.StartRead();
 }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        save_ = save.GetComponent <Text>();

        save_.text = "stop_save";

        saveCheck = false;

        SerialHandler_ = maneger_.GetComponent <SerialHandler>();
    }
Exemplo n.º 15
0
        private void button1_Click(object sender, EventArgs e)
        {
            var serialHandler = new SerialHandler();

            serialHandler.InitSerial("COM3");
            var t = new Thread(() => serialHandler.RequestJvsInformation());

            t.Start();
            //serialHandler.CloseSerial();
        }
Exemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        string[] names = SerialHandler.getPortNames();
        for (int i = 0; i < names.Length; i++)
        {
            Debug.Log(names[i]);
        }

        serial.OnDataReceived += Serial_OnDataReceived;
    }
Exemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("@SerialTestClient");
     SerialHandler.Open();
     SerialHandler.Pressed   += onPressed;
     SerialHandler.Pressing  += onPressing;
     SerialHandler.Released  += onReleased;
     SerialHandler.SwitchOn  += onSwitchOn;
     SerialHandler.SwitchOff += onSwitchOff;
 }
Exemplo n.º 18
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Exemplo n.º 19
0
    public void onClick()
    {
        Text text      = InputMessage.GetComponent <Text>();
        Text inputtext = input.GetComponent <Text>();

        text.text = inputtext.text;
        Debug.Log(text.text);
        SerialHandler sh = SerialHandler.GetComponent <SerialHandler>();

        sh.Write(text.text);
    }
Exemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     miss          = 0;
     serialHandler = GameObject.Find("SerialHandler").GetComponent <SerialHandler>();
     //信号を受信したときに、そのメッセージの処理を行う
     serialHandler.OnDataReceived += OnDataReceived;
     hitObject      = GameObject.Find("HitLabel");
     hitImageObject = GameObject.Find("TargetImage");
     hitTextObject  = GameObject.Find("HitText");
     hitObject.SetActive(false);
 }
Exemplo n.º 21
0
        private void HandleTraffic()
        {
            Thread.Sleep(1000);
            KillTheThread = false;
            var serialHandler = new SerialHandler();

            serialHandler.InitSerial("COM3");
            var jvsThread = new Thread(() => serialHandler.RequestJvsInformation());

            jvsThread.Start();
            var keyb       = new KeyboardInjector.KeyboardInject();
            var idSet      = false;
            var vJoyFeeder = new vJoyInjector.VJoyFeeder();

            while (!KillTheThread)
            {
                if (!serialHandler.JvsInformation.SyncOk)
                {
                    Thread.Sleep(10);
                    continue;
                }

                if (!jvsThread.IsAlive)
                {
                    Thread.Sleep(100);
                    jvsThread = new Thread(() => serialHandler.RequestJvsInformation());
                    jvsThread.Start();
                    Thread.Sleep(100);
                }
                vJoyFeeder.Digitals       = serialHandler.JvsInformation.DigitalBytes;
                vJoyFeeder.AnalogChannels = serialHandler.JvsInformation.AnalogChannels;
                if (idSet)
                {
                    keyb.SendInputs(serialHandler.JvsInformation.DigitalBytes);
                }
                if (!idSet && serialHandler.JvsInformation.JvsIdentifier != "")
                {
                    idSet = true;
                    //keyb.Initialize();
                    new Thread(vJoyFeeder.StartInjector).Start();
                    Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                    {
                        TxtJvsIo.Text += serialHandler.JvsInformation.JvsIdentifier;
                        TxtJvsCmd.Text += serialHandler.JvsInformation.CmdFormatVersion.ToString("X2");
                        TxtJvsVersion.Text += serialHandler.JvsInformation.JvsVersion.ToString("X2");
                        TxtJvsComm.Text += serialHandler.JvsInformation.CommVersion.ToString("X2");
                    }));
                }
                Thread.Sleep(10);
            }
            vJoyFeeder.KillMe = true;
            serialHandler.CloseSerial();
        }
Exemplo n.º 22
0
 // Start is called before the first frame update
 void Start()
 {
     currentModuleNum = 1;
     serialHandler    = GameObject.Find("SerialHandler").GetComponent <SerialHandler>();
     //信号を受信したときに、そのメッセージの処理を行う
     serialHandler.OnDataReceived += OnDataReceived;
     passObject = GameObject.Find("PassLabel");
     //passImageObject = GameObject.Find("PassImage");
     //passTextObject = GameObject.Find("PassText");
     passText = GameObject.Find("PassText").GetComponent <Text>();
     passObject.SetActive(false);
 }
Exemplo n.º 23
0
    protected virtual void Start()
    {
        if (!_serialHandler)
        {
            _serialHandler = GetComponent <SerialHandler>();
        }
        _rigidbody = GetComponent <Rigidbody>();
        _serialHandler.OnDataReceived += OnDataReceived;
        var hitHandler = _virtualHand_R.gameObject.GetComponent <HitEventHandler>();

        hitHandler.OnHitEnter += OnHandEnter;
    }
Exemplo n.º 24
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(interaction.keyCode))
        {
            interaction.value = !interaction.value;
        }
        if (Input.GetKeyDown(interaction.keyCode2))
        {
            interaction.value2 = !interaction.value2;
        }

        if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;
        }
        if (SerialHandler.serial_is_open && SerialHandler.getSensorDown((int)interaction.sensorTrigger2))
        {
            interaction.value2 = !interaction.value2;
        }


        if (state == 0)
        {
            if (interaction.value)
            {
                animator.SetTrigger("state1");
                state = 1;
                interaction.value2 = false;
                interaction.value  = false;
            }
        }

        else if (state == 1)
        {
            if (interaction.value2)
            {
                animator.SetTrigger("state2");
                state = 2;
                interaction.value2  = false;
                interaction.value   = false;
                interaction.counter = 0;
            }

            TimerCount();
        }

        else if (state == 2)
        {
            TimerCount();
        }
    }
Exemplo n.º 25
0
 /// <summary>
 /// Switch mode to connected
 /// </summary>
 /// <returns></returns>
 public bool SwitchToConnected()
 {
     if (!SerialHandler.OpenPort())
     {
         Debug.WriteLine("couldnt open port");
         return(false);
     }
     while (SeriesCollection.Count > 1)
     {
         SeriesCollection.RemoveAt(SeriesCollection.Count - 1);
     }
     IsModeConnected = true;
     return(true);
 }
Exemplo n.º 26
0
//     [Inlet]
//     public float Actuator5
//     {
//         set
//         {
//             Actuators[4] = CheckTemp(value);
//         }
//     }

    void Start()
    {
        _serial                 = new SerialHandler();
        _serial.portName        = COMPort;
        _serial.baudRate        = 115200;
        _serial.OnDataReceived += OnDataReceived;
        _serial.Open(true);
        Thread.Sleep(500);

        for (int i = 0; i < 4; ++i)
        {
            _average[i] = new MovingAverageF(SamplesCount);
        }
    }
Exemplo n.º 27
0
        public bool DecreaseBrightness()
        {
            int value = int.Parse(BrightnessValue);

            if (value > 0)
            {
                BrightnessValue = (--value).ToString();
                if (!SerialHandler.SendBrightnessValue(value))
                {
                    MessageBox.Show("Connection lost...switching to disconnected mode");
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 28
0
    void Start()
    {
        serial = SerialHandler.Instance;
        bool success = serial.Open(portNum, SerialHandler.Baudrate.B_115200);

        if (!success)
        {
            return;
        }
        serial.OnDataReceived += SerialCallBack;
//
        player = GameObject.Find("Player") as GameObject;
//
//
    }
Exemplo n.º 29
0
    // Update is called once per frame
    void Update()
    {
        SerialHandler sh = GetComponent <SerialHandler>();

        Debug.Log(sh.X + sh.Y + sh.Z);

        if (sh.Y >= 60 && sh.Y <= 90 && sh.Z <= -100)
        {
            Debug.Log("パンチ(手:横)");
        }

        if (sh.Y >= 0 && sh.Y <= 50 && sh.Z <= -100)
        {
            Debug.Log("パンチ(手:正面)");
        }
    }
Exemplo n.º 30
0
    void ReadInput()
    {
        if (Input.GetKey(interaction.keyCode) || SerialHandler.getSensorDown((int)interaction.sensorTrigger1))
        {
            interaction.value = !interaction.value;


            //Debug.Log("masuk 1");
        }
        if (Input.GetKey(interaction.keyCode2) || SerialHandler.getSensorDown((int)interaction.sensorTrigger2))
        {
            interaction.value2 = !interaction.value2;


            //Debug.Log("masuk 2");
        }
    }
Exemplo n.º 31
0
 void Awake()
 {
     // スクリプトが設定されていなければゲームオブジェクトを残しつつスクリプトを設定
     if (singleton == null)
     {
         DontDestroyOnLoad(gameObject);
         singleton = this;
         Open();
         is_added_event [0] = false;
         is_added_event [1] = false;
         // 既にGameStartスクリプトがあればこのシーンの同じゲームオブジェクトを削除
     }
     else
     {
         Destroy(this);
     }
 }
Exemplo n.º 32
0
    //private int[] pat30;
    // Use this for initialization
    void Start()
    {
        //Define frame rate
        Application.targetFrameRate = 60;

        //Set UDPReceiver instance & Port number set
        udprcv = GetComponent<UDPReceiver> ();
        udprcv.PORT_SET_INIT (20321, 20322, 20323, 20324, 20326, 20327);

        //Set serialHandler
        serialHandler = GetComponent<SerialHandler> ();

        //Set indicatorSetter
        indicatorSetter = GetComponent<IndicatorSetter> ();

        //Set indicatorSetter
        stateMachine = GetComponent<StateMachine> ();

        //Set GetComponents (must be put here, or Start() function)
        box1 = systemObj1.GetComponent<Image>();
        box2 = systemObj2.GetComponent<Image>();
        box3 = systemObj3.GetComponent<Image>();
        box4 = systemObj4.GetComponent<Image>();

        //Indicators in pic
        text_Indicator1 = systemObj_I1.GetComponent<Text> ();
        text_Indicator2 = systemObj_I2.GetComponent<Text> ();
        text_Indicator3 = systemObj_I3.GetComponent<Text> ();
        text_Indicator4 = systemObj_I4.GetComponent<Text> ();
        box_Indicator1 = systemObj_boxI1.GetComponent<Text> ();
        box_Indicator2 = systemObj_boxI2.GetComponent<Text> ();
        box_Indicator3 = systemObj_boxI3.GetComponent<Text> ();
        box_Indicator4 = systemObj_boxI4.GetComponent<Text> ();
        text_MessageLog = systemObj_MessageLog.GetComponent<Text> ();

        //(For debug)
        text1 = systemObj5.GetComponent<Text> ();
        //text2 = systemObj6.GetComponent<Text> ();
        textA = systemObj7.GetComponent<Text> ();
        textB = systemObj8.GetComponent<Text> ();
        textC = systemObj9.GetComponent<Text> ();
        textD = systemObj10.GetComponent<Text> ();
        text_PORT1 = systemObj11.GetComponent<Text> ();
        text_PORT2 = systemObj12.GetComponent<Text> ();
        text_PORT3 = systemObj13.GetComponent<Text> ();
        text_PORT4 = systemObj14.GetComponent<Text> ();
        //text_PORT5 = systemObj15.GetComponent<Text> ();

        //Set BoxFlicker instance
        box_A = systemObj1.AddComponent<BoxFlicker>();
        box_B = systemObj2.AddComponent<BoxFlicker>();
        box_C = systemObj3.AddComponent<BoxFlicker>();
        box_D = systemObj4.AddComponent<BoxFlicker>();

        //Set patternArray
        patternArray = GetComponent<PatternArray> ();
        patA = patternArray.getPat7_sin_plus1();
        patB = patternArray.getPat15();
        patC = patternArray.getPat12_sin_plus1();
        patD = patternArray.getPat20_sin_plus1();

        //pat30 = patternArray.getPat30();

        box_A.Setting (patA, box1);
        box_B.Setting (patB, box2);
        box_C.Setting (patC, box3);
        box_D.Setting (patD, box4);
    }