// Initialization code private void init () { // Initialize (seen in comments window) print ("UDP Object init()"); // Initialize the reference for other game objects (Implementation Specific) ic1 = GameObject.Find("Indicator 1").gameObject.GetComponent<IndicatorController>(); ic2 = GameObject.Find("Indicator 2").gameObject.GetComponent<IndicatorController>(); ic3 = GameObject.Find("Indicator 3").gameObject.GetComponent<IndicatorController>(); ic4 = GameObject.Find("Indicator 4").gameObject.GetComponent<IndicatorController>(); timingBar = GameObject.Find("Timing Bar").gameObject.GetComponent<TimingBarController>(); // cursor = GameObject.Find("Cursor").gameObject.GetComponent<CursorController>(); gridc = GameObject.Find("8x8 Grid Quad").gameObject.GetComponent<EightbyEightController>(); // Create remote endpoint (to Matlab) remoteEndPoint = new IPEndPoint (IPAddress.Parse (IP), portRemote); // Create local client client = new UdpClient (portLocal); // Local endpoint define (where messages are received) // Create a new thread for reception of incoming messages // Thread runs in the background and does not interfere with the main application receiveThread = new Thread ( new ThreadStart (ReceiveData)); // Run the thread in the background receiveThread.IsBackground = true; receiveThread.Start (); }
// private EightbyEightController gridc; // Start is called before the first frame update void Start() { // Initialize the reference for other game objects (Implementation Specific) ic1 = GameObject.Find("Indicator 1").gameObject.GetComponent <IndicatorController>(); ic2 = GameObject.Find("Indicator 2").gameObject.GetComponent <IndicatorController>(); ic3 = GameObject.Find("Indicator 3").gameObject.GetComponent <IndicatorController>(); ic4 = GameObject.Find("Indicator 4").gameObject.GetComponent <IndicatorController>(); ic5 = GameObject.Find("Indicator 5").gameObject.GetComponent <IndicatorController>(); ic6 = GameObject.Find("Indicator 6").gameObject.GetComponent <IndicatorController>(); timingBar = GameObject.Find("Timing Bar").gameObject.GetComponent <TimingBarController>(); // cursor = GameObject.Find("Cursor").gameObject.GetComponent<CursorController>(); // gridc = GameObject.Find("8x8 Grid Quad").gameObject.GetComponent<EightbyEightController>(); udp1 = GameObject.Find("UDP 1").gameObject.GetComponent <UDPController>(); // udp2 = GameObject.Find("UDP 2").gameObject.GetComponent<UDPController>(); prevmessage1 = udp1.lastReceivedUDPPacket; // prevmessage2 = udp2.lastReceivedUDPPacket; }
void Start() { xpos = xstart; ypos = ystart; randomize = 0; gridNumber = xpos + (ypos - 1) * 10; robot = GameObject.Find("Robot").gameObject.GetComponent <RobotController>(); ball = GameObject.Find("Ball 1").gameObject.GetComponent <BallController>(); // Initialize the reference for other game objects (Implementation Specific) ic1 = GameObject.Find("Indicator 1").gameObject.GetComponent <IndicatorController>(); ic2 = GameObject.Find("Indicator 2").gameObject.GetComponent <IndicatorController>(); ic3 = GameObject.Find("Indicator 3").gameObject.GetComponent <IndicatorController>(); ic4 = GameObject.Find("Indicator 4").gameObject.GetComponent <IndicatorController>(); timingBar = GameObject.Find("Timing Bar").gameObject.GetComponent <TimingBarController>(); // Define grid color color.r = 0.5f; color.g = 0.5f; color.b = 0.5f; Debug.Log("Test: Ball " + randomize.ToString()); ignore = 0; }
// Controller References (Implementation Specific) // Modify parts of the controller script on those objects // start from Unity3d public void Start() { init(); grid = GameObject.Find("8x8 Grid Step").gameObject.GetComponent <GridNavigationController>(); timingBar = GameObject.Find("Timing Bar").gameObject.GetComponent <TimingBarController>(); }