void VarInit()
    {
        BoxAnnotations = new GameObject[OBJECT_MAX];
        for (int i = 0; i < OBJECT_MAX; i++)
        {
            //GameObjectを格納
            BoxAnnotations[i] = m_TargetObj[i];
        }
        DebugLog = GameObject.Find("DebugLog");

        //変数の初期化
        phase = 0;
        CurrentAnnotationId = 0;
        viewPortFlag        = false;

        SockertSend.SetNum(0);
        SockertSend.SetMode(0);
        SockertSend.SetTrial(0);
        SockertSend.SetNumFlag(false);
        SockertSend.SetDuration(0.0);
        SockertSend.SetAnswer("00");
        SockertSend.SetDurationFlag(false);
        SockertSend.SetDirectionFlag(false);
        SockertSend.SetDirection("no");
        SockertSend.SyncDisplay(this);
    }
示例#2
0
    void VarInit()
    {
        //変数の初期化
        phase = 0;
        CurrentAnnotationId = 0;
        viewPortFlag        = false;

        cursor = GameObject.Find("Panel");
        //display=GameObject.Find("Display");

        BoxAnnotations = new GameObject[OBJECT_MAX];

        for (int i = 0; i < OBJECT_MAX; i++)
        {
            //GameObjectを格納
            BoxAnnotations[i] = GameObject.Find("Cube" + BoxIds[i]);
            BoxAnnotations[i].GetComponent <Renderer>().material.color = BoxInvisibleColor;
        }

        DebugLog = GameObject.Find("DebugLog");

        for (int i = 0; i < OBJECT_MAX; i++)
        {
            //テクスチャ変更
            BoxAnnotations[i].GetComponent <Renderer>().material.mainTexture = targetTexture;
        }

        //Displayと名の付くオブジェクトを代入
        //PereferalTest.arrow.SetActive(false);

        SockertSend.SetNum(0);
        SockertSend.SetMode(0);
        SockertSend.SetTrial(0);
        SockertSend.SetNumFlag(false);
        SockertSend.SetDuration(0.0);
        SockertSend.SetAnswer("00");
        SockertSend.SetDurationFlag(false);
        SockertSend.SetDirectionFlag(false);
        SockertSend.SetDirection("no");
        SockertSend.SyncDisplay(this);
    }
    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;;
        }
    }
    void Update()
    {
        float fps = 1f / Time.deltaTime;

        //Debug.Log(DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"));

        if (select_mode == 0)
        {
            if (Input.GetKeyDown("r") && Input.GetKey("x"))
            {
                transform.Rotate(new Vector3(0.5f, 0, 0));
            }

            if (Input.GetKeyDown("l") && Input.GetKey("x"))
            {
                transform.Rotate(new Vector3(-0.5f, 0, 0));
            }
            if (Input.GetKeyDown("r") && Input.GetKey("y"))
            {
                transform.Rotate(new Vector3(0, 0.5f, 0));
            }
            if (Input.GetKeyDown("l") && Input.GetKey("y"))
            {
                transform.Rotate(new Vector3(0, -0.5f, 0));
            }

            if (Input.GetKeyDown("r") && Input.GetKey("z"))
            {
                transform.Rotate(new Vector3(0, 0, 0.5f));
            }
            if (Input.GetKeyDown("l") && Input.GetKey("z"))
            {
                transform.Rotate(new Vector3(0, 0, -0.5f));
            }

            //情報提示パターンの選択
            TaskText.text = "提示パターン選択";

            if (Input.GetKeyDown("1"))
            {
                //中心視
                select_mode = 1;
                arrowObj.SetActive(true);
                DebugLog.SetActive(false);
                StatusbarText.enabled = false;
                InvBoxColor();
            }
            else if (Input.GetKeyDown("2"))
            {
                //音像定位
                select_mode = 2;
                arrowObj.SetActive(false);
                DebugLog.SetActive(false);
                StatusbarText.enabled = false;
                InvBoxColor();
            }
            else if (Input.GetKeyDown("3"))
            {
                //周辺視のみ
                select_mode = 3;
                arrowObj.SetActive(false);
                DebugLog.SetActive(false);
                StatusbarText.enabled = false;
                InvBoxColor();
            }
            else if (Input.GetKeyDown("4"))
            {
                //Debugモード
                select_mode = 4;
                arrowObj.SetActive(true);
                DebugLog.SetActive(true);
                StatusbarText.enabled = true;
                LookBoxColor();
            }

            if (select_mode != 0)
            {
                audio2.Play();
            }
        }



        if (select_mode != 0 && AnnotationIds == null)
        {
            TaskText.text = "探索パターンを選択";

            if (Input.GetKeyDown("a"))
            {
                AnnotationIds = patternA;
                TARGET_MAX    = 10;
            }
            else if (Input.GetKeyDown("b"))
            {
                AnnotationIds = patternB;
                TARGET_MAX    = 10;
            }
            else if (Input.GetKeyDown("c"))
            {
                AnnotationIds = patternC;
                TARGET_MAX    = 10;
            }
            else if (Input.GetKeyDown("d"))
            {
                AnnotationIds = patternD;
                TARGET_MAX    = 3;
            }
            else if (Input.GetKeyDown("e"))
            {
                AnnotationIds = patternE;
                TARGET_MAX    = 3;
            }
            else if (Input.GetKeyDown("f"))
            {
                AnnotationIds = patternF;
                TARGET_MAX    = 3;
            }
        }

        if (select_mode != 0 && AnnotationIds != null)
        {
            UserTask();
        }


        if (Input.GetKeyDown(KeyCode.Return))
        {
            SockertSend.SetEnter(true);
            SockertSend.SetNum(0);
            SockertSend.SetMode(0);
            SockertSend.SetTrial(0);
            SockertSend.SetNumFlag(false);
            SockertSend.SetDuration(0.0);
            SockertSend.SetAnswer("00");
            SockertSend.SetDurationFlag(false);
            SockertSend.SetDirectionFlag(false);
            SockertSend.SetDirection("no");
            SockertSend.SyncDisplay(this);
            SetDebugMode(is_debug_mode);
            phase               = 0;
            duration            = 0.0;
            CurrentAnnotationId = 0;
            select_mode         = 0;
            gameOverFlag        = false;
            AnnotationIds       = null;
            DebugLog.SetActive(true);
            MeasureTime = new double[10];
            TargetTracker.targetObject = display;
            Debug.Log("Key: Enter");
        }
    }
示例#5
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;;
        }
    }