// Cache缓存
private var target : Transform;
private var myTrans : Transform;
private var parentTrans : Transform;
var transitionPlane : Transform;
var occlusionDetectorPrefab : Transform;
// Attribute属性
private var distance : float = 10;
private var maxDistance : float = 15;
private var minDistance : float = 5;
//private var height : float = (distance * 2.5) - 5.5;
// Script 脚本
//X角
private var xAngle : float;
//初始X角
private var initialXAngle : float;
//上升速度
private var riseSpeed : int = 30;
//是否有碰撞
private var isColliding : boolean = false;
//目标位置
private var targetPosition : Vector3;
//对这档观看
private var toWatchForOcclusion : Array = new Array();
//遮挡探测器
private var occlusionDetector : Transform;
//走
private var go : boolean = false;
//死亡
private var dead : boolean = false;
//是否暴击
private var isCrit : boolean = false;
//暴击命中
private var critHitVec : Vector3 = Vector3.zero;
if (isCrit)
{
myTrans.Translate(critHitVec);
}
else//走
{
// Don't look at while critting
myTrans.LookAt(parentTrans);
// Move camera to position distance distance away from parent
myTrans.position = parentTrans.position;
myTrans.Translate(0,0,-distance);
}
// Only do while zooming
occlusionDetector.localScale.z = (target.position - myTrans.position).magnitude-1;
occlusionDetector.localPosition.z = occlusionDetector.localScale.z/2;
}
if (Input.GetAxis("Mouse Wheel"))
{
print ("Mouse wheel is being used");
distance += Input.GetAxis("Zoom") * Time.deltaTime * 10;
}
}
}
// No target
else if (dead)
{
myTrans.Translate(Time.deltaTime,0,0);
myTrans.LookAt(target);
}
else
print ("oh noes! No target...");
}
}
function StartRising()
{
isColliding = true;
if (xAngle < 89)
xAngle += Time.deltaTime * riseSpeed;
}
function StopRising()
{
isColliding = false;
}
function PlayerDied()
{
go = false;
dead = true;
for (x=0.0; x<1; x+=Time.deltaTime)
{
myTrans.LookAt(target);
myTrans.Translate(0,0, ((target.position - myTrans.position).magnitude) * Time.deltaTime);
yield;
}
}
// Goes from full black to transparent 从全黑到透明
function BlackIn()
{
var transitionTime : float = .5;
for (x=0.0; x<transitionTime; x+=Time.deltaTime)
{
transitionPlane.renderer.material.color.a = (transitionTime - x)/transitionTime;
yield;
}
transitionPlane.renderer.material.color.a = 0;
}
//从透明到全黑
function BlackOut()
{
var transitionTime : float = .5;
for (x=0.0; x<transitionTime; x+=Time.deltaTime)
{
transitionPlane.renderer.material.color.a = (x)/transitionTime;
yield;
}
}
function TransitionSlideIn()
{
transitionPlane.localPosition = Vector3(-1,0,.3);
var transitionTime : float = .5;
for (x=0.0; x<transitionTime; x+=Time.deltaTime)
{
transitionPlane.Translate(1/transitionTime*Time.deltaTime,0,0);
yield;
}
transitionPlane.localPosition = Vector3(0,0,.3);
}
function TransitionSlideOut()
{
transitionPlane.localPosition = Vector3(0,0,.3);
var transitionTime : float = .5;
for (x=0.0; x<transitionTime; x+=Time.deltaTime)
{
transitionPlane.Translate(1/transitionTime*Time.deltaTime,0,0);
yield;
}
transitionPlane.localPosition = Vector3(-1,0,.3);
}