Chgt camera via F1 F2

This commit is contained in:
Crom (Thibaut CHARLES) 2014-10-31 19:02:30 +01:00
parent 97a6b44bd3
commit f491b04ea5
3 changed files with 186 additions and 30 deletions

View File

@ -147,44 +147,20 @@ GameObject:
m_Component:
- 4: {fileID: 575068635}
- 20: {fileID: 575068634}
- 92: {fileID: 575068633}
- 124: {fileID: 575068632}
- 81: {fileID: 575068631}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Name: CameraPos1
m_TagString: CameraPos
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!81 &575068631
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 575068630}
m_Enabled: 1
--- !u!124 &575068632
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 575068630}
m_Enabled: 1
--- !u!92 &575068633
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 575068630}
m_Enabled: 1
--- !u!20 &575068634
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 575068630}
m_Enabled: 1
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
@ -213,8 +189,64 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 575068630}
m_LocalRotation: {x: .29895553, y: .362094492, z: -.123831443, w: .874173343}
m_LocalPosition: {x: 350, y: 20, z: 350}
m_LocalRotation: {x: .313099325, y: .167965993, z: -.0563636683, w: .933048487}
m_LocalPosition: {x: 369.235046, y: 20, z: 342.061523}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
--- !u!1 &704469714
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 704469716}
- 20: {fileID: 704469715}
m_Layer: 0
m_Name: CameraPos2
m_TagString: CameraPos
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!20 &704469715
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 704469714}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_HDR: 0
m_OcclusionCulling: 1
--- !u!4 &704469716
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 704469714}
m_LocalRotation: {x: .219791919, y: .685406387, z: -.229999095, w: .654988587}
m_LocalPosition: {x: 351.700012, y: 20, z: 372.700012}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -287,6 +319,98 @@ Transform:
m_LocalScale: {x: 5, y: 5, z: 5}
m_Children: []
m_Father: {fileID: 0}
--- !u!1 &1859570684
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1859570690}
- 20: {fileID: 1859570689}
- 92: {fileID: 1859570688}
- 124: {fileID: 1859570687}
- 81: {fileID: 1859570686}
- 114: {fileID: 1859570685}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1859570685
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859570684}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0847dfc9c9ff529478bce7d29ab3f52d, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!81 &1859570686
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859570684}
m_Enabled: 1
--- !u!124 &1859570687
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859570684}
m_Enabled: 1
--- !u!92 &1859570688
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859570684}
m_Enabled: 1
--- !u!20 &1859570689
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859570684}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_HDR: 0
m_OcclusionCulling: 1
--- !u!4 &1859570690
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1859570684}
m_LocalRotation: {x: .29895553, y: .362094492, z: -.123831443, w: .874173343}
m_LocalPosition: {x: 350, y: 20, z: 350}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
--- !u!1 &1911482241
GameObject:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
// Use this for initialization
void Awake () {
targetPos = transform.position;
targetRot = transform.rotation;
cameraPosList = GameObject.FindGameObjectsWithTag("CameraPos");
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.F1)){
targetPos = cameraPosList[0].transform.position;
targetRot = cameraPosList[0].transform.rotation;
}
else if(Input.GetKeyDown(KeyCode.F2)){
targetPos = cameraPosList[1].transform.position;
targetRot = cameraPosList[1].transform.rotation;
}
transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime);
transform.rotation = Quaternion.Lerp(transform.rotation, targetRot, Time.deltaTime);
}
private GameObject[] cameraPosList;
private Vector3 targetPos;
private Quaternion targetRot;
}

View File

@ -3,6 +3,7 @@
--- !u!78 &1
TagManager:
tags:
- CameraPos
-
Builtin Layer 0: Default
Builtin Layer 1: TransparentFX