Ejemplo n.º 1
0
 public void setState(ThermoState state, double totalVolume)
 {
     setState(state.Temperature, state.Pressure, state.Enthalpy, state.Density, state.InternalEnergy, state.ThermalConductivity, state.Viscosity, state.SpecificHeat, totalVolume);
 }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        // All this code does, at end of day, is find all the objects to manage,
        // and set initial values and such as needed.
        thermo = GameObject.Find("Oracle").GetComponent <ThermoState>();

        cam_offset = GameObject.Find("CamOffset");
        ceye       = GameObject.Find("CenterEyeAnchor");

        hand_emptys    = new Material[] { hand_empty };
        hand_touchings = new Material[] { hand_touching };
        hand_grabbings = new Material[] { hand_grabbing };

        lhand              = GameObject.Find("LeftControllerAnchor");
        lactualhand        = lhand.transform.GetChild(0).gameObject;
        lhand_pos          = lhand.transform.position;
        lhand_vel          = new Vector3(0f, 0f, 0f);
        lhand_meshrenderer = GameObject.Find("hands:Lhand").GetComponent <SkinnedMeshRenderer>();

        rhand              = GameObject.Find("RightControllerAnchor");
        ractualhand        = rhand.transform.GetChild(0).gameObject;
        rhand_pos          = rhand.transform.position;
        rhand_vel          = new Vector3(0f, 0f, 0f);
        rhand_meshrenderer = GameObject.Find("hands:Rhand").GetComponent <SkinnedMeshRenderer>();

        lhand_meshrenderer.materials = hand_emptys;
        rhand_meshrenderer.materials = hand_emptys;

        // As we grab them, set ranges on tool dials (sliders).
        Tool t;

        tools = new List <Tool>();
        t     = GameObject.Find("Tool_Insulator").GetComponent <Tool>(); tool_insulator = t; tools.Add(t); t.dial_dial.min_map = 0f; t.dial_dial.max_map = 1f; t.dial_dial.unit = "n";
        t     = GameObject.Find("Tool_Clamp").GetComponent <Tool>(); tool_clamp = t; tools.Add(t); t.dial_dial.min_map = 0f; t.dial_dial.max_map = 1f; t.dial_dial.unit = "h";
        t     = GameObject.Find("Tool_Burner").GetComponent <Tool>(); tool_burner = t; tools.Add(t); t.dial_dial.min_map = 1f; t.dial_dial.max_map = 1000f * 100f; t.dial_dial.unit = "J/s";
        t     = GameObject.Find("Tool_Coil").GetComponent <Tool>(); tool_coil = t; tools.Add(t); t.dial_dial.min_map = -1f; t.dial_dial.max_map = -1000f * 100f; t.dial_dial.unit = "J/s";
        double kg_corresponding_to_10mpa = thermo.surfacearea_insqr * (10 * 1453.8 /*MPa->psi*/) * 0.453592 /*lb->kg*/;
        double kg_corresponding_to_2mpa  = thermo.surfacearea_insqr * (2 * 1453.8 /*MPa->psi*/) * 0.453592 /*lb->kg*/; // 10 MPa seems way too big, sooooo... we'll just do 2 MPa.

        t = GameObject.Find("Tool_Weight").GetComponent <Tool>(); tool_weight = t; tools.Add(t); t.dial_dial.min_map = 0f; t.dial_dial.max_map = (float)kg_corresponding_to_10mpa; t.dial_dial.unit = "kg";
        t = GameObject.Find("Tool_Balloon").GetComponent <Tool>(); tool_balloon = t; tools.Add(t); t.dial_dial.min_map = 0f; t.dial_dial.max_map = -(float)kg_corresponding_to_10mpa; t.dial_dial.unit = "kg";

        flame = GameObject.Find("Flame").GetComponent <ParticleSystem>();

        workspace                  = GameObject.Find("Workspace");
        handle_workspace           = GameObject.Find("Handle_Workspace");
        handle_workspace_touchable = handle_workspace.GetComponent <Touchable>();

        // set initial states of meshrenderers and transforms for our tools.
        for (int i = 0; i < tools.Count; i++)
        {
            t = tools[i];
            t.active_available_meshrenderer.enabled  = false;
            t.active_snap_meshrenderer.enabled       = false;
            t.storage_available_meshrenderer.enabled = false;
            t.storage_snap_meshrenderer.enabled      = false;
            GameObject g = t.gameObject;
            g.transform.SetParent(t.storage.gameObject.transform);
            t.stored = true;
            g.transform.localPosition = new Vector3(0f, 0f, 0f);
            g.transform.localScale    = new Vector3(1f, 1f, 1f);
            g.transform.localRotation = Quaternion.identity;
            float   v        = t.storage.transform.localScale.x; //can grab any dimension
            Vector3 invscale = new Vector3(1f / v, 1f / v, 1f / v);
            t.text.transform.localScale = invscale;
            t.textv_tmpro.SetText("{0:3}" + t.dial_dial.unit, (float)t.dial_dial.map);
        }

        vessel        = GameObject.Find("Vessel");
        graph         = GameObject.Find("Graph");
        state_dot     = GameObject.Find("gstate");
        challenge_dot = GameObject.Find("cstate");
        clipboard     = GameObject.Find("Clipboard");

        challenge_ball_collide = challenge_dot.GetComponent <ChallengeBall>();

        vrcenter = GameObject.Find("VRCenter");
        vrcenter_fingertoggleable     = vrcenter.GetComponent <FingerToggleable>();
        vrcenter_backing_meshrenderer = vrcenter.transform.GetChild(1).GetComponent <MeshRenderer>();

        movables = new List <Touchable>();
        for (int i = 0; i < tools.Count; i++)
        {
            movables.Add(tools[i].touchable);                              //important that tools take priority, so they can be grabbed and removed
        }
        movables.Add(graph.GetComponent <Touchable>());
        movables.Add(clipboard.GetComponent <Touchable>());

        halfer           = GameObject.Find("Halfer");
        halfer_touchable = halfer.GetComponent <Touchable>();
        reset            = GameObject.Find("Reset");
        reset_touchable  = reset.GetComponent <Touchable>();
        halfables        = new List <Halfable>();
        halfables.Add(GameObject.Find("Container").GetComponent <Halfable>());
        halfables.Add(GameObject.Find("Tool_Insulator").GetComponent <Halfable>());
        halfables.Add(GameObject.Find("Tool_Coil").GetComponent <Halfable>());

        // A bunch of stuff related to initializing clipboard.
        instructions_parent = GameObject.Find("Instructions");
        challenge_parent    = GameObject.Find("Challenge");
        quiz_parent         = GameObject.Find("Quiz");

        mode_tabs = new List <Tab>();
        mode_tabs.Add(GameObject.Find("ModeInstructions").GetComponent <Tab>());
        mode_tabs.Add(GameObject.Find("ModeChallenge").GetComponent <Tab>());
        mode_tabs.Add(GameObject.Find("ModeQuiz").GetComponent <Tab>());

        questions = new List <string>();
        options   = new List <string>();
        answers   = new List <int>(); //the correct answer
        givens    = new List <int>(); //the recorded answer given by the user (default -1)

        questions.Add("Here is an example question- in what region is the water?");
        options.Add("A. Solid");
        options.Add("B. Liquid");
        options.Add("C. Vapor");
        options.Add("D. Two Phase");
        answers.Add(2);
        givens.Add(-1);

        questions.Add("Here is an example question- in what region is the water?");
        options.Add("A. Solid");
        options.Add("B. Liquid");
        options.Add("C. Vapor");
        options.Add("D. Two Phase");
        answers.Add(2);
        givens.Add(-1);

        questions.Add("Here is an example question- in what region is the water?");
        options.Add("A. Solid");
        options.Add("B. Liquid");
        options.Add("C. Vapor");
        options.Add("D. Two Phase");
        answers.Add(2);
        givens.Add(-1);

        questions.Add("Here is an example question- in what region is the water?");
        options.Add("A. Solid");
        options.Add("B. Liquid");
        options.Add("C. Vapor");
        options.Add("D. Two Phase");
        answers.Add(2);
        givens.Add(-1);

        questions.Add("Here is an example question- in what region is the water?");
        options.Add("A. Solid");
        options.Add("B. Liquid");
        options.Add("C. Vapor");
        options.Add("D. Two Phase");
        answers.Add(2);
        givens.Add(-1);

        option_tabs = new List <Tab>();
        option_tabs.Add(GameObject.Find("QA").GetComponent <Tab>());
        option_tabs.Add(GameObject.Find("QB").GetComponent <Tab>());
        option_tabs.Add(GameObject.Find("QC").GetComponent <Tab>());
        option_tabs.Add(GameObject.Find("QD").GetComponent <Tab>());
        qconfirm_tab = GameObject.Find("QConfirm").GetComponent <Tab>();
        board        = GameObject.Find("Board");
        qtext_tmp    = GameObject.Find("Qtext").GetComponent <TextMeshPro>();
        SetQuizText();
        SetChallengeBall();
        SetAllHalfed(true);
    }
Ejemplo n.º 3
0
 public void initiate(ThermoState state, double totalVolume)
 {
     setState(state, totalVolume);
 }