|
|
@@ -1,7 +1,7 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
-
|
|
|
+using System;
|
|
|
|
|
|
|
|
|
public class AttributeStatus : MonoBehaviour
|
|
|
@@ -26,10 +26,25 @@ public class AttributeStatus : MonoBehaviour
|
|
|
[Header("各状态时间")]
|
|
|
[DisplayOnly] public float strikeStunTime;
|
|
|
|
|
|
- [Header("被击飞")]
|
|
|
+ [Header("被击飞阻力")]
|
|
|
public float decelerationRatioX = 2f;
|
|
|
public float decelerationRatioY = 15f;
|
|
|
|
|
|
+ //抗性
|
|
|
+ [Serializable]
|
|
|
+ public struct Resistances
|
|
|
+ {
|
|
|
+ [Range(0,1)]
|
|
|
+ public float BlowUp;
|
|
|
+ [Range(0,1)]
|
|
|
+ public float ShotDown;
|
|
|
+ [Range(0,1)]
|
|
|
+ public float Stun;
|
|
|
+ }
|
|
|
+
|
|
|
+ [Header("抗性")]
|
|
|
+ public Resistances resistances;
|
|
|
+
|
|
|
private void Awake()
|
|
|
{
|
|
|
character = GetComponent<MoveCharacter>();
|
|
|
@@ -137,13 +152,13 @@ public class AttributeStatus : MonoBehaviour
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- strikeStunTime = blowUp.time;
|
|
|
+ strikeStunTime = blowUp.time * (1 - resistances.BlowUp);
|
|
|
Vector3 vec3 = blowUp.dir.normalized;
|
|
|
if(dir < 0)
|
|
|
{
|
|
|
vec3.x = -vec3.x;
|
|
|
}
|
|
|
- rb.velocity = vec3 * blowUp.force;
|
|
|
+ rb.velocity = vec3 * blowUp.force * (1 - resistances.BlowUp);
|
|
|
curSpecialStates[0] = SpecialState.BlownUp;
|
|
|
character.ChangeState(CharacterState.SpecialStatus);
|
|
|
}
|
|
|
@@ -158,13 +173,13 @@ public class AttributeStatus : MonoBehaviour
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- strikeStunTime = shotDown.time;
|
|
|
+ strikeStunTime = shotDown.time * (1 - resistances.ShotDown);
|
|
|
Vector3 vec3 = shotDown.dir.normalized;
|
|
|
if (dir < 0)
|
|
|
{
|
|
|
vec3.x = -vec3.x;
|
|
|
}
|
|
|
- rb.velocity = vec3 * shotDown.force;
|
|
|
+ rb.velocity = vec3 * shotDown.force * (1 - resistances.ShotDown);
|
|
|
curSpecialStates[0] = SpecialState.ShotDown;
|
|
|
rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
|
|
|
rb.useGravity = true;
|
|
|
@@ -179,7 +194,7 @@ public class AttributeStatus : MonoBehaviour
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- strikeStunTime = stun.time;
|
|
|
+ strikeStunTime = stun.time * (1 - resistances.Stun);
|
|
|
curSpecialStates[0] = SpecialState.Stun;
|
|
|
character.ChangeState(CharacterState.SpecialStatus);
|
|
|
}
|