|
@@ -1,20 +1,20 @@
|
|
|
using System.Collections;
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
|
|
+using Sirenix.OdinInspector;
|
|
|
|
|
|
|
|
public class HitFeedbackSystem : MonoBehaviour
|
|
public class HitFeedbackSystem : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
//组件
|
|
//组件
|
|
|
private Character character;
|
|
private Character character;
|
|
|
|
|
|
|
|
- //顿帧
|
|
|
|
|
- public int freezeFrame;
|
|
|
|
|
- [HideInInspector]
|
|
|
|
|
- public bool isFreeze;
|
|
|
|
|
|
|
+ [TabGroup("顿帧")] public int freezeFrame;
|
|
|
|
|
+ [TabGroup("顿帧")] [DisplayOnly] public bool isFreeze;
|
|
|
private RigidbodyConstraints origRC;
|
|
private RigidbodyConstraints origRC;
|
|
|
|
|
|
|
|
- public float hitStunTime;
|
|
|
|
|
|
|
+ [TabGroup("僵直")] [DisplayOnly] public float hitStunTime;
|
|
|
|
|
|
|
|
|
|
+ private CharacterState characterState; //僵直前状态
|
|
|
|
|
|
|
|
private void Awake()
|
|
private void Awake()
|
|
|
{
|
|
{
|
|
@@ -44,25 +44,36 @@ public class HitFeedbackSystem : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void HitStunUpdate()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (hitStunTime <= 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ character.ChangeState(characterState);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ character.rb.velocity = Vector3.zero;
|
|
|
|
|
+ hitStunTime -= Time.deltaTime;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//顿帧
|
|
//顿帧
|
|
|
- public void FreezeFrame(int frame)
|
|
|
|
|
|
|
+ public void FreezeFrame()
|
|
|
{
|
|
{
|
|
|
if (!isFreeze)
|
|
if (!isFreeze)
|
|
|
{
|
|
{
|
|
|
origRC = character.rb.constraints;
|
|
origRC = character.rb.constraints;
|
|
|
}
|
|
}
|
|
|
isFreeze = true;
|
|
isFreeze = true;
|
|
|
- freezeFrame = frame;
|
|
|
|
|
character.ani.speed = 0;
|
|
character.ani.speed = 0;
|
|
|
character.rb.constraints = RigidbodyConstraints.FreezeAll;
|
|
character.rb.constraints = RigidbodyConstraints.FreezeAll;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //受到击晕
|
|
|
|
|
- public void EnterHitStun(float time)
|
|
|
|
|
|
|
+ //僵直
|
|
|
|
|
+ public void EnterHitStun()
|
|
|
{
|
|
{
|
|
|
- //attributeTime = weak.time * (1 - resistances.Weak);
|
|
|
|
|
- //curSpecialStates = SpecialState.Weak;
|
|
|
|
|
- //character.ani.Play("weak", 0, 0);
|
|
|
|
|
- //character.ChangeState(CharacterState.SpecialStatus_Weak);
|
|
|
|
|
|
|
+ character.ani.Play("weak", 0, 0);
|
|
|
|
|
+ characterState = character.state;
|
|
|
|
|
+ character.ChangeState(CharacterState.HitStun);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|