void UserTask()
    {
        if (phase == 0)
        {
            TaskText.text = "PRESS SPACE KEY";
        }

        if (gameOverFlag)
        {
            TaskText.text = "Thank You";
            return;
        }

        RayCastTest.CheckRaycast();
        string dir = PereferalTest.GetDirection();

        SockertSend.SetDirection(dir);
        SockertSend.SetNum(AnnotationIds[CurrentAnnotationId]);
        SockertSend.SetDurationFlag(false);
        SockertSend.SetMode(PlayModeSelecter.GetMode());
        SockertSend.SetPhase(phase);
        SockertSend.SetDebug(is_debug_mode);
        SockertSend.SetEnter(false);
        SockertSend.SetTrial(CurrentAnnotationId);

        /*
         * if (targetAudio != null)
         * {
         *  if (TargetTracker.screenArea.Contains(TargetTracker.targetPoint))
         *      targetAudio.volume = 1f;
         *  else
         *      targetAudio.volume = 0.3f;
         * }
         */

        if (Input.GetKeyDown(KeyCode.Space))
        {
            ProceesPhase();
            Debug.Log("Key: Space");
        }



        //フラグを全部見てから、最後にSocketを送る
        SockertSend.SyncDisplay(this);

        if (accumuDeltaTime > 1.0f / 30)
        {
            SockertSend.SyncDisplay(this);
            accumuDeltaTime = 0.0f;
        }
        accumuDeltaTime += Time.deltaTime;


        //Status Bar


        try
        {
            string objectName = RayCastTest.GetSelectedGameObject().name;
            StatusbarText.text = "mode: " + PlayModeSelecter.GetMode() + ", "
                                 + "phase: " + phase + ", "
                                 + AnnotationIds[CurrentAnnotationId] + "-" + objectName + ", dir: " + dir;
        }
        catch (System.NullReferenceException)
        {
            StatusbarText.text = "mode: " + PlayModeSelecter.GetMode() + ", "
                                 + "phase: " + phase + ", "
                                 + "-" + "null" + ", dir: " + dir;;
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        float fps = 1f / Time.deltaTime;

        //Debug.LogFormat("{0}fps", fps);

        if (phase == 0)
        {
            scoreText.text = "PRESS SPACE KEY";
        }

        if (gameOverFlag)
        {
            scoreText.text = "Thank You";
            return;
        }

        RayCastTest.CheckRaycast();
        string dir = PereferalTest.GetDirection();

        SockertSend.SetDirection(dir);
        SockertSend.SetNum(AnnotationIds[CurrentAnnotationId]);
        SockertSend.SetDurationFlag(false);
        SockertSend.SetMode(PlayModeSelecter.GetMode());
        SockertSend.SetPhase(phase);
        SockertSend.SetDebug(is_debug_mode);
        SockertSend.SetEnter(false);
        SockertSend.SetTrial(CurrentAnnotationId);

        if (Input.GetKeyDown(KeyCode.Alpha0) ||
            Input.GetKeyDown(KeyCode.Alpha1) ||
            Input.GetKeyDown(KeyCode.Alpha2) ||
            Input.GetKeyDown(KeyCode.Alpha3) ||
            Input.GetKeyDown(KeyCode.Alpha4)
            )
        {
            SetDebugMode(is_debug_mode);
            CurrentAnnotationId = 0;
            phase               = 0;
            duration            = 0.0;
            CurrentAnnotationId = 0;
            gameOverFlag        = false;
        }
        if (Input.GetKeyDown(KeyCode.Home))
        {
            LoadGame();
            Debug.Log("Key: Home");
        }

        if (Input.GetKeyDown(KeyCode.End))
        {
            SaveGame();
            Debug.Log("Key: End");
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            is_debug_mode = !is_debug_mode;
            SetDebugMode(is_debug_mode);
            Debug.Log("Key: P");
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            ForwardTempArray();
            Debug.Log("Key: F");
        }

        if (Input.GetKeyDown(KeyCode.B))
        {
            BackTempArray();
            Debug.Log("Key: B");
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            ProceesPhase();
            Debug.Log("Key: Space");
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (is_current_patternA)
            {
                AnnotationIds       = patternB;
                is_current_patternA = false;
            }
            else
            {
                AnnotationIds       = patternA;
                is_current_patternA = true;
            }

            Debug.Log("Key: Tab");
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            SockertSend.SetEnter(true);
            SetDebugMode(is_debug_mode);
            CurrentAnnotationId = 0;
            phase               = 0;
            duration            = 0.0;
            CurrentAnnotationId = 0;
            Debug.Log("Key: Enter");
        }

        if (is_current_patternA)
        {
            SockertSend.SetPattern("A");
        }
        else
        {
            SockertSend.SetPattern("B");
        }

        //フラグを全部見てから、最後にSocketを送る
        SockertSend.SyncDisplay(this);

        if (accumuDeltaTime > 1.0f / 30)
        {
            SockertSend.SyncDisplay(this);
            accumuDeltaTime = 0.0f;
        }
        accumuDeltaTime += Time.deltaTime;


        //Status Bar


        try
        {
            string objectName = RayCastTest.GetSelectedGameObject().name;
            textTarget.text = "mode: " + PlayModeSelecter.GetMode() + ", "
                              + "phase: " + phase + ", "
                              + AnnotationIds[CurrentAnnotationId] + "-" + objectName + ", dir: " + dir;
        }
        catch (System.NullReferenceException)
        {
            textTarget.text = "mode: " + PlayModeSelecter.GetMode() + ", "
                              + "phase: " + phase + ", "
                              + "-" + "null" + ", dir: " + dir;;
        }
    }