Exemple #1
0
    // Use this for initialization
    void Start()
    {
        ted     = FindObjectOfType <Teddy>();
        tedHead = FindObjectOfType <TeddyHead>();
        //dave = FindObjectOfType<Dave>();
        camMaster    = FindObjectOfType <CameraMaster>();
        cam          = GameObject.Find("RightEyeCam");
        bCam         = FindObjectOfType <BodyCam>();
        bCamCamera   = FindObjectOfType <BodyCam>().GetComponent <Camera>();
        leftEye      = FindObjectOfType <TeddyLeftEye>();
        scanner      = FindObjectOfType <InfoScan>();
        scanText     = scanner.GetComponent <Text>();
        rigid        = this.GetComponent <Rigidbody>();
        coll         = this.GetComponent <Collider>();
        commsControl = FindObjectOfType <CommsController>();
        toolSelect   = FindObjectOfType <ToolSelector>();

        rightEyeActive = false;                                                                                     // Right eye starts inactive
        rightEyeLock   = false;                                                                                     // Right eye starts locked (really??)
        tedTrack       = false;

        //rigid.velocity = Vector3.zero;
        //rigid.angularVelocity = Vector3.zero;

        sixDOF             = false;                                                                                 // Non-6dof on start
        rightLight.enabled = false;                                                                                 // Eye light off on start

        lockIndicator.enabled   = true;
        sixDOFIndicator.enabled = true;

        scanStart = 0;

        storedSpeed = rightEyeSpeed;

        scanObject         = null;
        previousTargetedID = null;
        hostID             = ted.transform.GetComponent <IDCharacter>();
        targetedGhost      = null;
        targetedSpeech     = null;
        targetedAI         = null;
        targetedAudio      = null;

        targetInfoCleared = false;

        scanFrom = null;
    }
    // Start is called before the first frame update
    void Start()
    {
        // Initialize components
        faceAnim         = face.GetComponent <Animator>();
        speechController = this.transform.GetComponent <TextAndSpeech>();
        tedHead          = FindObjectOfType <TeddyHead>();

        if (this.transform.Find("Inventory") != null)
        {
            inv = this.transform.Find("Inventory").GetComponent <Inventory>();
        }
        actCoord = FindObjectOfType <ActionSceneCoordinator>();

        // Set blinking parameters
        isBlinking        = true;
        blinkRefTime      = 0;
        actualSecPerBlink = Random.Range(secPerBlink - secPerBlinkDelta, secPerBlink + secPerBlinkDelta);

        // Initialize head and eye rotations and directions
        headInitialRotation         = head.transform.rotation;
        headInitialForwardDirection = head.forward;
        headUpDirection             = head.up;
        foreach (Transform eye in eyes)
        {
            eyesInitialRotation.Add(eye.transform.rotation);
        }

        // Setting look parameters
        lookingAtPerson                = false;
        lookingAtPersonDuration        = 0;
        lookingAtPersonDurationRefTime = 0;
        turningAwayFromPerson          = false;

        // Initialize action and interaction states
        speakingAndWaitingToCueOtherNPC = false;
    }
    // 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;
    }