Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.IO.Ports;
  5. using System.Threading;
  6.  
  7. public class SwitchAnimation : MonoBehaviour
  8. {
  9. public Animator ramsayAnimator;
  10.  
  11. string number = "";
  12. SerialPort stream = new SerialPort("COM3", 9600);
  13. //SerialPort serial = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
  14.  
  15. void start(){
  16. stream.Open();
  17. }
  18. // Update is called once per frame
  19. void FixedUpdate()
  20. {
  21.  
  22. number = stream.ReadLine();
  23. if(number == "2"){
  24. ramsayAnimator.SetBool("bread", true);
  25. }else{
  26. ramsayAnimator.SetBool("bread", false);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement