예제 #1
0
 //Updates the state of interaction with the specific moleculestring while its in use
 public IEnumerator Active()
 {
     while (!isSolved)
     {
         currentState = GetState();
         yield return(null);
     }
 }
예제 #2
0
    IEnumerator Reaction(MoleculeState reaction)
    {
        ActivateGraph(3);

        if (reaction == MoleculeState.sn1)
        {
            Stage3Manager.instance.leftHand.lineRenderer.enabled = false;
        }

        Renderer    gluORenderer   = Stage3Manager.instance.rightHand._o.GetComponent <Renderer>();
        IEnumerator flashingOxygen = MoleculeController.instance.FlashColor(gluORenderer, new Color(gluORenderer.material.color.r, gluORenderer.material.color.g, gluORenderer.material.color.b, 0.5f), new Color(0, 0, 1, 0.5f), 0.5f);

        GameObject hydrogen1 = Instantiate(Stage3Manager.instance.cloudPrefab, Stage3Manager.instance.rightHand._o.position, Quaternion.identity);

        StartCoroutine(flashingOxygen);

        yield return(StartCoroutine(MoleculeController.instance.MoveToPosition(hydrogen1.transform, Stage3Manager.instance.rightHand._o, oBinding2, 3)));

        Destroy(hydrogen1);

        oBinding2.gameObject.SetActive(false);

        GameObject  hydrogen2       = Instantiate(Stage3Manager.instance.cloudPrefab, nag.waterOxygen.position, Quaternion.identity);
        GameObject  i               = Instantiate(Stage3Manager.instance.cloudPrefab, nag.atoms[2].position, Quaternion.identity);
        IEnumerator unstableBinding = MoleculeController.instance.MoveBetween(i.transform, nag.atoms[2], nag.atoms[3], 0.5f);

        nag.waterOxygen.gameObject.SetActive(true);

        StartCoroutine(unstableBinding);

        yield return(StartCoroutine(MoleculeController.instance.MoveToPosition(hydrogen2.transform, nag.waterOxygen.position, Stage3Manager.instance.rightHand._o.transform, 3)));

        ViveInput.TriggerHapticVibration(HandRole.RightHand, 0.2f, 85, 0.125f);
        Destroy(hydrogen2);
        Destroy(i);
        StopCoroutine(flashingOxygen);
        StopCoroutine(unstableBinding);

        gluORenderer.material.color = Color.red;

        ActivateGraph(5);

        yield return(new WaitForSeconds(2));

        reactionFinished = true;
    }
예제 #3
0
 //Starts the reaction movements
 public void StartReaction(MoleculeState reaction)
 {
     DataRecorder.instance.SetEvent(reaction.ToString() + "_Initiated");
     StartCoroutine(Reaction(reaction));
 }