|
|
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
using System;
|
|
|
using Sirenix.OdinInspector;
|
|
|
+using DG.Tweening;
|
|
|
|
|
|
|
|
|
//各个状态
|
|
|
@@ -47,8 +48,13 @@ public class AttributeStatus : MonoBehaviour
|
|
|
private Character landingDamageFrom;
|
|
|
private Vector3 startFlyPos;
|
|
|
[TabGroup("击飞击落")] [LabelText("起飞预设角度")] public float startFlyAngle = 15f;
|
|
|
- [TabGroup("击飞击落")] [LabelText("飞行预设角速度随机范围")] public Vector2 flyingRotateSpeedRange = new Vector2(15,45);
|
|
|
+ [Tooltip("x为最小值,y为最大值")]
|
|
|
+ [TabGroup("击飞击落")] [LabelText("飞行预设角速度随机范围")] public Vector2 flyingRotateSpeedRange = new Vector2(15,45);
|
|
|
private float flyingRotateSpeed;
|
|
|
+ private Vector3 scale;
|
|
|
+ [TabGroup("击飞击落")] [LabelText("压缩程度")] public float compressionDegree = 0.8f;
|
|
|
+ [Tooltip("x为向下压缩经过的时间,y为回弹经过的时间")]
|
|
|
+ [TabGroup("击飞击落")] [LabelText("压缩速度")] public Vector2 compressionSpeed =new Vector2(0.2f,1f);
|
|
|
|
|
|
[TabGroup("易伤")]
|
|
|
[DisplayOnly] public bool haveVulnerable;
|
|
|
@@ -90,6 +96,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
rb = character.rb;
|
|
|
foot = character.foot;
|
|
|
hitFeedbackSystem = GetComponent<HitFeedbackSystem>();
|
|
|
+ scale = character.mecanim.transform.localScale;
|
|
|
}
|
|
|
|
|
|
public void Update()
|
|
|
@@ -304,6 +311,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
character.bodyCollider.layer = character.gameObject.layer;
|
|
|
rb.velocity = Vector3.zero;
|
|
|
character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, character.platformRotZ);
|
|
|
+ character.mecanim.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
|
hitState = 1;
|
|
|
int landingDamage;
|
|
|
if (specialState == SpecialState.BlownUp)
|
|
|
@@ -325,6 +333,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
character.BeHit(attackInfo, landingDamageFrom,landingDamage);
|
|
|
}
|
|
|
}
|
|
|
+ BounceEffect();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -337,7 +346,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
vel.x += decelerationRatioX * Time.deltaTime;
|
|
|
}
|
|
|
vel.y -= decelerationRatioY * Time.deltaTime;
|
|
|
- rb.transform.Rotate(0,0, flyingRotateSpeed*Time.deltaTime);
|
|
|
+ character.mecanim.transform.Rotate(0,0, flyingRotateSpeed*Time.deltaTime);
|
|
|
isFly = true;
|
|
|
}
|
|
|
rb.velocity = vel;
|
|
|
@@ -373,6 +382,31 @@ public class AttributeStatus : MonoBehaviour
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ 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;
|
|
|
+
|
|
|
+ Sequence landSequence = DOTween.Sequence();
|
|
|
+ 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
|
|
|
+ // ));
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void OutSpecialState()
|
|
|
{
|
|
|
@@ -458,7 +492,8 @@ public class AttributeStatus : MonoBehaviour
|
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
|
rb.velocity = Vector3.zero;
|
|
|
rb.AddForce(vec3 * attackDir * blowUp.force * (1 - resistances.BlowUp), ForceMode.Impulse);
|
|
|
- rb.transform.rotation = Quaternion.Euler(0, 0, startFlyAngle * attackDir);
|
|
|
+ rb.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
|
+ character.mecanim.transform.rotation = Quaternion.Euler(0, 0, startFlyAngle * attackDir);
|
|
|
flyingRotateSpeed = UnityEngine.Random.Range(flyingRotateSpeedRange.x,flyingRotateSpeedRange.y) * attackDir;
|
|
|
startFlyPos = transform.position;
|
|
|
hitState = 0;
|