本文整理汇总了C#中CameraMode类的典型用法代码示例。如果您正苦于以下问题:C# CameraMode类的具体用法?C# CameraMode怎么用?C# CameraMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraMode类属于命名空间,在下文中一共展示了CameraMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Camera
public Camera(Rectangle viewportRect)
{
speed = 4f;
zoom = 1f;
viewportRectangle = viewportRect;
mode = CameraMode.Follow;
}
开发者ID:RainbowCupcake,项目名称:MLPTheMasterQuest,代码行数:7,代码来源:Camera.cs
示例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);
}
开发者ID:TheSuperGoge,项目名称:UnDeadSchool,代码行数:28,代码来源:Camera.cs
示例3: Camera
public Camera(Game game, Matrix world)
: base(game)
{
world_ = world;
Mode = CameraMode.PROJECTIVE;
string shit = CameraMode.PROJECTIVE.ToString();
}
开发者ID:TheSuperGoge,项目名称:UnDeadSchool,代码行数:7,代码来源:Camera.cs
示例4: UseEditCamera
public void UseEditCamera()
{
editCam.gameObject.SetActive(true);
boofyCam.gameObject.SetActive(false);
editCam.orthographicSize = editCameraSize;
cameraMode = CameraMode.kEdit;
}
开发者ID:kevrcav,项目名称:MotherDragon,代码行数:7,代码来源:BoofyCamera.cs
示例5: Camera
public Camera(Rectangle viewportRectangle)
{
_speed = DefaultSpeed;
Zoom = DefaultZoom;
_viewportRectangle = viewportRectangle;
_mode = CameraMode.Follow;
}
开发者ID:redomex,项目名称:LevertPokemon,代码行数:7,代码来源:Camera.cs
示例6: setFocus
public void setFocus(GameObject targetObject)
{
if(mode != CameraMode.Move)
previousMode = mode;
mode = CameraMode.Move;
moveTarget = targetObject;
}
开发者ID:rameshvarun,项目名称:TheSixthSun,代码行数:7,代码来源:CameraControls.cs
示例7: CombinedCamera
public CombinedCamera(Tank target, CameraMode initialMode, Vector3 initialPosition)
{
this.mode = initialMode;
this.tank = target;
this.focus = target.getPosition();
this.position = initialPosition;
}
开发者ID:AstromechZA,项目名称:CSC3020H-Tank-Control,代码行数:7,代码来源:CombinedCamera.cs
示例8: IncreaseView
public void IncreaseView()
{
if (CameraMode == CameraMode.FirstPerson)
CameraMode = CameraMode.Overhead;
else
CameraMode ++;
}
开发者ID:matthewrenze,项目名称:asteroids,代码行数:7,代码来源:CameraChase.cs
示例9: DecreaseView
public void DecreaseView()
{
if (CameraMode == CameraMode.Overhead)
CameraMode = CameraMode.FirstPerson;
else
CameraMode --;
}
开发者ID:matthewrenze,项目名称:asteroids,代码行数:7,代码来源:CameraChase.cs
示例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;
}
开发者ID:ray-z,项目名称:RPG,代码行数:7,代码来源:CameraController.cs
示例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;
}
}
开发者ID:Dio-Deus,项目名称:solitude,代码行数:8,代码来源:SwitchCamera.cs
示例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;
}
开发者ID:BrainRushIO,项目名称:ASALearningApp,代码行数:9,代码来源:HoverFollowCam.cs
示例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 ) );
}
}
开发者ID:nulldatamap,项目名称:mubah-unity,代码行数:8,代码来源:CameraController.cs
示例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;
}
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:9,代码来源:Camera.cs
示例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();
}
}
开发者ID:josbalcaen,项目名称:BrainsEden,代码行数:58,代码来源:CameraFollow.cs
示例16: Start
void Start()
{
camera = GetComponentInChildren<Camera>();
Assert.IsNotNull( camera );
// TODO: Make this based on settings
mode = new CameraMode.Free();
offset = FindOffset();
}
开发者ID:nulldatamap,项目名称:mubah-unity,代码行数:10,代码来源:CameraController.cs
示例17: Camera
public Camera()
{
x = 0;
y = 0;
mode = CameraMode.Manual;
_following = null;
bounded = true;
bounds = new CameraBounds();
bounds.inherit_from_map();
}
开发者ID:ohwillie,项目名称:demon_door,代码行数:10,代码来源:VERGEMap.cs
示例18: OrbCamera
/// <summary>
/// Defines a chasing camera around the target (or the first ship to come).
/// </summary>
/// <param name="mode">Camera mode (cockpit or external).</param>
/// <param name="target">Target ship name.</param>
public OrbCamera(CameraMode mode, string target = "")
{
Mode = mode;
Target = target;
Pos = new Vector3(0, 5, 2);
TrackMode = CameraTrackMode.TargetRelative;
GroundLocation = new double[] { 0, 0, 0 };
GroundDirection = new double[] { 0, 0 };
FieldOfView = 60.0;
}
开发者ID:SolarLiner,项目名称:TLEOrbiter,代码行数:15,代码来源:OrbCamera.cs
示例19: Update
void Update ()
{
if (isDead ())
{
Debug.Log ("Player died!");
animator.SetBool("dead", true);
}
if (currentCameraMode == CameraMode.Third)
{
if (FirstPerson.activeInHierarchy)
FirstPerson.SetActive (false);
if (!ThirdPerson.activeInHierarchy)
ThirdPerson.SetActive (true);
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
if (Input.GetKeyDown (KeyCode.Space))
{
currentCameraMode = CameraMode.First;
}
} else if (currentCameraMode == CameraMode.First)
{
if (!FirstPerson.activeInHierarchy)
FirstPerson.SetActive (true);
if (ThirdPerson.activeInHierarchy)
ThirdPerson.SetActive (false);
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
if (Input.GetKeyDown (KeyCode.Space))
{
currentCameraMode = CameraMode.Third;
}
if (Input.GetMouseButtonDown (0))
{
currentCameraMode = CameraMode.Arrow;
FirstPerson.SetActive (false);
Transform vert = FirstPerson.transform.FindChild ("VerticalAnchor");
GameObject arrow = Instantiate (ArrowMode, arrowSpawn.transform.position, arrowSpawn.transform.rotation) as GameObject;
}
} else
{
if (FirstPerson.activeInHierarchy)
FirstPerson.SetActive (false);
if (ThirdPerson.activeInHierarchy)
ThirdPerson.SetActive (false);
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
}
开发者ID:mr-team,项目名称:project-lesscontra,代码行数:55,代码来源:PlayerController.cs
示例20: handleInput
/**
* HandleInput: switch camera modes and activate tweaning between them
*/
public void handleInput(KeyboardState currentKeyboardState)
{
// SWITCH camera
if (currentKeyboardState.IsKeyDown(Keys.D1))
{
this.mode = CameraMode.FirstPerson;
posTweanActive = true; // reactivate tweaning
focTweanActive = true;
}
if (currentKeyboardState.IsKeyDown(Keys.D2))
{
this.mode = CameraMode.ThirdPerson;
posTweanActive = true; // reactivate tweaning
focTweanActive = true;
}
if (currentKeyboardState.IsKeyDown(Keys.D3))
{
this.mode = CameraMode.Orbitting;
this.orbitAngle = tank.orientationAngle; // orbit must start at the 3rd person angle
posTweanActive = true; // reactivate tweaning
focTweanActive = true;
}
// Height and distance of camera
if (currentKeyboardState.IsKeyDown(Keys.L))
{
distance = MathHelper.Clamp(distance + C_DELTADISTANCE, C_MINDISTANCE, C_MAXDISTANCE);
}
if (currentKeyboardState.IsKeyDown(Keys.O))
{
distance = MathHelper.Clamp(distance - C_DELTADISTANCE, C_MINDISTANCE, C_MAXDISTANCE);
}
if (currentKeyboardState.IsKeyDown(Keys.I))
{
height = MathHelper.Clamp(height + C_DELTAHEIGHT, C_MINHEIGHT, C_MAXHEIGHT);
}
if (currentKeyboardState.IsKeyDown(Keys.K))
{
height = MathHelper.Clamp(height - C_DELTAHEIGHT, C_MINHEIGHT, C_MAXHEIGHT);
}
if (currentKeyboardState.IsKeyDown(Keys.U))
{
looseness = MathHelper.Clamp(looseness + 0.005f, 0.05f, 0.9f);
}
if (currentKeyboardState.IsKeyDown(Keys.J))
{
looseness = MathHelper.Clamp(looseness - 0.005f, 0.05f, 0.9f);
}
}
开发者ID:AstromechZA,项目名称:CSC3020H-Tank-Control,代码行数:56,代码来源:CombinedCamera.cs
注:本文中的CameraMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论