当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.Camera类代码示例

本文整理汇总了C#中UnityEngine.Camera的典型用法代码示例。如果您正苦于以下问题:C# Camera类的具体用法?C# Camera怎么用?C# Camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Camera类属于UnityEngine命名空间,在下文中一共展示了Camera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareGridRender

 public DrawGridParameters PrepareGridRender(Camera camera, Vector3 pivot, Quaternion rotation, float size, bool orthoMode, bool gridVisible)
 {
   bool flag1 = false;
   bool flag2 = false;
   bool flag3 = false;
   if (gridVisible)
   {
     if (orthoMode)
     {
       Vector3 vector3 = rotation * Vector3.forward;
       if ((double) Mathf.Abs(vector3.y) > 0.200000002980232)
         flag2 = true;
       else if (vector3 == Vector3.left || vector3 == Vector3.right)
         flag1 = true;
       else if (vector3 == Vector3.forward || vector3 == Vector3.back)
         flag3 = true;
     }
     else
       flag2 = true;
   }
   this.xGrid.target = flag1;
   this.yGrid.target = flag2;
   this.zGrid.target = flag3;
   DrawGridParameters drawGridParameters;
   drawGridParameters.pivot = pivot;
   drawGridParameters.color = (Color) SceneViewGrid.kViewGridColor;
   drawGridParameters.size = size;
   drawGridParameters.alphaX = this.xGrid.faded;
   drawGridParameters.alphaY = this.yGrid.faded;
   drawGridParameters.alphaZ = this.zGrid.faded;
   return drawGridParameters;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:32,代码来源:SceneViewGrid.cs

示例2: Start

        void Start()
        {
            m_Cam = GetComponent<Camera>();
            m_OriginalRotation = transform.localRotation;

            this.UpdateAsObservable()
                .Where(_ => GameState.Instance.GameStateReactiveProperty.Value == GameStateEnum.Countdown ||
                            GameState.Instance.GameStateReactiveProperty.Value == GameStateEnum.GameUpdate)
                .Select(_ =>
                {
                    var playerPos = PlayerManager.Instance.GetAlivePlayers()
                        .Select(x => x.transform.position);

                    var _x = playerPos.Average(x => x.x);
                    var _y = playerPos.Average(x => x.y);
                    var _z = playerPos.Average(x => x.z);

                    tergetPos = new Vector3(_x, _y, _z);
                    return tergetPos;

                }).DelayFrame(3)
                .Subscribe(target =>
                {
                    var campos = tergetPos + m_defaultPosition;
                    transform.position = Vector3.Lerp(this.transform.position, campos, Time.deltaTime * 5.0f);
             //       transform.LookAt(target - this.transform.position);
                });

        }
开发者ID:TORISOUP,项目名称:Born_to_Beans_src,代码行数:29,代码来源:StageCameraPotision.cs

示例3: CalcDragAxis

		public static Axis CalcDragAxis(Vector3 movement, Camera cam)
		{
			Vector3 mask = VectorToMask(movement);

			if(mask.x + mask.y + mask.z == 2)
			{
				return MaskToAxis(Vector3.one - mask);
			}
			else
			{
				switch( MaskToAxis(mask) )
				{
					case Axis.X:
						if( Mathf.Abs(Vector3.Dot(cam.transform.forward, Vector3.up)) < Mathf.Abs(Vector3.Dot(cam.transform.forward, Vector3.forward)))
							return Axis.Z;
						else
							return Axis.Y;

					case Axis.Y:
						if( Mathf.Abs(Vector3.Dot(cam.transform.forward, Vector3.right)) < Mathf.Abs(Vector3.Dot(cam.transform.forward, Vector3.forward)))
							return Axis.Z;
						else
							return Axis.X;

					case Axis.Z:
						if( Mathf.Abs(Vector3.Dot(cam.transform.forward, Vector3.right)) < Mathf.Abs(Vector3.Dot(cam.transform.forward, Vector3.up)))
							return Axis.Y;
						else
							return Axis.X;
					default:

						return Axis.None;
				}
			}
		}
开发者ID:GroupByStudios,项目名称:TDS_Gauss,代码行数:35,代码来源:pg_Util.cs

示例4: Awake

        void Awake()
        {

            playerGameObject.transform.position = new Vector3(229, 1000, 5897);
            t_Camera = Camera.main;

        }
开发者ID:JonathanMG,项目名称:TerrainGen,代码行数:7,代码来源:PlayerTransitionManager.cs

示例5: WaterTileBeingRendered

 public void WaterTileBeingRendered(Transform tr, Camera currentCam)
 {
     if (currentCam && edgeBlend)
     {
         currentCam.depthTextureMode |= DepthTextureMode.Depth;
     }
 }
开发者ID:CenzyGames,项目名称:Save-your-date-new,代码行数:7,代码来源:WaterBase.cs

示例6: Start

        // Use this for initialization
        private void Start()
        {
        	if (Application.loadedLevelName == "Sanctuary")
        	{
        		Sprint = true;
        		m_WalkSpeed = 5;
        		m_RunSpeed = 10;
        	}
        	else
        	{
				m_WalkSpeed = GetComponent<combatStats>().walkSpeed;
				m_RunSpeed = GetComponent<combatStats>().runSpeed;
				m_CrouchSpeed = GetComponent<combatStats>().crouchSpeed;
        	}
            m_CharacterController = GetComponent<CharacterController>();
            m_Camera = Camera.main;
            m_OriginalCameraPosition = m_Camera.transform.localPosition;
            m_FovKick.Setup(m_Camera);
            m_HeadBob.Setup(m_Camera, m_StepInterval);
            m_StepCycle = 0f;
            m_NextStep = m_StepCycle/2f;
            m_Jumping = false;
            m_AudioSource = GetComponent<AudioSource>();
			m_MouseLook.Init(transform , m_Camera.transform);
        }
开发者ID:hydrater,项目名称:TLH,代码行数:26,代码来源:FirstPersonController.cs

示例7: OnEnable

        private void OnEnable()
        {
            rb = GetComponent<Rigidbody>();
			activeCamera = GameObject.Find("Scene Camera").GetComponent<Camera>();
            gesture = GetComponent<TapGesture>();
            gesture.Tapped += tappedHandler;
        }
开发者ID:RabitBox,项目名称:FlickBattler,代码行数:7,代码来源:Kick.cs

示例8: Awake

        private void Awake()
        {
            _selectionVisualCamera = this.GetComponentInChildren<Camera>();
            _selectionVisual = this.GetComponentInChildren<MeshRenderer>().transform;

            ToggleEnabled(false);
        }
开发者ID:andrewstarnes,项目名称:wwtd2,代码行数:7,代码来源:SelectionRectangleComponent.cs

示例9: RenderHelpCameras

        public void RenderHelpCameras(Camera currentCam)
        {
            if (null == m_HelperCameras)
            {
                m_HelperCameras = new Dictionary<Camera, bool>();
            }

            if (!m_HelperCameras.ContainsKey(currentCam))
            {
                m_HelperCameras.Add(currentCam, false);
            }
            if (m_HelperCameras[currentCam])
            {
                return;
            }

            if (!m_ReflectionCamera)
            {
                m_ReflectionCamera = CreateReflectionCameraFor(currentCam);
            }

            RenderReflectionFor(currentCam, m_ReflectionCamera);

            m_HelperCameras[currentCam] = true;
        }
开发者ID:ClintChil,项目名称:Unity-Zombie,代码行数:25,代码来源:PlanarReflection.cs

示例10: CreateTextureFor

 RenderTexture CreateTextureFor(Camera cam)
 {
     RenderTexture rt = new RenderTexture(Mathf.FloorToInt(cam.pixelWidth * 0.5F),
         Mathf.FloorToInt(cam.pixelHeight * 0.5F), 24);
     rt.hideFlags = HideFlags.DontSave;
     return rt;
 }
开发者ID:ClintChil,项目名称:Unity-Zombie,代码行数:7,代码来源:PlanarReflection.cs

示例11: CreateReflectionCameraFor

        Camera CreateReflectionCameraFor(Camera cam)
        {
            String reflName = gameObject.name + "Reflection" + cam.name;
            GameObject go = GameObject.Find(reflName);

            if (!go)
            {
                go = new GameObject(reflName, typeof(Camera));
            }
            if (!go.GetComponent(typeof(Camera)))
            {
                go.AddComponent(typeof(Camera));
            }
            Camera reflectCamera = go.GetComponent<Camera>();

            reflectCamera.backgroundColor = clearColor;
            reflectCamera.clearFlags = reflectSkybox ? CameraClearFlags.Skybox : CameraClearFlags.SolidColor;

            SetStandardCameraParameter(reflectCamera, reflectionMask);

            if (!reflectCamera.targetTexture)
            {
                reflectCamera.targetTexture = CreateTextureFor(cam);
            }

            return reflectCamera;
        }
开发者ID:ClintChil,项目名称:Unity-Zombie,代码行数:27,代码来源:PlanarReflection.cs

示例12: DragSelectionBox

        public void DragSelectionBox(Camera main, CursorPanGroup group, CursorButton button, TutorialAIManager manager, float delayTime, string methodName)
        {
            BoxSelector selector = main.GetComponent<BoxSelector>();
            if (selector == null) {
                Debug.LogError("Cannot find Box Selector component from camera, " + main.ToString() + ".");
                return;
            }

            if (button != CursorButton.Left_Click) {
                Debug.LogError("Selection box only works with left mouse button.");
                return;
            }

            selector.StartBoxSelection(group, 0.5f);
            this.icon.SetButton(button);
            this.buttonPressedElapsedTime = 0f;
            this.isButtonPressed = true;
            this.isButtonHeld = true;
            this.isAppearing = true;
            this.panningElapsedTime = 0f;
            this.startingPosition = group.start;
            this.endingPosition = group.end;
            this.rectTransform.position = group.start;

            manager.Invoke(methodName, delayTime);
            this.Invoke("HeldButtonRelease", delayTime);
        }
开发者ID:tommai78101,项目名称:Multiplier,代码行数:27,代码来源:Cursor.cs

示例13: Setup

        public void Setup(Camera camera)
        {
            CheckStatus(camera);

            Camera = camera;
            OriginalFOV = camera.fieldOfView;
        }
开发者ID:fafase,项目名称:Catharsis,代码行数:7,代码来源:FOVKick.cs

示例14: OnEnter

        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(camera);
            if (go == null)
            {
                _cam = Camera.mainCamera;
            }else{

                Camera _camera = go.camera;
                if (_camera == null)
                {
                    LogError("Missing Camera Component!");
                    Finish();
                    return;
                }else{
                    _cam = _camera;
                }
            }

            DoRaycastFromScreen();

            if (repeatInterval.Value == 0)
            {
                Finish();
            }
        }
开发者ID:nothiphop,项目名称:PlayMakerCustomActions_U3,代码行数:26,代码来源:RayCastFromScreen.cs

示例15: HUDCompass

 public HUDCompass(Camera camera)
 {
     compassCamera = camera;
     HorizontalAlignment = HorizontalAlignment.Right;
     VerticalAlignment = VerticalAlignment.Bottom;
     LoadAssets();
 }
开发者ID:my0pic,项目名称:daggerfall-unity,代码行数:7,代码来源:HUDCompass.cs


注:本文中的UnityEngine.Camera类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。