|
@@ -47,6 +47,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
[TabGroup("击飞击落")] [LabelText("Y方向阻力")] public float decelerationRatioY = 15f;
|
|
[TabGroup("击飞击落")] [LabelText("Y方向阻力")] public float decelerationRatioY = 15f;
|
|
|
private Character landingDamageFrom;
|
|
private Character landingDamageFrom;
|
|
|
private Vector3 startFlyPos;
|
|
private Vector3 startFlyPos;
|
|
|
|
|
+
|
|
|
[TabGroup("击飞击落")] [LabelText("起飞预设角度")] public float startFlyAngle = 15f;
|
|
[TabGroup("击飞击落")] [LabelText("起飞预设角度")] public float startFlyAngle = 15f;
|
|
|
[Tooltip("x为最小值,y为最大值")]
|
|
[Tooltip("x为最小值,y为最大值")]
|
|
|
[TabGroup("击飞击落")] [LabelText("飞行预设角速度随机范围")] public Vector2 flyingRotateSpeedRange = new Vector2(15,45);
|
|
[TabGroup("击飞击落")] [LabelText("飞行预设角速度随机范围")] public Vector2 flyingRotateSpeedRange = new Vector2(15,45);
|
|
@@ -54,7 +55,8 @@ public class AttributeStatus : MonoBehaviour
|
|
|
private Vector3 scale;
|
|
private Vector3 scale;
|
|
|
[TabGroup("击飞击落")] [LabelText("压缩程度")] public float compressionDegree = 0.8f;
|
|
[TabGroup("击飞击落")] [LabelText("压缩程度")] public float compressionDegree = 0.8f;
|
|
|
[Tooltip("x为向下压缩经过的时间,y为回弹经过的时间")]
|
|
[Tooltip("x为向下压缩经过的时间,y为回弹经过的时间")]
|
|
|
- [TabGroup("击飞击落")] [LabelText("压缩速度")] public Vector2 compressionSpeed =new Vector2(0.2f,1f);
|
|
|
|
|
|
|
+ [TabGroup("击飞击落")] [LabelText("压缩速度")] public Vector2 compressionSpeed =new Vector2(0.2f,0.4f);
|
|
|
|
|
+ [TabGroup("击飞击落")] [LabelText("弹跳速度")] public float jumpVel = 5f;
|
|
|
|
|
|
|
|
[TabGroup("易伤")]
|
|
[TabGroup("易伤")]
|
|
|
[DisplayOnly] public bool haveVulnerable;
|
|
[DisplayOnly] public bool haveVulnerable;
|
|
@@ -293,23 +295,23 @@ public class AttributeStatus : MonoBehaviour
|
|
|
case SpecialState.BlownUp:
|
|
case SpecialState.BlownUp:
|
|
|
//击落
|
|
//击落
|
|
|
case SpecialState.ShotDown:
|
|
case SpecialState.ShotDown:
|
|
|
|
|
+ Vector3 vel = rb.velocity;
|
|
|
switch (hitState)
|
|
switch (hitState)
|
|
|
{
|
|
{
|
|
|
case -1:
|
|
case -1:
|
|
|
break;
|
|
break;
|
|
|
case 0:
|
|
case 0:
|
|
|
- Vector3 vel = rb.velocity;
|
|
|
|
|
if (isFly && foot.TrigGround && vel.y <= 0)
|
|
if (isFly && foot.TrigGround && vel.y <= 0)
|
|
|
{
|
|
{
|
|
|
- vel = Vector3.zero;
|
|
|
|
|
if (!foot.haveGravity)
|
|
if (!foot.haveGravity)
|
|
|
{
|
|
{
|
|
|
character.transform.position = new Vector3(transform.position.x, character.platformPosY, transform.position.z);
|
|
character.transform.position = new Vector3(transform.position.x, character.platformPosY, transform.position.z);
|
|
|
- rb.useGravity = false;
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
character.ani.Play("weak", 0, 0);
|
|
character.ani.Play("weak", 0, 0);
|
|
|
character.bodyCollider.layer = character.gameObject.layer;
|
|
character.bodyCollider.layer = character.gameObject.layer;
|
|
|
- rb.velocity = Vector3.zero;
|
|
|
|
|
|
|
+ vel = vel/5f;
|
|
|
|
|
+ vel.y = jumpVel;
|
|
|
character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, character.platformRotZ);
|
|
character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, character.platformRotZ);
|
|
|
character.mecanim.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
character.mecanim.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
|
hitState = 1;
|
|
hitState = 1;
|
|
@@ -349,7 +351,6 @@ public class AttributeStatus : MonoBehaviour
|
|
|
character.mecanim.transform.Rotate(0,0, flyingRotateSpeed*Time.deltaTime);
|
|
character.mecanim.transform.Rotate(0,0, flyingRotateSpeed*Time.deltaTime);
|
|
|
isFly = true;
|
|
isFly = true;
|
|
|
}
|
|
}
|
|
|
- rb.velocity = vel;
|
|
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
|
//眩晕状态
|
|
//眩晕状态
|
|
@@ -362,11 +363,21 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
|
|
+ if (vel.x > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ vel.x -= decelerationRatioX * Time.deltaTime;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ vel.x += decelerationRatioX * Time.deltaTime;
|
|
|
|
|
+ }
|
|
|
|
|
+ vel.y -= decelerationRatioY * Time.deltaTime;
|
|
|
|
|
|
|
|
attributeTime -= Time.deltaTime;
|
|
attributeTime -= Time.deltaTime;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ rb.velocity = vel;
|
|
|
break;
|
|
break;
|
|
|
//眩晕
|
|
//眩晕
|
|
|
case SpecialState.Weak:
|
|
case SpecialState.Weak:
|
|
@@ -384,28 +395,11 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
void BounceEffect()
|
|
void BounceEffect()
|
|
|
{
|
|
{
|
|
|
- float velocity = Mathf.Clamp(rb.velocity.y, 0, 10);
|
|
|
|
|
- float squash = Mathf.Lerp(0.8f, 0.5f, velocity / 10f);
|
|
|
|
|
-
|
|
|
|
|
Transform spine = character.mecanim.transform;
|
|
Transform spine = character.mecanim.transform;
|
|
|
-
|
|
|
|
|
Sequence landSequence = DOTween.Sequence();
|
|
Sequence landSequence = DOTween.Sequence();
|
|
|
landSequence.Append(spine.DOScaleY(scale.y * compressionDegree, compressionSpeed.x));
|
|
landSequence.Append(spine.DOScaleY(scale.y * compressionDegree, compressionSpeed.x));
|
|
|
- landSequence.Append(spine.DOScaleY(scale.y, compressionSpeed.y).SetEase(Ease.OutElastic));
|
|
|
|
|
- //landSequence.Append(spine.DOScaleY(scale.y * 0.8f, 0.2f));
|
|
|
|
|
- //landSequence.Append(spine.DOScaleY(scale.y, 1f).SetEase(Ease.OutElastic));
|
|
|
|
|
-
|
|
|
|
|
- // 小弹跳
|
|
|
|
|
- //if (velocity > 2f)
|
|
|
|
|
- //{
|
|
|
|
|
- // landSequence.Append(transform.DOJump(
|
|
|
|
|
- // transform.position,
|
|
|
|
|
- // velocity * 0.1f,
|
|
|
|
|
- // 1,
|
|
|
|
|
- // 0.3f
|
|
|
|
|
- // ));
|
|
|
|
|
- //}
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ landSequence.Append(spine.DOScaleY(scale.y, compressionSpeed.y));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
public void OutSpecialState()
|
|
public void OutSpecialState()
|
|
@@ -474,7 +468,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
this.attackInfo = attackInfo;
|
|
this.attackInfo = attackInfo;
|
|
|
AttackInfo.BlowUp blowUp = attackInfo.blowUp;
|
|
AttackInfo.BlowUp blowUp = attackInfo.blowUp;
|
|
|
attributeTime = blowUp.time * (1 - resistances.BlowUp);
|
|
attributeTime = blowUp.time * (1 - resistances.BlowUp);
|
|
|
- Vector3 vec3 = blowUp.dir.normalized;
|
|
|
|
|
|
|
+ Vector3 vec3 = new Vector3(
|
|
|
|
|
+ blowUp.dir.x + UnityEngine.Random.Range(-blowUp.dirRandom.x/2f, blowUp.dirRandom.x/2f),
|
|
|
|
|
+ blowUp.dir.y + UnityEngine.Random.Range(-blowUp.dirRandom.y/2f, blowUp.dirRandom.y/2f),
|
|
|
|
|
+ 0).normalized;
|
|
|
int attackDir = 0;
|
|
int attackDir = 0;
|
|
|
switch (blowUp.directionType)
|
|
switch (blowUp.directionType)
|
|
|
{
|
|
{
|
|
@@ -495,10 +492,11 @@ public class AttributeStatus : MonoBehaviour
|
|
|
rb.useGravity = true;
|
|
rb.useGravity = true;
|
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
|
rb.velocity = Vector3.zero;
|
|
rb.velocity = Vector3.zero;
|
|
|
|
|
+
|
|
|
rb.AddForce(vec3 * blowUp.force * (1 - resistances.BlowUp), ForceMode.Impulse);
|
|
rb.AddForce(vec3 * blowUp.force * (1 - resistances.BlowUp), ForceMode.Impulse);
|
|
|
rb.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
rb.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
|
character.mecanim.transform.rotation = Quaternion.Euler(0, 0, startFlyAngle * attackDir);
|
|
character.mecanim.transform.rotation = Quaternion.Euler(0, 0, startFlyAngle * attackDir);
|
|
|
- flyingRotateSpeed = UnityEngine.Random.Range(flyingRotateSpeedRange.x,flyingRotateSpeedRange.y) * attackDir;
|
|
|
|
|
|
|
+ flyingRotateSpeed = - UnityEngine.Random.Range(flyingRotateSpeedRange.x,flyingRotateSpeedRange.y) * attackDir;
|
|
|
startFlyPos = transform.position;
|
|
startFlyPos = transform.position;
|
|
|
hitState = 0;
|
|
hitState = 0;
|
|
|
isFly = false;
|
|
isFly = false;
|
|
@@ -511,7 +509,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
this.attackInfo = attackInfo;
|
|
this.attackInfo = attackInfo;
|
|
|
AttackInfo.ShotDown shotDown = attackInfo.shotDown;
|
|
AttackInfo.ShotDown shotDown = attackInfo.shotDown;
|
|
|
attributeTime = shotDown.time * (1 - resistances.ShotDown);
|
|
attributeTime = shotDown.time * (1 - resistances.ShotDown);
|
|
|
- Vector3 vec3 = shotDown.dir.normalized;
|
|
|
|
|
|
|
+ Vector3 vec3 = new Vector3(
|
|
|
|
|
+ shotDown.dir.x + UnityEngine.Random.Range(-shotDown.dirRandom.x / 2f, shotDown.dirRandom.x / 2f),
|
|
|
|
|
+ shotDown.dir.y + UnityEngine.Random.Range(-shotDown.dirRandom.y / 2f, shotDown.dirRandom.y / 2f),
|
|
|
|
|
+ 0).normalized;
|
|
|
int attackDir = 0;
|
|
int attackDir = 0;
|
|
|
switch (shotDown.directionType)
|
|
switch (shotDown.directionType)
|
|
|
{
|
|
{
|