void OnTriggerEnter(Collider otherCollider)
    {
        ButtonInteracter interacter = otherCollider.GetComponentInParent <ButtonInteracter>();

        if (interacter != null)
        {
            OVRInput.Controller controller = interacter.Controller;

            controllersInCPRCollider.Add(controller);
            CPR.StartCompressions();
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (IsVentilating)
        {
            if ((int)fluxuationNumber % 2 == 0)
            {
                ventialtorController.SimulateKeyPress(true);
                fluxuationNumber += ventilatingSpeed * Time.deltaTime;
            }
            else
            {
                ventialtorController.SimulateKeyPress(false);
                fluxuationNumber += ventilatingSpeed * Time.deltaTime;
            }
        }

        if (PerformingCPR)
        {
            if (!startedCPR)
            {
                cprController.StartCompressions();
                startedCPR = true;
            }

            if ((int)fluxuationNumber % 2 == 0 && !cprPause)
            {
                cprController.SimulateCPR();
                cprPause = true;
            }
            else if ((int)fluxuationNumber % 2 != 0 && cprPause)
            {
                cprController.SimulateCPR();
                cprPause = false;
            }

            fluxuationNumber += cprSpeed * Time.deltaTime;
        }
    }