|
@@ -83,6 +83,12 @@ public class MoveCharacter : Character
|
|
|
public void FloatStateOn()
|
|
public void FloatStateOn()
|
|
|
{
|
|
{
|
|
|
ChangeMat(0);
|
|
ChangeMat(0);
|
|
|
|
|
+ curTime = 0;
|
|
|
|
|
+ if (floatState == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ origPos = transform.position;
|
|
|
|
|
+ curHeight = origPos.y;
|
|
|
|
|
+ }
|
|
|
ChangeState(CharacterState.Rise);
|
|
ChangeState(CharacterState.Rise);
|
|
|
floatState = 1;
|
|
floatState = 1;
|
|
|
riseTime = Random.Range(minTime, maxTime);
|
|
riseTime = Random.Range(minTime, maxTime);
|
|
@@ -91,9 +97,6 @@ public class MoveCharacter : Character
|
|
|
{
|
|
{
|
|
|
backSpeed = -backSpeed;
|
|
backSpeed = -backSpeed;
|
|
|
}
|
|
}
|
|
|
- origPos = transform.position;
|
|
|
|
|
- curHeight = origPos.y;
|
|
|
|
|
- curTime = 0;
|
|
|
|
|
rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
|
|
rotateSpeed = Random.Range(minRotateSpeed, maxRotateSpeed);
|
|
|
rotateDir = (1.5f - Random.Range(1, 3)) * 2;
|
|
rotateDir = (1.5f - Random.Range(1, 3)) * 2;
|
|
|
height = Random.Range(minHeight, maxHeight);
|
|
height = Random.Range(minHeight, maxHeight);
|
|
@@ -104,14 +107,8 @@ public class MoveCharacter : Character
|
|
|
transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
|
|
transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- public void Update()
|
|
|
|
|
|
|
+ public void CharacterFloat()
|
|
|
{
|
|
{
|
|
|
- if (beLarger)
|
|
|
|
|
- {
|
|
|
|
|
- Enlarge();
|
|
|
|
|
- }
|
|
|
|
|
- //print(maxTime);
|
|
|
|
|
if (floatState == 1)
|
|
if (floatState == 1)
|
|
|
{
|
|
{
|
|
|
RotateSelf();
|
|
RotateSelf();
|
|
@@ -123,27 +120,30 @@ public class MoveCharacter : Character
|
|
|
{
|
|
{
|
|
|
floatState = 2;
|
|
floatState = 2;
|
|
|
pastTime = curTime;
|
|
pastTime = curTime;
|
|
|
|
|
+ height = transform.position.y;
|
|
|
ChangeState(CharacterState.Float);
|
|
ChangeState(CharacterState.Float);
|
|
|
- transform.position = new Vector3(origPos.x, height, origPos.z);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else if (floatState == 2)
|
|
else if (floatState == 2)
|
|
|
{
|
|
{
|
|
|
RotateSelf();
|
|
RotateSelf();
|
|
|
curTime += Time.deltaTime;
|
|
curTime += Time.deltaTime;
|
|
|
- origPos.x += backSpeed * (curTime - pastTime);
|
|
|
|
|
- transform.position = new Vector3(origPos.x, height, origPos.z);
|
|
|
|
|
|
|
+ transform.position = new Vector3(origPos.x + backSpeed * (curTime - pastTime), height, origPos.z);
|
|
|
if (curTime >= floatTime)
|
|
if (curTime >= floatTime)
|
|
|
{
|
|
{
|
|
|
- floatState = 3;
|
|
|
|
|
- ChangeState(CharacterState.Fall);
|
|
|
|
|
|
|
+ transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, 0, 0), 0.02f);
|
|
|
|
|
+ if (transform.localEulerAngles.z >= -5f && transform.localEulerAngles.z <= 5f)
|
|
|
|
|
+ {
|
|
|
|
|
+ transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
|
|
|
+ floatState = 3;
|
|
|
|
|
+ origPos.x = transform.position.x;
|
|
|
|
|
+ ChangeState(CharacterState.Fall);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else if (floatState == 3)
|
|
else if (floatState == 3)
|
|
|
{
|
|
{
|
|
|
- RotateSelf();
|
|
|
|
|
aniCollider.Play("Fall", 0, 0);
|
|
aniCollider.Play("Fall", 0, 0);
|
|
|
-
|
|
|
|
|
if (transform.position.y >= origPos.y + 0.05f)
|
|
if (transform.position.y >= origPos.y + 0.05f)
|
|
|
{
|
|
{
|
|
|
curHeight -= 10 * Time.deltaTime;
|
|
curHeight -= 10 * Time.deltaTime;
|
|
@@ -157,11 +157,6 @@ public class MoveCharacter : Character
|
|
|
foreach (Material m in mats)
|
|
foreach (Material m in mats)
|
|
|
{
|
|
{
|
|
|
m.SetInt("_Outline", 0);
|
|
m.SetInt("_Outline", 0);
|
|
|
- }
|
|
|
|
|
- transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, 0, 0), 0.02f);
|
|
|
|
|
- if (transform.localEulerAngles.z >= -5f && transform.localEulerAngles.z <= 5f)
|
|
|
|
|
- {
|
|
|
|
|
- transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
|
|
|
floatState = 0;
|
|
floatState = 0;
|
|
|
if (gameObject.tag == "Player")
|
|
if (gameObject.tag == "Player")
|
|
|
{
|
|
{
|
|
@@ -172,6 +167,19 @@ public class MoveCharacter : Character
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ public void Update()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (beLarger)
|
|
|
|
|
+ {
|
|
|
|
|
+ Enlarge();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (floatState != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ CharacterFloat();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
|
|
public override void BeHit(int damage, Vector3 force, bool changeHurt, float repelValue)
|
|
|
{
|
|
{
|
|
|
print("MoveCharacterBeHit");
|
|
print("MoveCharacterBeHit");
|