本文整理汇总了C#中CameraState类的典型用法代码示例。如果您正苦于以下问题:C# CameraState类的具体用法?C# CameraState怎么用?C# CameraState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CameraState类属于命名空间,在下文中一共展示了CameraState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CameraController
public CameraController(string cameraName)
{
this.cameraName = cameraName;
windowShowing = false;
image = new VisionImage();
state = CameraState.FREE;
}
示例2: PossessPlayer
public void PossessPlayer(GameObject player)
{
if (state == CameraState.FREE_FLOW)
{
if (player.CompareTag("Salesman"))
{
character = CharacterClass.SALESMAN;
}
else if (player.CompareTag("Shopper"))
{
character = CharacterClass.SHOPPER;
}
else if (player.CompareTag("Guard"))
{
character = CharacterClass.GUARD;
}
else if (player.CompareTag("Thief"))
{
character = CharacterClass.THIEF;
}
else return;
PossessionScript ps = player.GetComponent<PossessionScript>();
ps.Possess();
possessedCharacter = player;
attachedRotation = player.transform.rotation;
attachedLocation = player.transform.position + attachedRotation * new Vector3(0, 1.85f, -2);
freeFlyLocation = transform.position;
freeFlyRotation = transform.rotation;
state = CameraState.ATTACHING;
tick = 0;
}
}
示例3: switchCameraRutine
IEnumerator switchCameraRutine( CameraState from )
{
float t = 0.0f;
Vector3 fromPos, toPos;
fromPos = quadForeground.transform.position;
toPos = (from == CameraState.AR) ? vrPos : arPos;
while (t < 1.0f) {
quadForeground.transform.position = Vector3.Lerp (fromPos, toPos, t);
t = t + 0.1f;
yield return new WaitForSeconds(0.02f);
}
if (from == CameraState.VR) {
Debug.Log("change camera to AR");
state = CameraState.AR;
} else if (from == CameraState.AR) {
Debug.Log("change camera to VR");
state = CameraState.VR;
}
yield return 0;
}
示例4: DoClimb
//=================================================================================================================o
// Remember the last camera state when climbing
void DoClimb(string s)
{
if (s != "None") // While climbing
{
if (camState == CameraState.FirstPerson)
{
camState = CameraState.ThirdPerson;
}
else if (camState == CameraState.Orbit)
{
camState = CameraState.ThirdPerson;
}
else if (camState == CameraState.ThirdPerson)
{
return;
}
}
else // Leaving climb modus
{
if (lastState == "FirstPerson")
{
camState = CameraState.FirstPerson;
}
else if (lastState == "ThirdPerson")
{
camState = CameraState.ThirdPerson;
}
else if (lastState == "Orbit")
{
camState = CameraState.Orbit;
}
}
}
示例5: Reset
public override void Reset()
{
base.Reset();
m_Tween = m_StartTween;
m_CameraState = CameraState.Enter;
}
示例6: Start
// Use this for initialization
void Start () {
combat = new CameraState(localCombatPosition,localCombatRotation);
inventory = new CameraState(localInventoryPosition,localInventoryRotation);
currentState = combat;
desiredState = combat;
}
示例7: Update
// Update is called once per frame
void Update () {
//If the user turns left or right, change the enum
if (Input.GetKey (KeyCode.D))
{
direction = CameraState.Right;
}
else if (Input.GetKey (KeyCode.A))
{
direction = CameraState.Left;
}
//call the method to handle moving the camera over time
shiftSlow (direction);
//Add shiftIndex to the X-value of the camera to move it
transform.position = new Vector3 (toFollow.position.x + shiftIndex, toFollow.position.y, transform.position.z);
//This code is for zooming the camera
if((Input.GetAxis ("Mouse ScrollWheel") < 0f || Input.GetKey(KeyCode.PageDown))&& //If the user scrolls down
this.GetComponent<Camera>().orthographicSize < 15f) //And the camera isn't zoomed too far out already
{
this.GetComponent<Camera>().orthographicSize += 0.5f; //Zoom out
}
if ((Input.GetAxis("Mouse ScrollWheel") > 0f|| Input.GetKey(KeyCode.PageUp)) && //If the user scrolls up
this.GetComponent<Camera>().orthographicSize > 6.5) //And the camera isn't zoomed in too far already
{
this.GetComponent<Camera>().orthographicSize -= 0.5f; //Zoom in
}
}
示例8: Update
// Update is called once per frame
void Update()
{
_cameraState = _camera.CameraState;
CalculateSpeed();
_animator.SetFloat(AnimatorConditions.AirVelocity, _airVelocity);
switch (_cameraState)
{
case CameraState.Normal:
// Allow player to rotate their character
if (Input.GetAxis(PlayerInput.Horizontal) > 0.1f || Input.GetAxis(PlayerInput.Horizontal) < -0.1f)
{
_myTransform.Rotate(0f, Input.GetAxis(PlayerInput.Horizontal) * _rotationSpeed * Time.deltaTime, 0f);
}
// Check if character is grounded
if (_controller.isGrounded == true)
{
_moveDirection = Vector3.zero;
_airVelocity = 0f;
_animator.SetBool(AnimatorConditions.IsGrounded, true);
// Cache user input into variables
_horizontal = Input.GetAxis(PlayerInput.Horizontal);
_vertical = Input.GetAxis(PlayerInput.Vertical);
// Set values in animator conditions
_animator.SetFloat(AnimatorConditions.Direction, _horizontal);
_animator.SetFloat(AnimatorConditions.Speed, _vertical);
if (Input.GetButtonDown(PlayerInput.Jump))
{
Jump();
}
}
else
{
// Allow player to move while in air
_moveDirection.x = Input.GetAxis(PlayerInput.Horizontal) * _moveSpeed;
_moveDirection.z = Input.GetAxis(PlayerInput.Vertical) * _moveSpeed;
_moveDirection = _myTransform.TransformDirection(_moveDirection);
_animator.SetBool(AnimatorConditions.IsGrounded, false);
}
break;
case CameraState.Target:
break;
}
// Apply gravity to character
_moveDirection.y -= gravity * Time.deltaTime;
//Move character withthe _moveDirection Vector3 calculated above.
_controller.Move(_moveDirection * Time.deltaTime);
}
示例9: changeCameraState
IEnumerator changeCameraState(CameraState start, CameraState end, float timeInterval) {
isTransitioning = true;
for(float t = 0F; t < timeInterval; t += Time.deltaTime) {
transform.localPosition = Vector3.Lerp(start.position, end.position, t/timeInterval);
transform.localRotation = Quaternion.Lerp(start.rotation, end.rotation, t/timeInterval);
yield return null;
}
isTransitioning = false;
currentState = end;
}
示例10: shiftSlow
//Take into account the player's direction and shift the camera
void shiftSlow(CameraState heading)
{
if (heading == CameraState.Right && shiftIndex < 5f)
{
shiftIndex += 0.2f;
}
else if (heading == CameraState.Left && shiftIndex > -5f)
{
shiftIndex -= 0.2f;
}
}
示例11: Start
// Use this for initialization
void Start () {
if (_target == null) {
Debug.Log ("no target");
}
state = CameraState.VR;
arPos = new Vector3(_target.transform.position.x, _target.transform.position.y , _target.transform.transform.position.z + 0.5f);
vrPos = new Vector3(_target.transform.position.x, _target.transform.position.y - 0.8f, _target.transform.transform.position.z + 0.5f);
plane = GameObject.Find ("Plane");
plane.transform.position = vrPos;
plane.GetComponent<Renderer>().enabled = true;
}
示例12: ReleasePlayer
public GameObject ReleasePlayer()
{
GameObject retval = possessedCharacter;
possessedCharacter = null;
PossessionScript ps = retval.GetComponent<PossessionScript>();
ps.Depossess();
attachedLocation = transform.position;
attachedRotation = transform.rotation;
state = CameraState.DETACHING;
tick = 0;
return retval;
}
示例13: Start
void Start(){
foreach (Transform tran in transform) {
switch(tran.name)
{
case "SystemCamera":
systemCamera = tran.gameObject;
break;
case "LC":
leftCamera = tran.gameObject;
break;
case "RC":
rightCamera = tran.gameObject;
break;
case "ZeroParallaxPlane":
zeroParallaxPlane = tran.gameObject;
break;
}
}
if(Application.platform == RuntimePlatform.Android)
{
state = CameraState.AndroidRunTimeState;
systemCamera.SetActive(false);
leftCamera.SetActive(true);
rightCamera.SetActive(true);
zeroParallaxPlane.SetActive(true);
}
switch(state)
{
case CameraState.WindowsEditorState:
{
break;
}
case CameraState.WindowsStereoState:
{
initLRCameras ();
break;
}
case CameraState.AndroidRunTimeState:
{
initCameras ();
break;
}
}
zeroParallaxPlane.GetComponent<MeshRenderer> ().enabled = false;
}
示例14: Start
// Use this for initialization
void Start()
{
if (_target == null) {
Debug.Log ("no target");
return;
}
quadForeground = GameObject.Find ("QuadForeground");
state = CameraState.VR;
vrPos = new Vector3 (0.0f, 1.0f, 0.137f);
arPos = new Vector3 (0.0f, 0.0f, 0.137f);
}
示例15: Start
// Use this for initialization
void Start () {
if (_target == null) {
Debug.Log ("no target");
}
state = CameraState.VR;
vrPos = new Vector3(_target.transform.position.x, _target.transform.position.y +1.0f, _target.transform.transform.position.z + 0.137f);
arPos = new Vector3(_target.transform.position.x, _target.transform.position.y, _target.transform.transform.position.z + 0.137f);
quadForeground = GameObject.Find ("QuadForeground");
quadForeground.transform.position = vrPos;
}