- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
  
- 纳金币
- 20645
- 精华
- 62
|
添加脚本位置
First Person Controller: 添加CameraSwitch脚本
下层物体 graphic
MainCamera
AnimationCamera:从3dmax中导入,添加CameraSwitch脚本
下层物体 camera 新建并作为子物体
cameraswitch代码:
var camera1 : Camera;
var camera2 : Camera;
//var customskin : GUISkin;
private var programeGoon : boolean = true;
/*function Start(){
programeGoon = true;
//mouselook1 = GetComponent(“mouseCameraCsharp”);
}*/
function Update () {
if(programeGoon)
{
camera1.enabled = true;
camera2.enabled = false;
programeGoon = false;
}
var fpswalker : FpsWalker = GetComponent(FPSWalker);
var mouseControl = GetComponent(“RightMouseControl”);
if(camera1.enabled)
{
mouseControl.enabled = true;
fpswalker.enabled = true;
}
if(!camera1.enabled)
{
mouseControl.enabled = false;
fpswalker.enabled = false;
}
}
function OnGUI () {
//GUI.skin = customskin;
GUI.Box (Rect (10,10,100,90), “Camera Switch”);
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (20,40,80,20), “Camera 1”)) {
camera1.enabled = true;
camera2.enabled = false;
}
// Make the second button.
if (GUI.Button (Rect (20,70,80,20), “Camera 2”)) {
camera1.enabled = false;
camera2.enabled = true;
}
}
}
|
|