|
|
@@ -39,8 +39,10 @@ public class MoveCharacter : Character
|
|
|
private float curHeight; //当前所在高度
|
|
|
private float rotateSpeed; //旋转速度
|
|
|
private float rotateDir; //旋转方向
|
|
|
+ private float backSpeed; //往后退的速度
|
|
|
|
|
|
private Vector3 origPos; //初始位置
|
|
|
+ private float pastTime; //上升已用时间
|
|
|
private float rise = 1;
|
|
|
private float down = -1;
|
|
|
private Vector3 oneClockwise = new Vector3(0, 0, 1);
|
|
|
@@ -85,6 +87,11 @@ public class MoveCharacter : Character
|
|
|
ChangeState(CharacterState.Rise);
|
|
|
floatState = 1;
|
|
|
riseTime = Random.Range(minTime, maxTime);
|
|
|
+ backSpeed = Random.Range(1, 4);
|
|
|
+ if (gameObject.tag == "Enemy" || gameObject.tag == "Player")
|
|
|
+ {
|
|
|
+ backSpeed = -backSpeed;
|
|
|
+ }
|
|
|
origPos = transform.position;
|
|
|
curHeight = origPos.y;
|
|
|
curTime = 0;
|
|
|
@@ -116,6 +123,7 @@ public class MoveCharacter : Character
|
|
|
if (curHeight >= height - 0.02f)
|
|
|
{
|
|
|
floatState = 2;
|
|
|
+ pastTime = curTime;
|
|
|
ChangeState(CharacterState.Float);
|
|
|
transform.position = new Vector3(origPos.x, height, origPos.z);
|
|
|
}
|
|
|
@@ -124,7 +132,7 @@ public class MoveCharacter : Character
|
|
|
{
|
|
|
RotateSelf();
|
|
|
curTime += Time.deltaTime;
|
|
|
- transform.position = new Vector3(origPos.x, height, origPos.z);
|
|
|
+ transform.position = new Vector3(origPos.x + backSpeed * (curTime - pastTime), height, origPos.z);
|
|
|
if (curTime >= floatTime)
|
|
|
{
|
|
|
floatState = 3;
|
|
|
@@ -155,6 +163,10 @@ public class MoveCharacter : Character
|
|
|
{
|
|
|
transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
|
floatState = 0;
|
|
|
+ if (gameObject.tag == "Player")
|
|
|
+ {
|
|
|
+ GetComponent<PlayerController>().soulCollector.enabled = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|