コード例 #1
0
    public void SetObstacleDifficutly(string state)
    {
        switch (state)
        {
        case "easy":
            Current_Obstacle_Difficulty = OBSTACLEDIFF_EASY;
            break;

        case "medium":
            Current_Obstacle_Difficulty = OBSTACLEDIFF_MEDIUM;
            break;

        case "hard":
            Current_Obstacle_Difficulty = OBSTACLEDIFF_HARD;
            break;

        case "off":
        default:
            Current_Obstacle_Difficulty = OBSTACLEDIFF_OFF;
            break;
        }

        Debug.Log("Obstacle difficulty set to: " + state);
        ExecuteOnMainThread.AddAction(() => { roomMover.SpawnObstacles(); });
    }
コード例 #2
0
    public void ToggleCogCursor(bool state)
    {
        Display_COG_Cursor = state;
        ExecuteOnMainThread.AddAction(() => { image_cogCursor.gameObject.SetActive(Display_COG_Cursor); });

        Debug.Log("Display cog cursor set to: " + Display_COG_Cursor);
    }
コード例 #3
0
    private void ToggleTargetArea(bool state)
    {
        Display_TargetArea = state;

        ExecuteOnMainThread.AddAction(() => { image_targetArea.gameObject.SetActive(Display_TargetArea); });
        Debug.Log("Display target area set to: " + Display_TargetArea);
    }
コード例 #4
0
    public void ToggleInvisibleComplianceMode(string state)
    {
        InvisibleComplianceMode = (state.ToLower() == "on");

        ExecuteOnMainThread.AddAction(() => {
            image_targetArea.GetComponent <SpriteRenderer>().enabled = InvisibleComplianceMode;
            image_cogCursor.GetComponent <SpriteRenderer>().enabled  = InvisibleComplianceMode;
        });

        Debug.Log("invisible compliance mode set to " + InvisibleComplianceMode);
    }
コード例 #5
0
    private void UpdateProtocolData(ProtocolData d)
    {
        if (d.TestRunning != isRunning)
        {
            ExecuteOnMainThread.AddAction(() => { StartStopTest(d.TestRunning); });
        }

        float x = d.COGX * Current_Movement_Gain;
        float y = -d.COGY * Current_Movement_Gain;

        if (Math.Abs(x) < 0.003)
        {
            x = 0;
        }

        if (Math.Abs(y) < 0.003)
        {
            y = 0;
        }

        ExecuteOnMainThread.AddAction(() => { HandleBPCursor(x, y); });

        if (swayAngleCount >= swayAngleCountNeeded)
        {
            float newSwayAngle = d.SwayAngle - swayAngleOffset;
            if (newSwayAngle != currentSwayAngle)
            {
                currentSwayAngle = newSwayAngle;
                ExecuteOnMainThread.AddAction(() => { SwayAngleChanged(); });
            }
        }
        else
        {
            swayAngleSum += d.SwayAngle;
            ++swayAngleCount;
            if (swayAngleCount == swayAngleCountNeeded)
            {
                swayAngleOffset = swayAngleSum / (float)swayAngleCountNeeded;
            }
        }
    }