void InitStartingParentedCamera()
    {
        if (hasInit)
        {
            return;
        }

        if (gameObjectParentedTo == null && gameObjectParentedToName != null)
        {
            GameObject objToStartWith = GameObject.GetGameObjectByName(gameObjectParentedToName);
            if (objToStartWith != null)
            {
                CameraInMap camInMapScript = GetScript <CameraInMap>(objToStartWith);
                if (camInMapScript != null)
                {
                    camInMapScript.isActive = true;
                    camInMapScript.OnTriggered();

                    hasInit = true;
                }
            }
        }
        if (gameObjectParentedTo == null)
        {
            // SetDisableCameraToStatic(); // Start off having the static screen, if not specified
        }
    }
Example #2
0
 public static CameraInMap GetStickyCamScript()
 {
     if (stickyCamScript == null)
     {
         if (stickCamInMapArea != null)
         {
             stickyCamScript = MochaScript.GetScript <CameraInMap>(stickCamInMapArea);
         }
     }
     return(stickyCamScript);
 }
    public void OnStart()
    {
        offPointLightColor = new Color(0.8f, 0.0f, 0.0f, 1.0f);
        onPointLightColor  = new Color(0.0f, 0.8f, 0.0f, 1.0f);

        // Initialize into the common list
        GameObject camInMap;

        Common.AddCameraObjectToList(gameObject, out camInMap, out camInMapArea);
        CameraInMap inMapScript = GetScript <CameraInMap>(camInMapArea);

        inMapScript.SetTwin(gameObject); // Set in map to be able to direct to me (camInWorld)
        if (gameObject == Common.GetRCCarCam())
        {
            inMapScript.isActive = true; // always default RCCar to active
        }

        prevXCurrRot = xCurrRot = 0.0f;
        prevYCurrRot = yCurrRot = 0.0f;

        UpdateVectors();

        if (xRotationLimit == 0.0f && yRotationLimit == 0.0f)
        {
            shouldPhysicalCameraRotate = false;
        }

        for (uint i = 0; i < gameObject.transform.GetNumberOfChildren(); ++i)
        {
            GameObject childObj = gameObject.transform.GetChild(i).gameObject;
            if (childObj.GetName() == Common.nameForCamLight)
            {
                spotlight = childObj.RequireComponent <CLight>();
                spotlight.SetDiffuse(new Color(0.706f, 0.96f, 0.714f, 1.0f)); // FFB4FCB6
                // spotlight.SetRange(10.0f);
                // spotlight.SetSpot(10.0f);
                // spotlight.SetAtt(1.0f);
                // spotlight.SetLightType(CLight.LIGHTTYPE.SPOTLIGHT);
                spotlight.setEnabled(false);
            }
            else if (childObj.GetName() == Common.nameForCamPointLight)
            {
                pointlight = childObj.RequireComponent <CLight>();
                SetPointLight(false);
                pointlight.setEnabled(true);
            }
        }

        mSound       = gameObject.RequireComponent <CSound>();
        mCamRotateID = mSound.GetUniqueEvent("CAM_ROTATE.vente", 1);
    }
    public override void OnAreaEnter()
    {
        if (isactive)
        {
            if (Common.GetCamsInMapArea().Count > 0) // not empty
            {
                camInMapNumberEnd = (uint)Math.Min(camInMapNumberEnd, Common.GetCamsInMapArea().Count - 1);
                camToDisableEnd   = (uint)Math.Min(camToDisableEnd, Common.GetCamsInMapArea().Count - 1);

                for (uint i = camToDisableStart; i <= camToDisableEnd; ++i)
                {
                    CameraInMap camScript = GetScript <CameraInMap>(Common.GetCamsInMapArea()[(int)i]);
                    if (camScript == null)
                    {
                        continue;
                    }
                    camScript.isActive = false; // Set the camera to deactivated
                }
                for (uint i = camInMapNumberStart; i <= camInMapNumberEnd; ++i)
                {
                    CameraInMap camScript = GetScript <CameraInMap>(Common.GetCamsInMapArea()[(int)i]);
                    if (camScript == null)
                    {
                        continue;
                    }
                    camScript.isActive = true; // Set the camera to activated
                }
            }

            // After triggering the effect of turning on cameras, destroy the object
            //gameObject.Destroy();
            isactive = false;
            if (gameObject.GetName() == Common.nameForHubCamTrigger)
            {
                timer = 10.0f; // will be reset after awhile
            }

            if (MiniMapTextureName.Length > 0)
            {
                Common.GetMapScreen().RequireComponent <CMeshRenderer>().GetMaterial().SetTexture(MiniMapTextureName + ".png");
            }

            if (minimapScript.mLevelNumber != mLevelNumber)
            {
                minimapScript.mLevelNumber = mLevelNumber;
                minimapScript.UpdateNewMinimapBounds();
            }
        }
    }
Example #5
0
    public static void Reset()
    {
        isPaused  = false;
        isOptions = false;

        pauseScreen                            = null;
        pauseScreenScript                      = null;
        stealth_player                         = null;
        stealthPlayerScript                    = null;
        stealthPlayerMesh                      = null;
        stealthPlayerCamera                    = null;
        stealthPlayerCamScript                 = null;
        stealthPlayerMouse                     = null;
        surveillancePlayerCam                  = null;
        surveillancePlayerStaticCameraCam      = null;
        cameraCamScript                        = null;
        surveillancePlayerMouse                = null;
        surveillancePlayerConsoleScreen        = null;
        consoleScreenScript                    = null;
        surveillancePlayerConsoleText          = null;
        surveillancePlayerConsoleCam           = null;
        surveillancePlayerConsoleBlinkingLight = null;
        stealthPlayerFadeScreen                = null;
        stickCam          = null;
        stickCamInMap     = null;
        stickCamInMapArea = null;
        stickyCamScript   = null;
        camInMapSelector  = null;
        noiseStatic       = null;
        rcCar             = null;
        rcCarCam          = null;
        rcCarCamInMap     = null;
        rcCarJoystick     = null;

        camInMap     = null;
        camInMapArea = null;
        camInWorld   = null;

        cameraScreen = null;
        mapScreen    = null;

        pauseOptionsScreen = null;
        fullscreenX        = null;
        muteX      = null;
        volumeFont = null;
    }
Example #6
0
    public void UpdateXboxInputs()
    {
        float dt = FrameController.DT();

        Vector3 centerPos = ocuCam.transform.position + (Vector3)ocuCam.transform.GetForwardVector() * mMousePositionFromOcuCam.Z;

        gameObject.transform.SetPosition(centerPos); // Always at the center of oculus screen

        // Update dpad Xbox controls for selecting camInMap icons
        bool upTriggered    = Input.GetTriggered((char)0, "ArrowUp") != 0;
        bool leftTriggered  = Input.GetTriggered((char)0, "ArrowLeft") != 0;
        bool downTriggered  = Input.GetTriggered((char)0, "ArrowDown") != 0;
        bool rightTriggered = Input.GetTriggered((char)0, "ArrowRight") != 0;

        if (upTriggered || leftTriggered || downTriggered || rightTriggered)
        {
            if (upTriggered || leftTriggered) // decrements
            {
                if (camInMapIndex > 0)
                {
                    --camInMapIndex; // [0, length - 1]
                }
            }
            else // downTriggered || rightTriggered // increments
            {
                if (camInMapIndex + 1 < camInMap.Count)
                {
                    ++camInMapIndex; // [0, length - 1]
                }
            }

            // Vector3 camInMapPos = (Vector3)camInMap[camInMapIndex].transform.position;
            // camInMapSelector.gameObject.transform.SetPositionX(camInMapPos.X);
            // camInMapSelector.gameObject.transform.SetPositionY(camInMapPos.Y);
        }

        // 'X' to select active camera
        if (Input.GetTriggered(0, "Xbox_X") != 0)
        {
            pickedObject = camInMap[camInMapIndex];
            CameraInMap camMapScript = GetScript <CameraInMap>(pickedObject);

            // Only change camera if picked cam icon is disabled (not nonActive or already picked)
            if (camMapScript.isActive && !camMapScript.isEnabled)
            {
                // Set previous camInMap back to disable for feedback
                if (prevPickedObject != null)
                {
                    CameraInMap prevCamMapScript = GetScript <CameraInMap>(prevPickedObject);
                    if (prevCamMapScript.isEnabled && prevCamMapScript.isActive)
                    {
                        prevCamMapScript.isEnabled = false;
                    }
                }
                // Set that camInMap to green for feedback
                prevPickedObject       = pickedObject;
                camMapScript.isEnabled = true;
            } // End of if picked a disabled camera (then enable it)
        }

        // Updating the camera screen rotation based on Right Thumbstick of Xbox
        if (camScript.gameObjectParentedTo != null && camScript.gameObjectParentedTo != Common.GetNoiseStatic())
        {
            float xboxX = Input.GetValue((char)0, "RThumbX");
            float xboxY = Input.GetValue((char)0, "RThumbY");

            if (xboxX != 0.0f || xboxY != 0.0f)
            {
                // The physical camera object in the level is the one with the RotLimit script
                CameraRotationLimit camRotLimit = GetScript <CameraRotationLimit>(camScript.gameObjectParentedTo);
                camRotLimit.xCurrentRotation += xboxX * 1.3f * dt; // script has clamped this rotation, in degrees
                camRotLimit.yCurrentRotation += xboxY * 1.3f * dt;

                camScript.SetUpdateLookAtDirAndPosition();
            }
        }
    }
Example #7
0
    public static void Reset()
    {
        isPaused = false;
        isOptions = false;

        pauseScreen = null;
        pauseScreenScript = null;
        stealth_player = null;
        stealthPlayerScript = null;
        stealthPlayerMesh = null;
        stealthPlayerCamera = null;
        stealthPlayerCamScript = null;
        stealthPlayerMouse = null;
        surveillancePlayerCam = null;
        surveillancePlayerStaticCameraCam = null;
        cameraCamScript = null;
        surveillancePlayerMouse = null;
        surveillancePlayerConsoleScreen = null;
        consoleScreenScript = null;
        surveillancePlayerConsoleText = null;
        surveillancePlayerConsoleCam = null;
        surveillancePlayerConsoleBlinkingLight = null;
        stealthPlayerFadeScreen = null;
        stickCam = null;
        stickCamInMap = null;
        stickCamInMapArea = null;
        stickyCamScript = null;
        camInMapSelector = null;
        noiseStatic = null;
        rcCar = null;
        rcCarCam = null;
        rcCarCamInMap = null;
        rcCarJoystick = null;

        camInMap = null;
        camInMapArea = null;
        camInWorld = null;

        cameraScreen = null;
        mapScreen = null;

        pauseOptionsScreen = null;
        fullscreenX = null;
        muteX = null;
        volumeFont = null;
    }
Example #8
0
 public static CameraInMap GetStickyCamScript()
 {
     if (stickyCamScript == null)
     {
         if (stickCamInMapArea != null)
         {
             stickyCamScript = MochaScript.GetScript<CameraInMap>(stickCamInMapArea);
         }
     }
     return stickyCamScript;
 }