|
|
@@ -9,8 +9,8 @@ public enum SpecialState
|
|
|
{
|
|
|
Null = -1,
|
|
|
FloatState = 0,
|
|
|
- ShotDown = 1,
|
|
|
- BlownUp = 2,
|
|
|
+ BlownUp = 1,
|
|
|
+ ShotDown = 2,
|
|
|
Weak = 3,
|
|
|
}
|
|
|
|
|
|
@@ -116,8 +116,8 @@ public class AttributeStatus : MonoBehaviour
|
|
|
else if (foot.TrigGround || curHeight <= origPos.y + 0.05f)
|
|
|
{
|
|
|
floatingState = 0;
|
|
|
- character.ChangeState(CharacterState.Idle);
|
|
|
- curSpecialStates = SpecialState.Null;
|
|
|
+ character.isAdjustHeight = 1;
|
|
|
+ OutSpecialState();
|
|
|
return;
|
|
|
}
|
|
|
break;
|
|
|
@@ -146,41 +146,11 @@ public class AttributeStatus : MonoBehaviour
|
|
|
break;
|
|
|
//击飞
|
|
|
case SpecialState.BlownUp:
|
|
|
- if (rb.velocity.magnitude > 0)
|
|
|
- {
|
|
|
- //击飞中
|
|
|
- Vector3 vel = rb.velocity;
|
|
|
- if (foot.TrigGround && vel.y <= 0.01f)
|
|
|
- {
|
|
|
- vel = Vector3.zero;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- vel.x -= decelerationRatioX * Time.deltaTime;
|
|
|
- vel.y -= decelerationRatioY * Time.deltaTime;
|
|
|
- }
|
|
|
- rb.velocity = vel;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //眩晕状态
|
|
|
- if (attributeTime <= 0)
|
|
|
- {
|
|
|
- curSpecialStates = SpecialState.Null;
|
|
|
- character.ChangeState(CharacterState.Idle);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- rb.velocity = Vector3.zero;
|
|
|
- attributeTime -= Time.deltaTime;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
//击落
|
|
|
case SpecialState.ShotDown:
|
|
|
if (rb.velocity.magnitude > 0)
|
|
|
{
|
|
|
- //击落中
|
|
|
+ //击飞中
|
|
|
Vector3 vel = rb.velocity;
|
|
|
if (foot.TrigGround && vel.y <= 0.01f)
|
|
|
{
|
|
|
@@ -198,14 +168,8 @@ public class AttributeStatus : MonoBehaviour
|
|
|
//眩晕状态
|
|
|
if (attributeTime <= 0)
|
|
|
{
|
|
|
- //被击晕后上升
|
|
|
- rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionY;
|
|
|
- rb.useGravity = false;
|
|
|
- if (character.AdjustHeight())
|
|
|
- {
|
|
|
- curSpecialStates = SpecialState.Null;
|
|
|
- character.ChangeState(CharacterState.Idle);
|
|
|
- }
|
|
|
+ character.isAdjustHeight = 1;
|
|
|
+ OutSpecialState();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -218,8 +182,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
case SpecialState.Weak:
|
|
|
if (attributeTime <= 0)
|
|
|
{
|
|
|
- curSpecialStates = SpecialState.Null;
|
|
|
- character.ChangeState(CharacterState.Idle);
|
|
|
+ OutSpecialState();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -230,6 +193,17 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void OutSpecialState()
|
|
|
+ {
|
|
|
+ curSpecialStates = SpecialState.Null;
|
|
|
+ if (character.canFly)
|
|
|
+ {
|
|
|
+ rb.useGravity = false;
|
|
|
+ rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionY;
|
|
|
+ }
|
|
|
+ character.ChangeState(CharacterState.Idle);
|
|
|
+ }
|
|
|
+
|
|
|
public int DamageCalculation(int damage)
|
|
|
{
|
|
|
damage = (int)(damage * (1 + vulnerableRate) + 0.5f);
|