本文整理汇总了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;
}
示例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);
});
}
示例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;
}
}
}
示例4: Awake
void Awake()
{
playerGameObject.transform.position = new Vector3(229, 1000, 5897);
t_Camera = Camera.main;
}
示例5: WaterTileBeingRendered
public void WaterTileBeingRendered(Transform tr, Camera currentCam)
{
if (currentCam && edgeBlend)
{
currentCam.depthTextureMode |= DepthTextureMode.Depth;
}
}
示例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);
}
示例7: OnEnable
private void OnEnable()
{
rb = GetComponent<Rigidbody>();
activeCamera = GameObject.Find("Scene Camera").GetComponent<Camera>();
gesture = GetComponent<TapGesture>();
gesture.Tapped += tappedHandler;
}
示例8: Awake
private void Awake()
{
_selectionVisualCamera = this.GetComponentInChildren<Camera>();
_selectionVisual = this.GetComponentInChildren<MeshRenderer>().transform;
ToggleEnabled(false);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例13: Setup
public void Setup(Camera camera)
{
CheckStatus(camera);
Camera = camera;
OriginalFOV = camera.fieldOfView;
}
示例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();
}
}
示例15: HUDCompass
public HUDCompass(Camera camera)
{
compassCamera = camera;
HorizontalAlignment = HorizontalAlignment.Right;
VerticalAlignment = VerticalAlignment.Bottom;
LoadAssets();
}