|
|
@@ -32,8 +32,8 @@ public class MoveCharacter : Character
|
|
|
public bool isBeDropped;
|
|
|
|
|
|
[Header("新增漂浮效果参数")]
|
|
|
- public float maxTime = 0; //上升最大耗时
|
|
|
- public float minTime = 6; //上升最小耗时
|
|
|
+ public float maxTime = 1.5f; //上升最大耗时
|
|
|
+ public float minTime = 0.1f; //上升最小耗时
|
|
|
public float maxHeight = 12; //最大上升高度
|
|
|
public float minHeight = 7; //最小上升高度
|
|
|
|
|
|
@@ -53,15 +53,12 @@ public class MoveCharacter : Character
|
|
|
|
|
|
public float normalFallSpeed;
|
|
|
public float rapidFallSpeed;
|
|
|
- private float curFallSpeed;
|
|
|
+ public float curFallSpeed;
|
|
|
|
|
|
private Vector3 origPos; //初始位置
|
|
|
private float origY;
|
|
|
private float pastTime; //上升已用时间
|
|
|
private float rise = 1;
|
|
|
- private float down = -1;
|
|
|
- private Vector3 oneClockwise = new Vector3(0, 0, 1);
|
|
|
- private Vector3 oneCounterClockwise = new Vector3(0, 0, -1);
|
|
|
|
|
|
public int floatState; //0:不漂浮;1:漂浮中;2:飘着;3:掉下去
|
|
|
|
|
|
@@ -91,6 +88,7 @@ public class MoveCharacter : Character
|
|
|
mesh = spinee.GetComponent<MeshRenderer>();
|
|
|
mats = mesh.materials;
|
|
|
origY = transform.position.y;
|
|
|
+ curFallSpeed = normalFallSpeed;
|
|
|
}
|
|
|
|
|
|
private void Start()
|
|
|
@@ -130,28 +128,45 @@ public class MoveCharacter : Character
|
|
|
|
|
|
public void FloatStateOn()
|
|
|
{
|
|
|
- if (canMove)
|
|
|
+ if (!isTran)
|
|
|
{
|
|
|
- isFloat = true;
|
|
|
- ChangeMat(0);
|
|
|
- curTime = 0;
|
|
|
- if (floatState == 0)
|
|
|
+ if (canMove)
|
|
|
{
|
|
|
- origPos = transform.position;
|
|
|
- curHeight = origPos.y;
|
|
|
+ canMove = false;
|
|
|
+ if (curFallSpeed == 0)
|
|
|
+ {
|
|
|
+ curFallSpeed = normalFallSpeed;
|
|
|
+ }
|
|
|
+ isFloat = true;
|
|
|
+ ChangeMat(0);
|
|
|
+ curTime = 0;
|
|
|
+ if (floatState == 0)
|
|
|
+ {
|
|
|
+ origPos = transform.position;
|
|
|
+ origY = origPos.y;
|
|
|
+ curHeight = origPos.y;
|
|
|
+ }
|
|
|
+ origPos.x = transform.position.x;
|
|
|
+ ChangeState(CharacterState.Rise);
|
|
|
+ floatState = 1;
|
|
|
+ riseTime = Random.Range(minTime, maxTime);
|
|
|
+ backSpeed = Random.Range(1, 4);
|
|
|
+ if (gameObject.tag == "Enemy" || gameObject.tag == "Player")
|
|
|
+ {
|
|
|
+ backSpeed = -backSpeed;
|
|
|
+ }
|
|
|
+ rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
|
|
|
+ rotateDir = (1.5f - Random.Range(1, 3)) * 2;
|
|
|
+ height = Random.Range(minHeight, maxHeight);
|
|
|
}
|
|
|
- origPos.x = transform.position.x;
|
|
|
- ChangeState(CharacterState.Rise);
|
|
|
- floatState = 1;
|
|
|
- riseTime = Random.Range(minTime, maxTime);
|
|
|
- backSpeed = Random.Range(1, 4);
|
|
|
- if (gameObject.tag == "Enemy" || gameObject.tag == "Player")
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (pc == null)
|
|
|
{
|
|
|
- backSpeed = -backSpeed;
|
|
|
+ pc = GetComponentInParent<PlayerController>();
|
|
|
}
|
|
|
- rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
|
|
|
- rotateDir = (1.5f - Random.Range(1, 3)) * 2;
|
|
|
- height = Random.Range(minHeight, maxHeight);
|
|
|
+ pc.FloatStateOn();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -211,7 +226,7 @@ public class MoveCharacter : Character
|
|
|
{
|
|
|
if (!isBeDropped)
|
|
|
{
|
|
|
- transform.position = origPos;
|
|
|
+ //transform.position = origPos;
|
|
|
ChangeState(CharacterState.Idle);
|
|
|
}
|
|
|
else
|
|
|
@@ -220,16 +235,19 @@ public class MoveCharacter : Character
|
|
|
isBeDropped = false;
|
|
|
}
|
|
|
ChangeMat(1);
|
|
|
+ /*
|
|
|
foreach (Material m in mats)
|
|
|
{
|
|
|
m.SetInt("_Outline", 0);
|
|
|
- floatState = 0;
|
|
|
- isFloat = false;
|
|
|
- curFallSpeed = normalFallSpeed;
|
|
|
- if (gameObject.tag == "Player")
|
|
|
- {
|
|
|
- GetComponent<PlayerController>().soulCollector.enabled = true;
|
|
|
- }
|
|
|
+ }
|
|
|
+ */
|
|
|
+ floatState = 0;
|
|
|
+ isFloat = false;
|
|
|
+ canMove = true;
|
|
|
+ curFallSpeed = normalFallSpeed;
|
|
|
+ if (gameObject.tag == "Player")
|
|
|
+ {
|
|
|
+ GetComponent<PlayerController>().soulCollector.enabled = true;
|
|
|
}
|
|
|
}
|
|
|
}
|