|
@@ -24,6 +24,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
|
|
|
|
|
//behit参数
|
|
//behit参数
|
|
|
[DisplayOnly] public SpecialState curSpecialStates = SpecialState.Null;
|
|
[DisplayOnly] public SpecialState curSpecialStates = SpecialState.Null;
|
|
|
|
|
+ public AttackInfo attackInfo;
|
|
|
|
|
|
|
|
[LabelText("控制时间")] [DisplayOnly] public float attributeTime;
|
|
[LabelText("控制时间")] [DisplayOnly] public float attributeTime;
|
|
|
|
|
|
|
@@ -43,11 +44,8 @@ public class AttributeStatus : MonoBehaviour
|
|
|
[TabGroup("击飞击落")] [DisplayOnly] public bool isFly;
|
|
[TabGroup("击飞击落")] [DisplayOnly] public bool isFly;
|
|
|
[TabGroup("击飞击落")] [LabelText("X方向阻力")] public float decelerationRatioX = 2f;
|
|
[TabGroup("击飞击落")] [LabelText("X方向阻力")] public float decelerationRatioX = 2f;
|
|
|
[TabGroup("击飞击落")] [LabelText("Y方向阻力")] public float decelerationRatioY = 15f;
|
|
[TabGroup("击飞击落")] [LabelText("Y方向阻力")] public float decelerationRatioY = 15f;
|
|
|
- private bool haveLandingDamage;
|
|
|
|
|
- private int landingDamage;
|
|
|
|
|
private Character landingDamageFrom;
|
|
private Character landingDamageFrom;
|
|
|
private Vector3 startFlyPos;
|
|
private Vector3 startFlyPos;
|
|
|
- private float landingDamageRate;
|
|
|
|
|
|
|
|
|
|
[TabGroup("易伤")]
|
|
[TabGroup("易伤")]
|
|
|
[DisplayOnly] public bool haveVulnerable;
|
|
[DisplayOnly] public bool haveVulnerable;
|
|
@@ -169,11 +167,11 @@ public class AttributeStatus : MonoBehaviour
|
|
|
/*控制*/
|
|
/*控制*/
|
|
|
//漂浮
|
|
//漂浮
|
|
|
case AttackEffect.FloatState:
|
|
case AttackEffect.FloatState:
|
|
|
- AddFloat(attackInfo.floatState);
|
|
|
|
|
|
|
+ AddFloat(attackInfo);
|
|
|
break;
|
|
break;
|
|
|
//击飞
|
|
//击飞
|
|
|
case AttackEffect.BlowUp:
|
|
case AttackEffect.BlowUp:
|
|
|
- AddBlowUp(attackInfo.blowUp, attackFrom.bodyTrans);
|
|
|
|
|
|
|
+ AddBlowUp(attackInfo, attackFrom.bodyTrans);
|
|
|
character.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
|
|
character.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
|
|
|
if (attackInfo.blowUp.haveLandingDamage)
|
|
if (attackInfo.blowUp.haveLandingDamage)
|
|
|
{
|
|
{
|
|
@@ -182,7 +180,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
break;
|
|
break;
|
|
|
//击落
|
|
//击落
|
|
|
case AttackEffect.ShotDown:
|
|
case AttackEffect.ShotDown:
|
|
|
- AddShotDown(attackInfo.shotDown, attackFrom.bodyTrans);
|
|
|
|
|
|
|
+ AddShotDown(attackInfo, attackFrom.bodyTrans);
|
|
|
character.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
|
|
character.bodyCollider.layer = LayerMask.NameToLayer("BodyToPlatformCollider");
|
|
|
if (attackInfo.shotDown.haveLandingDamage)
|
|
if (attackInfo.shotDown.haveLandingDamage)
|
|
|
{
|
|
{
|
|
@@ -191,7 +189,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
break;
|
|
break;
|
|
|
//击晕
|
|
//击晕
|
|
|
case AttackEffect.Weak:
|
|
case AttackEffect.Weak:
|
|
|
- AddWeak(attackInfo.weak);
|
|
|
|
|
|
|
+ AddWeak(attackInfo);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
return;
|
|
return;
|
|
@@ -289,13 +287,25 @@ public class AttributeStatus : MonoBehaviour
|
|
|
rb.velocity = Vector3.zero;
|
|
rb.velocity = Vector3.zero;
|
|
|
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);
|
|
|
hitState = 1;
|
|
hitState = 1;
|
|
|
- if (haveLandingDamage)
|
|
|
|
|
|
|
+ int landingDamage;
|
|
|
|
|
+ if (specialState == SpecialState.BlownUp)
|
|
|
{
|
|
{
|
|
|
- if(specialState == SpecialState.BlownUp)
|
|
|
|
|
|
|
+ if (attackInfo.blowUp.haveLandingDamage)
|
|
|
{
|
|
{
|
|
|
- landingDamage = (int)(Mathf.Abs(transform.position.x - startFlyPos.x) * landingDamageRate);
|
|
|
|
|
|
|
+ landingDamage = (int)(Mathf.Abs(transform.position.x - startFlyPos.x) * attackInfo.blowUp.landingDamageRate);
|
|
|
|
|
+ if (landingDamage > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ character.BeHit(attackInfo, landingDamageFrom, landingDamage);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (attackInfo.shotDown.haveLandingDamage)
|
|
|
|
|
+ {
|
|
|
|
|
+ landingDamage = attackInfo.shotDown.landingDamage;
|
|
|
|
|
+ character.BeHit(attackInfo, landingDamageFrom,landingDamage);
|
|
|
}
|
|
}
|
|
|
- character.BeHit(landingDamage, landingDamageFrom);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -345,7 +355,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
rb.useGravity = false;
|
|
rb.useGravity = false;
|
|
|
}
|
|
}
|
|
|
- haveLandingDamage = false;
|
|
|
|
|
|
|
+
|
|
|
character.ChangeState(CharacterState.Idle);
|
|
character.ChangeState(CharacterState.Idle);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -381,8 +391,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//受到漂浮
|
|
//受到漂浮
|
|
|
- public void AddFloat(AttackInfo.FloatState floatState)
|
|
|
|
|
|
|
+ public void AddFloat(AttackInfo attackInfo)
|
|
|
{
|
|
{
|
|
|
|
|
+ this.attackInfo = attackInfo;
|
|
|
|
|
+ AttackInfo.FloatState floatState = attackInfo.floatState;
|
|
|
rb.useGravity = false;
|
|
rb.useGravity = false;
|
|
|
floatingState = 1;
|
|
floatingState = 1;
|
|
|
origPos = character.transform.position;
|
|
origPos = character.transform.position;
|
|
@@ -402,8 +414,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//受到击飞
|
|
//受到击飞
|
|
|
- public void AddBlowUp(AttackInfo.BlowUp blowUp, Transform attackFrom)
|
|
|
|
|
|
|
+ public void AddBlowUp(AttackInfo attackInfo, Transform attackFrom)
|
|
|
{
|
|
{
|
|
|
|
|
+ this.attackInfo = attackInfo;
|
|
|
|
|
+ AttackInfo.BlowUp blowUp = attackInfo.blowUp;
|
|
|
attributeTime = blowUp.time * (1 - resistances.BlowUp);
|
|
attributeTime = blowUp.time * (1 - resistances.BlowUp);
|
|
|
Vector3 vec3 = blowUp.dir.normalized;
|
|
Vector3 vec3 = blowUp.dir.normalized;
|
|
|
int attackDir = 0;
|
|
int attackDir = 0;
|
|
@@ -428,17 +442,17 @@ public class AttributeStatus : MonoBehaviour
|
|
|
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);
|
|
|
- haveLandingDamage = blowUp.haveLandingDamage;
|
|
|
|
|
startFlyPos = transform.position;
|
|
startFlyPos = transform.position;
|
|
|
- landingDamageRate = blowUp.landingDamageRate;
|
|
|
|
|
hitState = 0;
|
|
hitState = 0;
|
|
|
isFly = false;
|
|
isFly = false;
|
|
|
character.ani.Play("hitted", 0, 0);
|
|
character.ani.Play("hitted", 0, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//受到击落
|
|
//受到击落
|
|
|
- public void AddShotDown(AttackInfo.ShotDown shotDown, Transform attackFrom)
|
|
|
|
|
|
|
+ public void AddShotDown(AttackInfo attackInfo, Transform attackFrom)
|
|
|
{
|
|
{
|
|
|
|
|
+ this.attackInfo = attackInfo;
|
|
|
|
|
+ AttackInfo.ShotDown shotDown = attackInfo.shotDown;
|
|
|
attributeTime = shotDown.time * (1 - resistances.ShotDown);
|
|
attributeTime = shotDown.time * (1 - resistances.ShotDown);
|
|
|
Vector3 vec3 = shotDown.dir.normalized;
|
|
Vector3 vec3 = shotDown.dir.normalized;
|
|
|
int attackDir = 0;
|
|
int attackDir = 0;
|
|
@@ -461,8 +475,6 @@ public class AttributeStatus : MonoBehaviour
|
|
|
rb.AddForce(vec3 * shotDown.force * (1 - resistances.ShotDown), ForceMode.Impulse);
|
|
rb.AddForce(vec3 * shotDown.force * (1 - resistances.ShotDown), ForceMode.Impulse);
|
|
|
rb.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
rb.transform.rotation = Quaternion.Euler(0, 0, 0);
|
|
|
character.ani.Play("hitted", 0, 0);
|
|
character.ani.Play("hitted", 0, 0);
|
|
|
- haveLandingDamage = shotDown.haveLandingDamage;
|
|
|
|
|
- landingDamage = shotDown.landingDamage;
|
|
|
|
|
character.nowCanFly = false;
|
|
character.nowCanFly = false;
|
|
|
|
|
|
|
|
hitState = 0;
|
|
hitState = 0;
|
|
@@ -472,8 +484,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//受到击晕
|
|
//受到击晕
|
|
|
- public void AddWeak(AttackInfo.Weak weak)
|
|
|
|
|
|
|
+ public void AddWeak(AttackInfo attackInfo)
|
|
|
{
|
|
{
|
|
|
|
|
+ this.attackInfo = attackInfo;
|
|
|
|
|
+ AttackInfo.Weak weak = attackInfo.weak;
|
|
|
attributeTime = weak.time * (1 - resistances.Weak);
|
|
attributeTime = weak.time * (1 - resistances.Weak);
|
|
|
character.ani.Play("weak", 0, 0);
|
|
character.ani.Play("weak", 0, 0);
|
|
|
character.ChangeState(CharacterState.SpecialStatus_Weak);
|
|
character.ChangeState(CharacterState.SpecialStatus_Weak);
|
|
@@ -481,8 +495,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//受到穿甲
|
|
//受到穿甲
|
|
|
- public int AddArmorPiercing(AttackInfo.ArmorPiercing armor, int damage)
|
|
|
|
|
|
|
+ public int AddArmorPiercing(AttackInfo attackInfo)
|
|
|
{
|
|
{
|
|
|
|
|
+ this.attackInfo = attackInfo;
|
|
|
|
|
+ AttackInfo.ArmorPiercing armor = attackInfo.armorPiercing;
|
|
|
//计算护甲减免
|
|
//计算护甲减免
|
|
|
int am = resistances.armor;
|
|
int am = resistances.armor;
|
|
|
if (am > 0)
|
|
if (am > 0)
|
|
@@ -497,8 +513,10 @@ public class AttributeStatus : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//受到易伤
|
|
//受到易伤
|
|
|
- public void AddVulnerable(AttackInfo.Vulnerable vulnerable)
|
|
|
|
|
|
|
+ public void AddVulnerable(AttackInfo attackInfo)
|
|
|
{
|
|
{
|
|
|
|
|
+ this.attackInfo = attackInfo;
|
|
|
|
|
+ AttackInfo.Vulnerable vulnerable = attackInfo.vulnerable;
|
|
|
vulnerableTime = vulnerable.time;
|
|
vulnerableTime = vulnerable.time;
|
|
|
vulnerableRate = vulnerable.rate;
|
|
vulnerableRate = vulnerable.rate;
|
|
|
haveVulnerable = true;
|
|
haveVulnerable = true;
|