コード例 #1
0
    private Quaternion returnRotLeft, returnRotRight, initialRotBody;                                   // For resetting rotation

    void Start()
    {
        view  = FindObjectOfType <BodyCam>();
        ted   = FindObjectOfType <Teddy>();
        anim  = ted.GetComponent <Animator>();
        rigid = ted.GetComponent <Rigidbody>();

        leftEye       = FindObjectOfType <TeddyLeftEye>();
        rightEye      = FindObjectOfType <TeddyRightEye>();
        leftEyeColl   = leftEye.GetComponent <Collider>();
        rightEyeColl  = rightEye.GetComponent <Collider>();
        leftEyeRigid  = leftEye.GetComponent <Rigidbody>();
        rightEyeRigid = rightEye.GetComponent <Rigidbody>();
        headd         = GameObject.Find("head");

        mainOverlay.enabled    = false;                                                                 // mainOverlay is used for special screens, like loading, static, and jamming; off at start
        topRightInsert.enabled = false;                                                                 // Picture within picture is off at start

        leftEyeColl.enabled       = false;
        rightEyeColl.enabled      = false;
        leftEyeRigid.isKinematic  = true;
        rightEyeRigid.isKinematic = true;

        view.bodyCamActive = true;

        leftEyeLodged  = true;                                                                     // Eyes lodged at start
        rightEyeLodged = true;                                                                     //

        leftEyeTransitioning  = false;                                                             // Eyes not in process of lodging/dislodging at start
        rightEyeTransitioning = false;                                                             //

        jammed    = false;                                                                         // No jamming at start
        jamView   = false;                                                                         //
        clearView = true;                                                                          //

        initialPosBody  = view.transform.localPosition;                                            // Set initial positions for body and eyes
        initialPosLeft  = leftEye.transform.localPosition;                                         //
        initialPosRight = rightEye.transform.localPosition;                                        //

        initialRotBody = view.transform.localRotation;                                             // Set initial rotations for body and eyes
        returnRotLeft  = leftEye.transform.localRotation;                                          //
        returnRotRight = rightEye.transform.localRotation;                                         //

        Debug.Log(view.transform.localEulerAngles);                                                // Troubleshoot eye rotation--what is the initial orientation, for reference?
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        view     = FindObjectOfType <BodyCam>();
        ted      = FindObjectOfType <Teddy>();
        anim     = ted.GetComponent <Animator>();
        rigid    = ted.GetComponent <Rigidbody>();
        tedHead  = FindObjectOfType <TeddyHead>();
        animHead = tedHead.GetComponent <Animator>();
        wkDesk   = FindObjectOfType <WorkDesk>();

        commsImg = commsEnter.transform.parent.GetComponent <RawImage>();

        leftEye  = FindObjectOfType <TeddyLeftEye>();
        rightEye = FindObjectOfType <TeddyRightEye>();
        //leftEyeColl = leftEye.GetComponent<Collider>();
        rightEyeColl = rightEye.GetComponent <Collider>();
        //leftEyeRigid = leftEye.GetComponent<Rigidbody>();
        rightEyeRigid = rightEye.GetComponent <Rigidbody>();
        //headd = GameObject.Find("tedhead");
        reticleImg = GameObject.Find("Reticle").GetComponent <RawImage>();

        leftEyepatch  = leftEye.transform.Find("lefteyepatch");
        rightEyepatch = rightEye.transform.Find("righteyepatch");

        gamePaused = false;

        mainOverlay.enabled    = false;                                                              // mainOverlay is used for special screens, like loading, static, and jamming; off at start
        topRightInsert.enabled = false;                                                              // Picture within picture is off at start

        //leftEyeColl.enabled = false;
        rightEyeColl.enabled = false;
        //leftEyeRigid.isKinematic = true;
        rightEyeRigid.isKinematic = true;

        view.bodyCamActive = true;

        leftEyeLodged  = true;                                                                         // Eyes lodged at start
        rightEyeLodged = true;                                                                         //

        leftEyeTransitioning  = false;                                                                 // Eyes not in process of lodging/dislodging at start
        rightEyeTransitioning = false;                                                                 //

        jammed    = false;                                                                             // No jamming at start
        jamView   = false;                                                                             //
        clearView = true;                                                                              //
        currentHallucinationFrameIndex = 0;
        hallucinationFrameTimeIndex    = 0;

        reticleEnabled     = true;
        hallucinating      = false;
        atTedsRoom         = false;
        commsEnabled       = false;
        commsEnter.enabled = false;
        commsEnter.DeactivateInputField();
        commsEnter.GetComponent <Image>().enabled = false;

        englishOrSolar = true;

        leftEyeAvailable = false;

        reticlePressTime = 0;
        reticlePressed   = false;

        if (headbob)
        {
            headdRT = headdActualRT;
            headd   = headActual;
        }
        else
        {
            headdRT = headdRefRT;
            headd   = headNoBob;
        }

        //camTarget = null;                                                                             //smoothdamp attempt



        initialPosBody  = view.transform.localPosition;                                                 // Set initial positions for body and eyes
        initialPosLeft  = leftEye.transform.localPosition;                                              //
        initialPosRight = rightEye.transform.localPosition;                                             //

        initialRotBody = view.transform.localRotation;                                                  // Set initial rotations for body and eyes
        returnRotLeft  = leftEye.transform.localRotation;                                               //
        returnRotRight = rightEye.transform.localRotation;

        SwitchCam(view.gameObject, headd, initialPosBody, initialRotBody);

        initialRotBody = view.transform.localRotation;

        eyeDislodgeTimer    = 0.2f;
        eyeDislodgeTimerRef = 0;
    }