diff options
Diffstat (limited to 'Assets/Scripts/Avatar')
-rw-r--r-- | Assets/Scripts/Avatar/Avatar.cs | 2 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/Avatar_Hurt.cs | 9 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/HitDefination.cs | 13 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/StateController.cs (renamed from Assets/Scripts/Avatar/StateSystem.cs) | 0 | ||||
-rw-r--r-- | Assets/Scripts/Avatar/StateController.cs.meta (renamed from Assets/Scripts/Avatar/StateSystem.cs.meta) | 2 |
5 files changed, 23 insertions, 3 deletions
diff --git a/Assets/Scripts/Avatar/Avatar.cs b/Assets/Scripts/Avatar/Avatar.cs index 0ee7555f..8787b942 100644 --- a/Assets/Scripts/Avatar/Avatar.cs +++ b/Assets/Scripts/Avatar/Avatar.cs @@ -16,6 +16,8 @@ public partial class Avatar : MonoBehaviour, IInteractable public Hitbox[] m_Hitbox;
public Hurtbox[] m_Hurtbox;
+ public Transform m_Hips; +
protected StateController m_StateController = new StateController();
// 预定义的state,角色必须定义的
diff --git a/Assets/Scripts/Avatar/Avatar_Hurt.cs b/Assets/Scripts/Avatar/Avatar_Hurt.cs index eebc9a78..c6b840b9 100644 --- a/Assets/Scripts/Avatar/Avatar_Hurt.cs +++ b/Assets/Scripts/Avatar/Avatar_Hurt.cs @@ -24,6 +24,15 @@ public partial class Avatar : MonoBehaviour, IInteractable break;
}
+ // spark
+ if(hit.sparkName != string.Empty)
+ {
+ if(hit.sparkHostType == HitSparkHost.Center)
+ {
+ SparksManager.Instance.PlaySpark(hit.sparkName, m_Hips);
+ }
+ }
+
}
}
diff --git a/Assets/Scripts/Avatar/HitDefination.cs b/Assets/Scripts/Avatar/HitDefination.cs index db07a677..d5d68b23 100644 --- a/Assets/Scripts/Avatar/HitDefination.cs +++ b/Assets/Scripts/Avatar/HitDefination.cs @@ -14,6 +14,14 @@ public enum HitType Air, // 击飞
} +public enum HitSparkHost
+{
+ Center, // 受击者质心 + Hitpoint, // 重叠盒子中心 + Fixed, // 固定挂点sparkHost + WorldPosition, // 世界空间位置sparkRotation +} + /// <summary>
/// 一个hit的定义,如果一个attack有多个hit,需要定义多个HitDef
/// </summary> @@ -27,8 +35,9 @@ public class HitDefination // 特效
public string sparkName = string.Empty; // 特效 - public Transform sparkHost = null; // 特效挂点 - public Vector3 sparkPosition; // 特效位置(sparkHost为空时生效) + public HitSparkHost sparkHostType = HitSparkHost.Center;
+ public Transform sparkHost = null; // 特效挂点 + public Vector3 sparkPosition; // 特效位置 public Quaternion sparkRotation; // 特效旋转 public Vector3 sparkScale = Vector3.one; // 特效缩放 diff --git a/Assets/Scripts/Avatar/StateSystem.cs b/Assets/Scripts/Avatar/StateController.cs index 12ba6fe4..12ba6fe4 100644 --- a/Assets/Scripts/Avatar/StateSystem.cs +++ b/Assets/Scripts/Avatar/StateController.cs diff --git a/Assets/Scripts/Avatar/StateSystem.cs.meta b/Assets/Scripts/Avatar/StateController.cs.meta index 52e8267c..8974eb37 100644 --- a/Assets/Scripts/Avatar/StateSystem.cs.meta +++ b/Assets/Scripts/Avatar/StateController.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2cf426be55a8b8b48a1b794fa6938e94 +guid: 4dec6f0208c6e564980e1380ad151233 MonoImporter: externalObjects: {} serializedVersion: 2 |