问题描述
这是错误本身 “Assets\Extreme Drift\Scripts\Vehicle\VehicleCamera.cs(5,28): 错误 CS0234: 命名空间 'UnityStandardAssets' 中不存在类型或命名空间名称 'ImageEffects'(您是否缺少程序集引用?)”
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityStandardAssets.ImageEffects;
public class VehicleCamera : MonoBehavIoUr
{
public static VehicleCamera manage;
public float smooth = 0.3f;
public float distance = 5.0f;
public float height = 1.0f;
public float angle = 20;
public LayerMask lineOfSightMask = 0;
[HideInInspector]
public Transform target;
[HideInInspector]
public List<Transform> cameraSwitchView;
private bool farCameraview = false;
private Vector3 farCameraPosition;
private Vector3 veLocity = Vector3.zero;
private float Xsmooth;
private float fardistance = 0.0f;
private float zAngleAmount = 0.0f;
private float timeScale = 0.0f;
private float currentdistance;
private int Switch = -1;
void Awake()
{
manage = this;
farCameraPosition = transform.position;
}
void Start()
{
farCameraview = true;
farCameraPosition = (AIControl.manage.firstAINode.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode.position)
+ new Vector3(Random.Range(-5.0f,5.0f),Random.Range(5.0f,10.0f),Random.Range(-5.0f,5.0f));
}
void LateUpdate()
{
if (GameUI.manage.gameFinished)
Switch = 4;
fardistance = Vector3.distance(farCameraPosition,target.position);
if (fardistance < 100.0f && farCameraview) farCameraview = false;
transform.GetComponent<Blur>().enabled = GameUI.manage.gamePaused ? true : false;
// add MotionBlur effect to camera
if (AIControl.CurrentVehicle.shifting || GameUI.manage.driftAmount > 25)
transform.GetComponent<MotionBlur>().blurAmount = Mathf.Lerp(transform.GetComponent<MotionBlur>().blurAmount,0.5f,Time.deltaTime * 5);
else
transform.GetComponent<MotionBlur>().blurAmount = Mathf.Lerp(transform.GetComponent<MotionBlur>().blurAmount,0.0f,Time.deltaTime);
if (Switch == -1)
{
RenderSettings.flareStrength = 0.3f;
GetComponent<Camera>().fieldOfView = Mathf.Clamp(AIControl.CurrentVehicle.speed / 10.0f + 60.0f,60,90.0f);
currentdistance = distance;
float yAngle = Mathf.SmoothdampAngle(transform.eulerAngles.y,target.eulerAngles.y,ref veLocity.y,smooth);
float xAngle = Mathf.SmoothdampAngle(transform.eulerAngles.x,target.eulerAngles.x + (angle),ref veLocity.x,smooth);
// Look at the target
transform.eulerAngles = new Vector3(xAngle,yAngle,accelerationAngle());
Xsmooth = Mathf.Lerp(Xsmooth,veLocity.y,Time.deltaTime * 10.0f);
var direction = transform.rotation * -new Vector3(-Xsmooth / 300.0f,1);
var targetdistance = AdjustLineOfSight(target.position + new Vector3(0,height,0),direction);
transform.position = target.position + new Vector3(0,0) + direction * targetdistance;
}
else if (Switch < AIControl.CurrentVehicle.cameraview.cameraSwitchView.Count)
{
RenderSettings.flareStrength = 0.3f;
GetComponent<Camera>().fieldOfView = 60;
transform.position = cameraSwitchView[Switch].position;
transform.rotation = Quaternion.Lerp(transform.rotation,cameraSwitchView[Switch].rotation,Time.deltaTime * 5.0f);
}
else {
if (fardistance > 120.0f && !farCameraview)
{
farCameraPosition = (AIControl.CurrentVehicle.AIVehicle.nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode
.GetComponent<AINode>().nextNode.position)
+ new Vector3(Random.Range(-5.0f,Random.Range(10.0f,15.0f),5.0f));
farCameraview = true;
}
RenderSettings.flareStrength = 0.0f;
GetComponent<Camera>().fieldOfView = Mathf.Clamp(50.0f - (fardistance / 2.0f),10.0f,120.0f);
var newRotation = Quaternion.LookRotation(target.position - transform.position);
transform.position = farCameraPosition;
transform.rotation = Quaternion.Slerp(transform.rotation,newRotation,Time.deltaTime * 15);
}
}
public void CameraSwitch()
{
Switch++;
if (Switch > AIControl.CurrentVehicle.cameraview.cameraSwitchView.Count) { Switch = -1; }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private float accelerationAngle()
{
zAngleAmount = Mathf.Clamp(zAngleAmount,-45.0f,45.0f);
zAngleAmount = Mathf.Lerp(zAngleAmount,Input.acceleration.x * -70.0f,Time.deltaTime * 2.0f);
return zAngleAmount;
}
float AdjustLineOfSight(Vector3 target,Vector3 direction)
{
RaycastHit hit;
if (Physics.Raycast(target,direction,out hit,currentdistance,lineOfSightMask.value))
return hit.distance;
else
return currentdistance;
}
}
据我了解,您需要将“标准资产”连接到项目,我连接了它,但它仍然不起作用。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)