本文整理汇总了C#中CameraMode类的典型用法代码示例。如果您正苦于以下问题:C# CameraMode类的具体用法?C# CameraMode怎么用?C# CameraMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraMode类属于命名空间,在下文中一共展示了CameraMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Camera
public Camera(Rectangle viewportRect)
{
speed = 4f;
zoom = 1f;
viewportRectangle = viewportRect;
mode = CameraMode.Follow;
}
示例2: Update
public override void Update(GameTime gameTime)
{
KeyboardManager KManager = (KeyboardManager)Game.Services.GetService(typeof(KeyboardManager));
if (KManager.IsKeyPressed(Keys.M))
{
Mode = (CameraMode)(((int)Mode + 1) % 2);
}
float X = KManager.IsKeyDown(Keys.Right) ? 1 : 0;
X -= KManager.IsKeyDown(Keys.Left) ? 1 : 0;
float Z = KManager.IsKeyDown(Keys.Down) ? 1 : 0;
Z -= KManager.IsKeyDown(Keys.Up) ? 1 : 0;
Vector3 move = new Vector3(X, 0, Z);
if (move.Length() > 0)
{
world_.Translation += move;
}
view_ = Matrix.CreateLookAt(world_.Translation, world_.Forward + world_.Translation, world_.Up);
switch (Mode)
{
case CameraMode.PROJECTIVE:
projection_ = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, Game.GraphicsDevice.Viewport.AspectRatio, 0.1f, 100);
break;
case CameraMode.ORTHOGONAL:
projection_ = Matrix.CreateOrthographic(Game.GraphicsDevice.Viewport.Width/20, Game.GraphicsDevice.Viewport.Height/20, 0.1f, 100);
break;
}
base.Update(gameTime);
}
示例3: Camera
public Camera(Game game, Matrix world)
: base(game)
{
world_ = world;
Mode = CameraMode.PROJECTIVE;
string shit = CameraMode.PROJECTIVE.ToString();
}
示例4: UseEditCamera
public void UseEditCamera()
{
editCam.gameObject.SetActive(true);
boofyCam.gameObject.SetActive(false);
editCam.orthographicSize = editCameraSize;
cameraMode = CameraMode.kEdit;
}
示例5: Camera
public Camera(Rectangle viewportRectangle)
{
_speed = DefaultSpeed;
Zoom = DefaultZoom;
_viewportRectangle = viewportRectangle;
_mode = CameraMode.Follow;
}
示例6: setFocus
public void setFocus(GameObject targetObject)
{
if(mode != CameraMode.Move)
previousMode = mode;
mode = CameraMode.Move;
moveTarget = targetObject;
}
示例7: CombinedCamera
public CombinedCamera(Tank target, CameraMode initialMode, Vector3 initialPosition)
{
this.mode = initialMode;
this.tank = target;
this.focus = target.getPosition();
this.position = initialPosition;
}
示例8: IncreaseView
public void IncreaseView()
{
if (CameraMode == CameraMode.FirstPerson)
CameraMode = CameraMode.Overhead;
else
CameraMode ++;
}
示例9: DecreaseView
public void DecreaseView()
{
if (CameraMode == CameraMode.Overhead)
CameraMode = CameraMode.FirstPerson;
else
CameraMode --;
}
示例10: newTargetView
public void newTargetView(Transform newTransform)
{
cameraMode = CameraMode.ToTarget;
targetPosition = newTransform.position + Vector3.up * 2;
targetOffset = newTransform.forward * 3 + newTransform.up * 3 + newTransform.right * 3;
isTransforming = true;
}
示例11: SetCameraMode
public void SetCameraMode(CameraMode mode)
{
SingleCamera.enabled = mode == CameraMode.Single;
for(int i = 0; i < SideBySideCamera.Length;i++){
SideBySideCamera[i].enabled = mode == CameraMode.SideBySide;
}
}
示例12: PanOut
//call this to pan out and away from boat at end of level
public void PanOut()
{
lerpTimer = Time.time;
isPanningOut = true;
startPosition = transform.position;
panAwayPosition = new Vector3(transform.position.x + -50f, transform.position.y + 100f, transform.position.z + -50f);
thisCameraMode = CameraMode.lerpToDestination;
}
示例13: ToggleLockOn
public void ToggleLockOn( GameObject t )
{
if( mode is CameraMode.LockedOn ) {
mode = mode.Switch( new CameraMode.Free() );
} else {
mode = mode.Switch( new CameraMode.LockedOn( t ) );
}
}
示例14: Camera
public Camera(Rectangle viewport, Configuration.Controls controls, Vector2 position, CameraMode mode = CameraMode.Follow)
{
_controls = controls;
Speed = 4.0f;
_zoom = 1.0f;
_viewport = viewport;
Position = position;
_mode = mode;
}
示例15: Update
// Update is called once per frame
void Update()
{
float lerpVal = Time.deltaTime*0.1f*60f;
if(Input.GetKeyDown(KeyCode.Return))
{
CurrentCameraMode = CameraMode.Game;
_CurrentCamPos = transform.position;
_CurrentTargetPos = _LookAtPos;
}
// Menu camera
if(CurrentCameraMode == CameraMode.Menu)
{
if(_CamPosIndex < _CamPosList.Count-1)
{
if(_CamPosList[_CamPosIndex+1] && Mathf.Abs(_CamPosList[_CamPosIndex+1].position.x - transform.position.x) < 0.25f)
{
Debug.Log("close enough");
++_CamPosIndex;
}
transform.position = Vector3.Lerp(transform.position, _CamPosList[_CamPosIndex+1].position, lerpVal/10);
_LookAtPos = transform.position;
_LookAtPos.y -= 1.0f;
transform.LookAt(_LookAtPos);
}
else if(_CamPosIndex == _CamPosList.Count - 1)
{
_LookAtPos = Vector3.Lerp(_LookAtPos, EndTarget.position, lerpVal/20);
transform.LookAt(_LookAtPos);
}
}
// Game camera
else if(CurrentCameraMode == CameraMode.Game)
{
if(!_PlayerDied)
{
CalcDesiredPos();
}
if(Input.GetKeyDown(KeyCode.Space))
{
_DesiredCamDist = CamDistFar;
}
if(Input.GetKeyUp(KeyCode.Space))
{
_DesiredCamDist = CamDist;
}
_CurrentCamPos = Vector3.Lerp(_CurrentCamPos,_DesiredCamPos,lerpVal);
_CurrentTargetPos = Vector3.Lerp(_CurrentTargetPos,_DesiredTargetPos,lerpVal);
_CurrentCamDist = Mathf.Lerp(_CurrentCamDist,_DesiredCamDist,lerpVal);
CalcLookat();
}
}