Beispiel #1
0
 void Initialize()
 {
     Debug.Log("Input.GetButtonDown : Jump ");
     theClient.Press(0);
     Debug.Log("Input.GetButtonUp : Jump ");
     theClient.Release(0);
 }
Beispiel #2
0
    int buttonIndexNum = 3;   // End condition is 3.

    void Start()
    {
        // Stimulate when the game is over.
        var Client = GameObject.Find("Camera").GetComponent <SystemControl>();

        theClient = Client.theClient;
        Debug.Log("Competition is finished!");
        theClient.Press(buttonIndexNum);
    }
Beispiel #3
0
    void Update()
    {
        if (CheckPause)
        {
            return;
        }
        if (CheckTheEnd)  // If the checking result from ResultUI is the end, it will not do anything.
        {
            return;
        }


        // Record
        var Car_1P = GameObject.Find("Car_1P").GetComponent <MoveCar1>(); // Reference the script 'MoveCar1'
        var Car_2P = GameObject.Find("Car_2P").GetComponent <MoveCar2>();

        record_1P = Car_1P.Car.transform.position.z - Ivalue; // Since the initialized position value 'z' of car is Ivalue. ex> 5
        record_2P = Car_2P.Car.transform.position.z - Ivalue;

        DefaultScore1P.text = record_1P.ToString("f2") + "m";
        DefaultScore2P.text = record_2P.ToString("f2") + "m";

        // Timer
        timeCount        += Time.deltaTime;
        DefaultTimer.text = timeCount.ToString("f2");

        // Stimulate for starting check and trainning time check
        var Client = GameObject.Find("Camera").GetComponent <SystemControl>();

        theClient = Client.theClient;

        if (stimForInit)
        {
            Debug.Log("Competition, Initialize!");
            theClient.Press(buttonIndexNum);
            stimForInit = false;
        }
        if (timeCount > trainningTime && stimForTrain)
        {
            Debug.Log("Time is up, Trainning is finished!");
            theClient.Press(buttonIndexNum);
            stimForTrain = false;
        }
    }
 void Getting()
 {
     // For getting the data of keyboard
     if (Input.GetButtonDown("Jump")) // pressed
     {
         Debug.Log("Input.GetButtonDown : Jump ");
         theClient.Press(0);
     }
     if (Input.GetButtonUp("Jump")) // released
     {
         Debug.Log("Input.GetButtonUp : Jump ");
         theClient.Release(0);
     }
 }
Beispiel #5
0
    public void Blink()
    {
        if (blinkcnt < BlinkCount)
        {
            rndnum = UnityEngine.Random.Range(0, 4);
            if (rndnum == 0 && arrow0 == true)
            {
                arrow0 = false;

                pubimg = UpArrow;
                if (isBlinking)
                {
                    return;
                }
                if (pubimg != null)
                {
                    isBlinking = true;
                    InvokeRepeating("ToggleState", startDelay, interval);
                }
            }
            else if (rndnum == 0 && arrow0 == false)
            {
                Blink();
            }
            else if (rndnum == 1 && arrow1 == true)
            {
                arrow1 = false;

                pubimg = DownArrow;
                if (isBlinking)
                {
                    return;
                }

                if (pubimg != null)
                {
                    isBlinking = true;
                    InvokeRepeating("ToggleState", startDelay, interval);
                }
            }
            else if (rndnum == 1 && arrow1 == false)
            {
                Blink();
            }
            else if (rndnum == 2 && arrow2 == true)
            {
                arrow2 = false;

                pubimg = LeftArrow;
                if (isBlinking)
                {
                    return;
                }

                if (pubimg != null)
                {
                    isBlinking = true;
                    InvokeRepeating("ToggleState", startDelay, interval);
                }
            }
            else if (rndnum == 2 && arrow2 == false)
            {
                Blink();
            }
            else if (rndnum == 3 && arrow3 == true)
            {
                arrow3 = false;

                pubimg = RightArrow;
                if (isBlinking)
                {
                    return;
                }

                if (pubimg != null)
                {
                    isBlinking = true;
                    InvokeRepeating("ToggleState", startDelay, interval);
                }
            }
            else if (rndnum == 3 && arrow3 == false)
            {
                Blink();
            }

            if (arrow0 == false && arrow1 == false && arrow2 == false && arrow3 == false)
            {
                arrow0 = true;
                arrow1 = true;
                arrow2 = true;
                arrow3 = true;
            }
        }
        else
        {
            targetChange++;
            if (targetChange == 4)
            {
                theClient.Press(2); //training이 끝났다는 신호를 보내기 위한 Button
            }

            /*   theClient.GetOrder();
             * switch (theClient.recStr)
             * {
             *     case "0":
             *         order = 0;
             *         break;
             *     case "1":
             *         order = 1;
             *         break;
             *     case "2":
             *         order = 2;
             *         break;
             *     case "3":
             *         order = 3;
             *         break;
             *     default:
             *         break;
             * }
             */
        }
    }