private string level_name;                  // Custom level name
    // TODO: custom level names regex check for invalid chars

	void Awake ()
	{
		camera_script        = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
        level_builder_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<LevelBuilder>();
        grid_script          = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Grid>();
        levels_script        = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Levels>();
	}
 /// <summary>
 /// Saves the acquisition information in specific files.
 /// The data is stored based on the COLMAP file system.
 /// </summary>
 public static void SaveAcquisitionInformation(DataHandler dataHandler, CameraSetup cameraSetup)
 {
     COLMAPConnector.CreateDirectoryStructureForAcquisition(dataHandler.dataDirectory);
     COLMAPConnector.SaveCamerasInformation(cameraSetup.cameraModels, dataHandler.dataDirectory);
     COLMAPConnector.SaveImagesInformation(cameraSetup.cameraModels, dataHandler.dataDirectory);
     dataHandler.SaveAdditionalSetupInformation(cameraSetup);
 }
示例#3
0
        public void SetParamaters(CameraSetup value)
        {
            lastSetup = setup;

            setup = value;
            switch (value)
            {
            case CameraSetup.DEFAULT:
                parameters = defaultParameters;
                break;

            case CameraSetup.CANNON:
                parameters = cannonParameters;
                break;

            case CameraSetup.INVENTORY:
                parameters = inventoryParameters;
                break;

            default:
                break;
            }

            Cursor.lockState = parameters.lockCursor;
            Cursor.visible   = parameters.showCursor;
        }
示例#4
0
        public override void Build(ref CameraSetup camSetup)
        {
            if (!Ball.IsValid())
            {
                return;
            }

            var pos = Ball.Position + Vector3.Up * (24 + (Ball.CollisionBounds.Center.z * Ball.Scale));
            var rot = Rotation.From(Angles);

            distanceTarget = distanceTarget.LerpTo(Distance, Time.Delta * 5.0f);

            var tr = Trace.Ray(pos, pos + rot.Backward * Distance)
                     .Ignore(Ball)
                     .WorldOnly()
                     .Radius(8)
                     .Run();

            if (tr.Hit)
            {
                distanceTarget = Math.Min(distanceTarget, tr.Distance);
            }

            pos += rot.Backward * distanceTarget;

            // ball.RenderAlpha = Math.Clamp( (distanceTarget - 25.0f) / 50.0f, 0.0f, 1.0f );

            camSetup.Position    = pos;
            camSetup.Rotation    = rot;
            camSetup.FieldOfView = 90;
        }
示例#5
0
 /// <summary>
 /// Resets the object's properties.
 /// </summary>
 public void Reset()
 {
     // Check if there is a rendering caller.
     renderingCaller = GetComponent <Rendering.Rendering>();
     // Reset the key child components.
     _cameraSetup = CameraSetup.CreateOrResetCameraSetup(transform);
     _dataHandler = DataHandler.CreateOrResetDataHandler(transform);
     // Initialize the processing methods.
     _processingMethods = ProcessingMethod.CreateOrResetProcessingMethods(transform);
     for (int iter = 0; iter < _processingMethods.Length; iter++)
     {
         _processingMethods[iter].InitializeLinks();
     }
     // Initialize the external tools.
     _externalHelpers = ExternalHelper.CreateOrResetExternalHelpers(transform);
     for (int iter = 0; iter < _externalHelpers.Length; iter++)
     {
         _externalHelpers[iter].InitializeLinks();
     }
     // Get the method defining the container for the input images.
     _previewSourceImagesLoader = _processingMethods[0].PMColorTextureArray;
     // Reads the acquisition information from the source data directory.
     ReadAcquisitionInformation();
     // Destroys all created method components.
     foreach (MonoBehaviour component in GetComponents <MonoBehaviour>())
     {
         if (component is IMethodGUI)
         {
             DestroyImmediate(component);
         }
     }
 }
示例#6
0
    public override void PostCameraSetup(ref CameraSetup camSetup)
    {
        base.PostCameraSetup(ref camSetup);


        AddCameraEffects(ref camSetup);
    }
示例#7
0
        private void SetPipeline(CameraSetup setup)
        {
            var cfg = CreateConfig(setup);

            _pipeline = new Pipeline();
            _pipeline.Start(cfg);
        }
示例#8
0
    public override void PostCameraSetup(ref CameraSetup setup)
    {
        base.PostCameraSetup(ref setup);

        if (lastCameraRot == Rotation.Identity)
        {
            lastCameraRot = setup.Rotation;
        }

        var angleDiff        = Rotation.Difference(lastCameraRot, setup.Rotation);
        var angleDiffDegrees = angleDiff.Angle();
        var allowance        = 20.0f;

        if (angleDiffDegrees > allowance)
        {
            // We could have a function that clamps a rotation to within x degrees of another rotation?
            lastCameraRot = Rotation.Lerp(lastCameraRot, setup.Rotation, 1.0f - (allowance / angleDiffDegrees));
        }
        else
        {
            //lastCameraRot = Rotation.Lerp( lastCameraRot, Camera.Rotation, Time.Delta * 0.2f * angleDiffDegrees );
        }

        // uncomment for lazy cam
        //camera.Rotation = lastCameraRot;

        if (setup.Viewer != null)
        {
            AddCameraEffects(ref setup);
        }
    }
    private Levels levels;              // Reference to levels script

	void Awake() 
    {
        camera_script = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
        levels = GetComponent<Levels>();
        brick_array = new GameObject[20, 20];
        max_types = 2;
	}
示例#10
0
        /// <summary>
        /// Associate available cameras with automation and setup class
        /// Connect camera to LightField
        /// </summary>
        /// <param name="experiment"></param>
        /// <returns></returns>
        private void AddAvailableCameras()
        {
            // Add available camera
            foreach (var camera in experiment_.AvailableDevices)
            {
                if (experiment_.AvailableDevices.Count > 0 &&
                    camera.Type == DeviceType.Camera)
                {
                    experiment_ = new OpenLightField(this, visibleLightField: true).Experiment;

                    // Connect camera to LightField
                    experiment_.Add(camera);

                    string cameraName =
                        string.Format("Model: {0}, SN: {1}",
                                      camera.Model, camera.SerialNumber);

                    // Assign background worker, identity, etc..
                    // through camera setup class
                    CameraSetup cameraSetup =
                        new CameraSetup(experiment_, this, cameraName);

                    experiment_ = cameraSetup.Experiment;
                }
            }
        }
	void Awake()
	{
		camera_script = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
		paddle = GameObject.FindGameObjectWithTag(Tags.paddle);
		ball_vector = new Vector3(x, y, 0f);
		rb = GetComponent<Rigidbody2D>();
		bounce_sound = GetComponent<AudioSource>();
	}
示例#12
0
文件: ViewModel.cs 项目: Exer0s/flood
    public override void PostCameraSetup(ref CameraSetup camSetup)
    {
        base.PostCameraSetup(ref camSetup);

        // camSetup.ViewModelFieldOfView = camSetup.FieldOfView + (FieldOfView - 80);

        AddCameraEffects(ref camSetup);
    }
	private GameObject actual_paddle;	// And paddle
	
	void Awake () 
	{
		GM = GameManager.instance;
		camera_script	= GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
		grid_script		= GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Grid>(); 
		
		// Instantiate variables
		wall_array = new GameObject[5];
	}
示例#14
0
 /// <summary>
 /// Resets the object's properties.
 /// </summary>
 void Reset()
 {
     // Reset the key child components.
     _cameraSetup = CameraSetup.CreateOrResetCameraSetup(transform);
     _dataHandler = DataHandler.CreateOrResetDataHandler(transform);
     // Reset other properties.
     scaleFactor            = 0.01f;
     repositionAroundCenter = true;
 }
示例#15
0
 static ViewportWrapper CreateViewPort(GameObject gameObject, int x, int y, int width, int height,
                                       CameraSetup cameraSetup, bool shadowEffectEnabled)
 {
     if (gameObject is FinishLine)
     {
         return(new FinishLineViewport(x, y, width, height, gameObject));
     }
     return(new GameObjectViewport(x, y, width, height, gameObject, cameraSetup, shadowEffectEnabled));
 }
        /// <summary>
        /// Reads images information from a COLMAP "images.txt" file, and saves it into the referenced array.
        /// Note that the array contains a camera element for each image. Array elements will be initialized here.
        /// </summary>
        /// <param name="cameraSetup"></param> The camera setup to which to output the list of parsed camera models.
        /// <param name="workspace"></param> The workspace from which to work.
        public static void ReadImagesInformation(CameraSetup cameraSetup, string workspace)
        {
            List <Vector3>    positionList = new List <Vector3>();
            List <Quaternion> rotationList = new List <Quaternion>();
            List <string>     fileNameList = new List <string>();
            List <int>        cameraIDList = new List <int>();

            // Read COLMAP's images file.
            using (StreamReader reader = File.OpenText(GetImagesFile(workspace)))
            {
                bool   isOdd = false;
                string line;
                // Read the file line-by-line to the end.
                while ((line = reader.ReadLine()) != null)
                {
                    // Skip the lines from the header, that start with #.
                    if (!line.StartsWith("#"))
                    {
                        // If the line is odd, skip it, and indicate that the next line will be even.
                        if (isOdd)
                        {
                            isOdd = false;
                        }
                        // If the line is even, parse it, and indicate that the next line will be odd.
                        else
                        {
                            string[] split = line.Split(' ');
                            // COLMAP's images should have 10 parameters.
                            if (split.Length > 9)
                            {
                                // Parse position and rotation, and convert them to Unity's coordinate system.
                                Quaternion rotation = new Quaternion(GeneralToolkit.ParseFloat(split[2]), GeneralToolkit.ParseFloat(split[3]), GeneralToolkit.ParseFloat(split[4]), GeneralToolkit.ParseFloat(split[1]));
                                Vector3    position = new Vector3(GeneralToolkit.ParseFloat(split[5]), GeneralToolkit.ParseFloat(split[6]), GeneralToolkit.ParseFloat(split[7]));
                                ConvertCoordinatesCOLMAPToUnity(ref position, ref rotation);
                                // Add all the parameters to the dedicated lists.
                                positionList.Add(position);
                                rotationList.Add(rotation);
                                fileNameList.Add(split[9]);
                                cameraIDList.Add(GeneralToolkit.ParseInt(split[8]));
                                // Indicate that the next line will be odd.
                                isOdd = true;
                            }
                        }
                    }
                }
                reader.Close();
            }
            // Use these lists to create and fill the output array of camera models.
            cameraSetup.cameraModels = new CameraModel[positionList.Count];
            for (int iter = 0; iter < positionList.Count; iter++)
            {
                CameraModel cameraModel = cameraSetup.AddCameraModel(iter);
                cameraModel.SetCameraReferenceIndexAndImageName(cameraIDList[iter], fileNameList[iter]);
                cameraModel.transform.localPosition = positionList[iter];
                cameraModel.transform.localRotation = rotationList[iter];
            }
        }
示例#17
0
    public override void PostCameraSetup(ref CameraSetup camSetup)
    {
        base.PostCameraSetup(ref camSetup);

        if (Zoomed)
        {
            camSetup.FieldOfView = 20;
        }
    }
示例#18
0
        private Config CreateConfig(CameraSetup setup)
        {
            var width  = setup.RGBWidth;
            var height = setup.RGBHeight;
            var fps    = setup.RGBFPS;
            var cfg    = new Config();

            cfg.EnableStream(Intel.RealSense.Stream.Color, width, height, Format.Bgr8, fps);
            return(cfg);
        }
示例#19
0
 private void Start()
 {
     Cursor.SetCursor(cursor, new Vector2(16, 0), CursorMode.Auto);
     OnLifesUpdated?.Invoke(lifesLeft);
     cameraSetup               = FindObjectOfType <CameraSetup>();
     playersEagle              = FindObjectOfType <PlayersEagle>();
     playersEagle.OnEagleDead += EndGame;
     PlayerPool.Instance.PreWarm(lifesLeft);
     EnemyCounter.OnAllEnemiesDead += GoToNextLevel;
 }
 public virtual void AddToManagersBottomUp()
 {
     CameraSetup.ResetCamera(SpriteManager.Camera);
     AssignCustomVariables(false);
     MenuWindowInstance.MoveToFrbLayer(HUDLayer, HUDLayerGum);
     ChatHistoryInstance.MoveToFrbLayer(HUDLayer, HUDLayerGum);
     OkMessageInstance.MoveToFrbLayer(HUDLayer, HUDLayerGum);
     ConfirmationWindowInstance.MoveToFrbLayer(HUDLayer, HUDLayerGum);
     FlatRedBall.Gui.GuiManager.SortZAndLayerBased();
 }
示例#21
0
        public override void PostCameraSetup(ref CameraSetup camSetup)
        {
            camSetup.ZNear = 0.1f;

            base.PostCameraSetup(ref camSetup);

            if (IsFlashlightOn)
            {
                _viewFlashlight.Rotation = Input.Rotation;
                _viewFlashlight.Position = EyePosition + Input.Rotation.Forward * FLASHLIGHT_DISTANCE;
            }
        }
        /// <summary>
        /// Reads camera information from a COLMAP "cameras.txt" file, and saves it into the referenced array.
        /// Note that the array contains a camera element for each image. Array elements should already contain the cameras' pose information.
        /// </summary>
        /// <param name="cameraSetup"></param> The camera setup containing the camera models, one for each image.
        /// <param name="workspace"></param> The workspace from which to work.
        public static void ReadCamerasInformation(CameraSetup cameraSetup, string workspace)
        {
            // Only continue if there is information to work with.
            if (cameraSetup.cameraModels == null)
            {
                return;
            }
            // Parse the set of COLMAP cameras from the file.
            List <CameraModel> cameraModelList = new List <CameraModel>();

            string[] lines = File.ReadAllLines(GetCamerasFile(workspace));
            foreach (string line in lines)
            {
                if (!line.StartsWith("#"))
                {
                    CameraModel cameraModel = TryParseCameraModel(line);
                    if (cameraModel == null)
                    {
                        Debug.LogWarning("One or more of the camera models could not be parsed. Camera setup cannot be computed.");
                        cameraSetup.ResetCameraModels();
                        return;
                    }
                    else
                    {
                        cameraModelList.Add(cameraModel);
                    }
                }
            }
            CameraModel[] camerasInFile = cameraModelList.ToArray();
            // Update the camera models from this information.
            CameraModel[] cameraModels = cameraSetup.cameraModels;
            for (int i = 0; i < cameraModels.Length; i++)
            {
                CameraModel cameraModel = cameraModels[i];
                // The camera models should already know the COLMAP camera they are related to.
                int desiredCameraIndex = cameraModel.cameraReferenceIndex;
                // Find the corresponding COLMAP camera, and provide the camera model with its parameters.
                foreach (CameraModel cameraInFile in camerasInFile)
                {
                    if (cameraInFile.cameraReferenceIndex == desiredCameraIndex)
                    {
                        cameraModel.isOmnidirectional = cameraInFile.isOmnidirectional;
                        cameraModel.pixelResolution   = cameraInFile.pixelResolution;
                        cameraModel.fieldOfView       = cameraInFile.fieldOfView;
                    }
                }
            }
            // Destroy the temporary camera models.
            for (int iter = 0; iter < camerasInFile.Length; iter++)
            {
                CameraModel.DestroyImmediate(camerasInFile[iter].gameObject);
            }
        }
示例#23
0
        private void OnChecked(object sender, EventArgs eventArgs)
        {
            PlayerDataManager.SetFullScreen(FullScreenCheck.IsChecked.Value);
            ResizeText.Visible = !FullScreenCheck.IsChecked.Value;

            CameraSetup.Data.AllowWidowResizing = !FullScreenCheck.IsChecked.Value;
            CameraSetup.Data.IsFullScreen       = FullScreenCheck.IsChecked.Value;
            CameraSetup.Data.Scale = FullScreenCheck.IsChecked.Value ? 100f : 50f;

            CameraSetup.ResetWindow();
            CameraSetup.ResetCamera();
        }
示例#24
0
        public void StartStreaming(Dispatcher dispatcher, CancellationTokenSource tokenSource, CameraSetup setup, Action <VideoFrame> updateColor)
        {
            if (dispatcher.Thread != Thread.CurrentThread)
            {
                throw new InvalidOperationException(
                          "Call this constructor from UI thread please, because it creates ImageSource object for UI");
            }

            _dispatcher  = dispatcher;
            _tokenSource = tokenSource;
            _setup       = setup;
            _state       = State.Idle;
            SetPipeline(setup);
            Task.Factory.StartNew(() => BackgroundLoop(updateColor), tokenSource.Token);
        }
示例#25
0
        private void AddCameraEffects(ref CameraSetup camSetup)
        {
            Rotation = Local.Pawn.EyeRotation;

            float   speed = Owner.Velocity.Length.LerpInverse(0, 320);
            Vector3 left  = camSetup.Rotation.Left;
            Vector3 up    = camSetup.Rotation.Up;

            if (Owner.GroundEntity != null)
            {
                _walkBob += Time.Delta * 25.0f * speed;
            }

            Position += up * MathF.Sin(_walkBob) * speed * -1;
            Position += left * MathF.Sin(_walkBob * 0.6f) * speed * -0.5f;
        }
示例#26
0
    public override void PostCameraSetup(ref CameraSetup camSetup)
    {
        base.PostCameraSetup(ref camSetup);

        if (!Local.Pawn.IsValid())
        {
            return;
        }

        if (!activated)
        {
            lastPitch = camSetup.Rotation.Pitch();
            lastYaw   = camSetup.Rotation.Yaw();

            activated = true;
        }

        Position = camSetup.Position;
        Rotation = camSetup.Rotation;

        camSetup.ViewModel.FieldOfView = FieldOfView;

        var newPitch = Rotation.Pitch();
        var newYaw   = Rotation.Yaw();

        var pitchDelta = Angles.NormalizeAngle(newPitch - lastPitch);
        var yawDelta   = Angles.NormalizeAngle(lastYaw - newYaw);

        var playerVelocity = Local.Pawn.Velocity;
        var verticalDelta  = playerVelocity.z * Time.Delta;
        var viewDown       = Rotation.FromPitch(newPitch).Up * -1.0f;

        verticalDelta *= (1.0f - System.MathF.Abs(viewDown.Cross(Vector3.Down).y));
        pitchDelta    -= verticalDelta * 1;

        var offset = CalcSwingOffset(pitchDelta, yawDelta);

        offset += CalcBobbingOffset(playerVelocity);

        Position += Rotation * offset;

        lastPitch = newPitch;
        lastYaw   = newYaw;
    }
        /// <summary>
        /// Enables the user to select the source camera index.
        /// </summary>
        protected void SubsectionSourceCameraIndex()
        {
            CameraSetup cameraSetup     = _targetProcessing.cameraSetup;
            int         sliderMaxInt    = _targetProcessing.sourcePerViewGeometryCount;
            int         newPreviewIndex = sliderMaxInt;

            if (sliderMaxInt > 0)
            {
                string label   = "Source index:";
                string tooltip = "The index, in the setup, of the source depth map to use as input for per-view mesh creation.";
                newPreviewIndex = EditorGUILayout.IntSlider(new GUIContent(label, tooltip), cameraSetup.previewIndex, 0, sliderMaxInt);
            }
            if (newPreviewIndex != cameraSetup.previewIndex)
            {
                cameraSetup.previewIndex = newPreviewIndex;
                cameraSetup.OnPreviewIndexChange();
                SceneView.RepaintAll();
            }
        }
示例#28
0
文件: ViewModel.cs 项目: Exer0s/flood
    private void AddCameraEffects(ref CameraSetup camSetup)
    {
        Rotation = Local.Pawn.EyeRot;

        //
        // Bob up and down based on our walk movement
        //
        var speed = Owner.Velocity.Length.LerpInverse(0, 320);
        var left  = camSetup.Rotation.Left;
        var up    = camSetup.Rotation.Up;

        if (Owner.GroundEntity != null)
        {
            walkBob += Time.Delta * 25.0f * speed;
        }

        Position += up * MathF.Sin(walkBob) * speed * -1;
        Position += left * MathF.Sin(walkBob * 0.6f) * speed * -0.5f;
    }
示例#29
0
        public void ConfigureCaptureToFile(string path, CameraSetup setup)
        {
            Connect();

            lock (_lock)
            {
                if (_isCapturing)
                {
                    CppAssembly.StopCaptureImageToFile(_cameraReaderPointer);
                }

                CppAssembly.StartCaptureImageToFile(_cameraReaderPointer, path, (uint)setup.RGBWidth, (uint)setup.RGBHeight, (uint)setup.RGBFPS, out var invokeResult);
                _isCapturing = true;
                _startTime   = DateTime.Now;
                if (invokeResult != 0)
                {
                    throw new InvalidOperationException($"StartRecording Failed #{invokeResult}.");
                }
            }
        }
示例#30
0
        private void AddCameraEffects(ref CameraSetup setup)
        {
            var speed        = Velocity.Length.LerpInverse(0, 320);
            var forwardspeed = Velocity.Normal.Dot(setup.Rotation.Forward);

            var left = setup.Rotation.Left;
            var up   = setup.Rotation.Up;

            if (GroundEntity != null)
            {
                walkBob += Time.Delta * 10.0f * speed;
            }

            setup.Position += up * MathF.Sin(walkBob) * speed * 2;
            setup.Position += left * MathF.Sin(walkBob * 0.6f) * speed * 1;

            // Camera lean
            lean = lean.LerpTo(Velocity.Dot(setup.Rotation.Right) * 0.01f, Time.Delta * 15.0f);

            var controller  = Controller as WalkController;
            var wallRun     = controller.WallRun;
            var wallRunLean = wallRun.GetWallJumpDirection();

            if (wallRun.IsWallRunning)
            {
                Log.Info("wall run lean: " + wallRunLean.ToString());
                Log.Info("dot: " + wallRunLean.Dot(setup.Rotation.Right) * 0.01f);
                lean = lean.LerpTo((wallRunLean.Dot(setup.Rotation.Right) * 0.01f) * 20f, Time.Delta * 10.0f);
            }

            var appliedLean = lean;

            appliedLean    += MathF.Sin(walkBob) * speed * 0.2f;
            setup.Rotation *= Rotation.From(0, 0, appliedLean);

            speed = (speed - 0.7f).Clamp(0, 1) * 3.0f;

            fov = fov.LerpTo(speed * 5 * MathF.Abs(forwardspeed), Time.Delta * 2.0f);

            setup.FieldOfView += fov;
        }
        /// <summary>
        /// Resets the object's properties.
        /// </summary>
        void Reset()
        {
            // Reset the key child components.
            _cameraSetup          = CameraSetup.CreateOrResetCameraSetup(transform);
            _dataHandler          = DataHandler.CreateOrResetDataHandler(transform);
            _previewCameraManager = PreviewCameraManager.CreateOrResetPreviewCameraManager(transform);
#if UNITY_EDITOR
            // Reset parameters to their default values.
            _cameraPrefab     = null;
            _cameraCount      = new Vector2Int(4, 4);
            _acquireDepthData = false;
            _copyGlobalMesh   = false;
            _setupType        = SetupType.Grid;
            _setupDirection   = SetupDirection.Outwards;
            _lockSetup        = false;
            // Update the acquisition camera poses to reflect the updated setup.
            ComputeAcquisitionCameraPoses();
            // Create a preview camera from the prefab.
            CreatePreviewCameraFromPrefab();
#endif //UNITY_EDITOR
        }
示例#32
0
        /// <summary>
        /// Reads the acquisition information to store camera parameters and poses.
        /// </summary>
        public void ReadAcquisitionInformation()
        {
            // Reset the setup's camera models.
            cameraSetup.ResetCameraModels();
            // Check the data directory for source data.
            dataHandler.CheckStatusOfSourceData(out sourceColorCount, out sourcePerViewGeometryCount, out sourceGlobalGeometryCount, out sourceDataInfo);
            // Check that the source data directory is configured based on the COLMAP file structure.
            if (COLMAPConnector.DirectoryIsValidForReading(dataHandler.dataDirectory))
            {
                // Read the pose data and camera parameters, and store it into the initial camera models.
                COLMAPConnector.ReadImagesInformation(cameraSetup, dataHandler.dataDirectory);
                COLMAPConnector.ReadCamerasInformation(cameraSetup, dataHandler.dataDirectory);
                // Only continue if camera models were successfully parsed.
                if (cameraSetup.cameraModels != null && cameraSetup.cameraModels.Length > 0)
                {
#if UNITY_EDITOR
                    // If needed, provide default parameters for the additional source data information.
                    if (!File.Exists(dataHandler.additionalInfoFile))
                    {
                        dataHandler.SaveCOLIBRIVRAdditionalInformation(cameraSetup);
                    }
#endif //UNITY_EDITOR
                    // Read the additional information, and store it in the camera setup.
                    if (File.Exists(dataHandler.additionalInfoFile))
                    {
                        dataHandler.ReadCOLIBRIVRAdditionalInformation(cameraSetup);
                    }
#if UNITY_EDITOR
                    // Update the gizmo size.
                    cameraSetup.gizmoSize = CameraSetup.ComputeGizmoSize(cameraSetup.cameraModels);
                    cameraSetup.UpdateGizmosSize();
#endif //UNITY_EDITOR
                }
            }
            // Check whether data has already been processed or bundled.
            dataHandler.CheckStatusOfDataProcessingAndBundling(out isDataReadyForBundling, out isDataBundled, out processedDataInfo);
        }
示例#33
0
    private void AddCameraEffects(ref CameraSetup setup)
    {
        var speed        = Velocity.Length.LerpInverse(0, 320);
        var forwardspeed = Velocity.Normal.Dot(setup.Rotation.Forward);

        var left = setup.Rotation.Left;
        var up   = setup.Rotation.Up;

        if (GroundEntity != null)
        {
            walkBob += Time.Delta * 25.0f * speed;
        }

        setup.Position += up * MathF.Sin(walkBob) * speed * 2;
        setup.Position += left * MathF.Sin(walkBob * 0.6f) * speed * 1;

        // Camera lean
        lean = lean.LerpTo(Velocity.Dot(setup.Rotation.Right) * 0.015f, Time.Delta * 15.0f);

        var appliedLean = lean;

        appliedLean    += MathF.Sin(walkBob) * speed * 0.2f;
        setup.Rotation *= Rotation.From(0, 0, appliedLean);

        speed = (speed - 0.7f).Clamp(0, 1) * 3.0f;

        fov = fov.LerpTo(speed * 20 * MathF.Abs(forwardspeed), Time.Delta * 2.0f);

        setup.FieldOfView += fov;

        //	var tx = new Sandbox.UI.PanelTransform();
        //	tx.AddRotation( 0, 0, lean * -0.1f );

        //	Hud.CurrentPanel.Style.Transform = tx;
        //	Hud.CurrentPanel.Style.Dirty();
    }
 public virtual void AddToManagersBottomUp()
 {
     CameraSetup.ResetCamera(SpriteManager.Camera);
     AssignCustomVariables(false);
 }
	void Awake()
	{
        camera_script = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
	}