summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Avatar/Conditions
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Avatar/Conditions')
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs26
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs21
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionBase.cs196
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCombo.cs14
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCommand.cs22
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs54
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionInair.cs21
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs31
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs28
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs16
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs19
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs18
-rw-r--r--Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/Interactive.meta8
-rw-r--r--Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs21
-rw-r--r--Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta11
-rw-r--r--Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs20
-rw-r--r--Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta11
49 files changed, 959 insertions, 0 deletions
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs b/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs
new file mode 100644
index 00000000..b55cacb8
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs
@@ -0,0 +1,26 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 记录之前的ability序列满足某个序列
+/// combo的时候根据当前序列决定combo
+/// </summary>
+public class ConditionAbilitySeq : ConditionBase
+{
+ List<int> m_TargetAbilitySeq = new List<int>();
+
+ public ConditionAbilitySeq(List<int> commandSeq)
+ : base()
+ {
+ m_TargetAbilitySeq = commandSeq;
+ }
+
+ public override bool Evaluate()
+ {
+ // 验证记录的abilitySeq是否满足
+
+
+ throw new System.NotImplementedException();
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta
new file mode 100644
index 00000000..5070f1cc
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionAbilitySeq.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7bbf0480c45c29843b8ba41229bb29b1
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs b/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs
new file mode 100644
index 00000000..a3944600
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs
@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionAttkExpireTime : ConditionBase
+{
+ AttackAbility m_Ability;
+ float m_ExpireTime;
+
+ public ConditionAttkExpireTime(AttackAbility attack, float expireTime)
+ {
+ m_Ability = attack;
+ m_ExpireTime = expireTime;
+ }
+
+ public override bool Evaluate()
+ {
+ return m_Ability.ExpireTime > m_ExpireTime;
+ }
+}
+
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta
new file mode 100644
index 00000000..80b4d7a7
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionAttkExpireTime.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 385e621dcc66179459c6f2a2b3b81319
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionBase.cs b/Assets/Scripts/Avatar/Conditions/ConditionBase.cs
new file mode 100644
index 00000000..8dff29da
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionBase.cs
@@ -0,0 +1,196 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 触发条件基类
+/// </summary>
+public abstract class ConditionBase
+{
+
+ public ConditionBase()
+ {
+ }
+
+ public abstract bool Evaluate();
+
+}
+
+/// <summary>
+/// 两个condition都达成才会返回真
+/// </summary>
+public sealed class ConditionNot : ConditionBase
+{
+ ConditionBase m_Condition;
+
+
+ public ConditionNot(ConditionBase cond)
+ : base()
+ {
+ m_Condition = cond;
+ }
+
+ public override bool Evaluate()
+ {
+ return !m_Condition.Evaluate();
+ }
+}
+
+/// <summary>
+/// 总是满足
+/// </summary>
+public sealed class ConditionAlways : ConditionBase
+{
+ public override bool Evaluate()
+ {
+ return true;
+ }
+}
+
+/// <summary>
+/// 总是不满足
+/// </summary>
+public sealed class ConditionAlwaysNot : ConditionBase
+{
+ public override bool Evaluate()
+ {
+ return false;
+ }
+}
+
+/// <summary>
+/// 两个condition都达成才会返回真
+/// </summary>
+public sealed class ConditionAnd : ConditionBase
+{
+ ConditionBase m_FirstCondition, m_LastCondition;
+
+
+ public ConditionAnd(ConditionBase first, ConditionBase last)
+ : base()
+ {
+ m_FirstCondition = first;
+ m_LastCondition = last;
+ }
+
+ public override bool Evaluate()
+ {
+ return m_FirstCondition.Evaluate() && m_LastCondition.Evaluate();
+ }
+}
+
+/// <summary>
+/// 两个condition至少一个达成才会返回真
+/// </summary>
+public sealed class ConditionOr : ConditionBase
+{
+ ConditionBase m_FirstCondition, m_LastCondition;
+
+
+ public ConditionOr(ConditionBase first, ConditionBase last)
+ : base()
+ {
+ m_FirstCondition = first;
+ m_LastCondition = last;
+ }
+
+ public override bool Evaluate()
+ {
+ return m_FirstCondition.Evaluate() || m_LastCondition.Evaluate();
+ }
+}
+
+
+/// <summary>
+/// 两个condition都不达成才会返回真
+/// </summary>
+public sealed class ConditionNone : ConditionBase
+{
+ ConditionBase m_FirstCondition, m_LastCondition;
+
+ public ConditionNone(ConditionBase first, ConditionBase last)
+ : base()
+ {
+ m_FirstCondition = first;
+ m_LastCondition = last;
+ }
+
+ public override bool Evaluate()
+ {
+ return !m_FirstCondition.Evaluate() && !m_LastCondition.Evaluate();
+ }
+}
+
+
+/// <summary>
+/// 多个condition都达成才会返回真
+/// </summary>
+public sealed class ConditionMultiAnd : ConditionBase
+{
+ List<ConditionBase> m_Conditions = new List<ConditionBase>();
+
+ public ConditionMultiAnd(List<ConditionBase> conditions)
+ : base()
+ {
+ m_Conditions.AddRange(conditions);
+ }
+
+ public override bool Evaluate()
+ {
+ foreach(var condition in m_Conditions)
+ {
+ if(!condition.Evaluate())
+ return false;
+ }
+ return true;
+ }
+}
+
+/// <summary>
+/// 多个condition至少一个达成才会返回真
+/// </summary>
+public sealed class ConditionMultiOr : ConditionBase
+{
+ List<ConditionBase> m_Conditions;
+
+ public ConditionMultiOr(List<ConditionBase> conditions)
+ : base()
+ {
+ m_Conditions.AddRange(conditions);
+ }
+
+ public override bool Evaluate()
+ {
+ foreach (var condition in m_Conditions)
+ {
+ if (condition.Evaluate())
+ return true;
+ }
+ return false;
+ }
+}
+
+/// <summary>
+/// 多个condition都不达成才会返回真
+/// </summary>
+public sealed class ConditionMultiNone : ConditionBase
+{
+ List<ConditionBase> m_Conditions;
+
+ public ConditionMultiNone(List<ConditionBase> conditions)
+ : base()
+ {
+ m_Conditions.AddRange(conditions);
+ }
+
+ public override bool Evaluate()
+ {
+ foreach (var condition in m_Conditions)
+ {
+ if (condition.Evaluate())
+ return false;
+ }
+ return true;
+ }
+}
+
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta
new file mode 100644
index 00000000..4c321ffd
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionBase.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 21029775aaf8cdd4a868a45725313c3a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs
new file mode 100644
index 00000000..52abad03
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionButtonHold : ConditionBase
+{
+ GamepadButton m_Button;
+
+ public ConditionButtonHold(GamepadButton button)
+ {
+ m_Button = button;
+ }
+
+ public override bool Evaluate()
+ {
+ return InputManager.Instance.IsButtonHold(m_Button);
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta
new file mode 100644
index 00000000..82d350e2
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionButtonHold.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2b0cd6f63cbe32649a15ab38d5bb6ee3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs b/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs
new file mode 100644
index 00000000..ec4e489c
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionCheckHp : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta
new file mode 100644
index 00000000..e5b205b2
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCheckHp.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e4b80b2be76ae9149af7b8a57f1e68ef
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs b/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs
new file mode 100644
index 00000000..c14bff3c
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionCheckMp : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta
new file mode 100644
index 00000000..d920a18f
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCheckMp.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a603843f7ac083c45ba5b2ec23d4cc0b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs b/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs
new file mode 100644
index 00000000..1b6159cb
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs
@@ -0,0 +1,14 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 连击操作,综合ConditionMotionRange和ConditionCommand
+/// </summary>
+public class ConditionCombo : ConditionBase
+{
+ public override bool Evaluate()
+ {
+ throw new System.NotImplementedException();
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta
new file mode 100644
index 00000000..45582943
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCombo.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 015528a2fbc923f45b1e25c11a6ade2b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs
new file mode 100644
index 00000000..d735ef5b
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs
@@ -0,0 +1,22 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 按下某个command
+/// </summary>
+public class ConditionCommand : ConditionBase
+{
+ GamepadButton m_TargetCommand;
+
+ public ConditionCommand(GamepadButton command)
+ {
+ m_TargetCommand = command;
+ }
+
+ public override bool Evaluate()
+ {
+ return InputManager.Instance.CurrentCommand.code == m_TargetCommand;
+ }
+
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta
new file mode 100644
index 00000000..100638e6
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCommand.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6334908b568b7c046bbeb3f526f95841
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs
new file mode 100644
index 00000000..71a7dbf3
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs
@@ -0,0 +1,54 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 一个command序列,用来触发连击
+/// </summary>
+public class ConditionCommandSeq : ConditionBase
+{
+ List<GamepadButton> m_CommandSeq = new List<GamepadButton>();
+ float m_DeltaTime = 0;
+ List<int> m_LastCmdID = new List<int>();
+
+ List<int> id = new List<int>();
+
+ public ConditionCommandSeq(List<GamepadButton> commandSeq, float maxDeltaTime)
+ {
+ m_CommandSeq.AddRange(commandSeq);
+ m_DeltaTime = maxDeltaTime;
+ }
+
+ public override bool Evaluate()
+ {
+ List<Command> commandRecord = InputManager.Instance.CommandRecord;
+ if (commandRecord == null || commandRecord.Count < m_CommandSeq.Count)
+ return false;
+ id.Clear();
+ for (int i = 1; i < m_CommandSeq.Count; ++i)
+ {
+ GamepadButton button = m_CommandSeq[i];
+ GamepadButton preButton = m_CommandSeq[i-1];
+ int j = commandRecord.Count - m_CommandSeq.Count + i;
+ Command cmd = commandRecord[j];
+ Command preCmd = commandRecord[j-1];
+ if (preCmd.code != preButton || cmd.code != button)
+ return false;
+ if (cmd.time - preCmd.time > m_DeltaTime)
+ return false;
+ id.Add(preCmd.id);
+ if (j == commandRecord.Count - 1)
+ id.Add(cmd.id);
+ }
+
+ //for (int i = 0; i < id.Count; ++i)
+ //{
+ // if (m_LastCmdID.Contains(id[i]))
+ // return false;
+ //}
+ //m_LastCmdID.Clear();
+ //m_LastCmdID.AddRange(id);
+
+ return true;
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta
new file mode 100644
index 00000000..fc77bd3c
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionCommandSeq.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7316354e3f99412419c866e0fc3906c6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs
new file mode 100644
index 00000000..2c631970
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs
@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 某个角色是否浮空
+/// </summary>
+public class ConditionInAir : ConditionBase
+{
+ PhysicsPrimitive m_Prim;
+
+ public ConditionInAir(PhysicsPrimitive prim)
+ {
+ m_Prim = prim;
+ }
+
+ public override bool Evaluate()
+ {
+ return m_Prim.Bound.w > PhysicsWorld.Ground;
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta
new file mode 100644
index 00000000..8bbf610f
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionInair.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8855eebdb67a2cc4baeb2a21e5b40ed4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs b/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs
new file mode 100644
index 00000000..8d900348
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionJumpDone : ConditionBase
+{
+ JumpAbility m_Jump;
+
+ public ConditionJumpDone(JumpAbility jump)
+ {
+ m_Jump = jump;
+ }
+
+ public override bool Evaluate()
+ {
+ return m_Jump.IsJumpDone();
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta
new file mode 100644
index 00000000..34a9de96
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionJumpDone.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 734f6d264357f2c43b13f8203f7ecd41
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs b/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs
new file mode 100644
index 00000000..47f74cab
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionJumpOnGround : ConditionBase
+{
+ JumpAbility m_Jump;
+
+ public ConditionJumpOnGround(JumpAbility jump)
+ {
+ m_Jump = jump;
+ }
+
+ public override bool Evaluate()
+ {
+ return m_Jump.IsJumpGround();
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta
new file mode 100644
index 00000000..33f0341b
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionJumpOnGround.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1a04452218ec0b849bbed3d0ba35cd12
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs b/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs
new file mode 100644
index 00000000..a6bd96c0
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionJumpReady : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta
new file mode 100644
index 00000000..d947e116
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionJumpReady.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 300b4929ffe151c43bfce427115a05a9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs b/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs
new file mode 100644
index 00000000..18d71e86
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs
@@ -0,0 +1,31 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 动画已经播放完毕
+/// </summary>
+public class ConditionMotionAtEnd : ConditionBase
+{
+ Animator m_Animator;
+ int m_AnimationHash;
+
+ public ConditionMotionAtEnd(Animator animator, int animationHash)
+ : base()
+ {
+ m_Animator = animator;
+ m_AnimationHash = animationHash;
+ }
+
+ public override bool Evaluate()
+ {
+ AnimatorStateInfo info = m_Animator.GetCurrentAnimatorStateInfo(0);
+ if(info.shortNameHash == m_AnimationHash)
+ {
+ float t = info.normalizedTime;
+ if (t >= 0.99f)
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta
new file mode 100644
index 00000000..1688dd68
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMotionAtEnd.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f5cbdf2ebe12b5d46afa21a62609d15c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs b/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs
new file mode 100644
index 00000000..282ef929
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionAnimFrameRange : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta
new file mode 100644
index 00000000..3fc88fb1
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMotionFrameRange.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 28e7aa2c7b5a9d74b936ec5731eeec36
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs b/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs
new file mode 100644
index 00000000..c902ae26
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs
@@ -0,0 +1,28 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+/// <summary>
+/// 某个动画是否播放到了某个时间(归一化了的)范围内
+/// </summary>
+public sealed class ConditionMotionRange : ConditionBase
+{
+ Vector2 m_TimeRange = new Vector2();
+ Animator m_Animator;
+
+ public ConditionMotionRange(Animator animator, float start, float end)
+ {
+ m_Animator = animator;
+
+ m_TimeRange.Set(start, end);
+ }
+
+ public override bool Evaluate()
+ {
+ AnimatorStateInfo info = m_Animator.GetCurrentAnimatorStateInfo(0);
+ float time = info.normalizedTime;
+ bool result = time >= m_TimeRange.x && time <= m_TimeRange.y;
+ return result;
+ }
+
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta
new file mode 100644
index 00000000..926a8560
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMotionRange.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 56b6b5bfaf0d4e147a2f0f1809e7739b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs
new file mode 100644
index 00000000..1084f191
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionMoveButtonHold : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta
new file mode 100644
index 00000000..45cf47bb
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionMoveButtonHold.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 77299e998cbe9d1429c2d0b731bff6e3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs
new file mode 100644
index 00000000..06a76784
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs
@@ -0,0 +1,16 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionNoMoveButtonHold : ConditionBase
+{
+ public ConditionNoMoveButtonHold()
+ {
+ }
+
+ public override bool Evaluate()
+ {
+ bool isMoveButtonDown = InputManager.Instance.IsButtonHold(GamepadButton.Left) || InputManager.Instance.IsButtonHold(GamepadButton.Right);
+ return !isMoveButtonDown;
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta
new file mode 100644
index 00000000..db883c19
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionNoMoveButtonHold.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ce1302d58bf3a7043b6e2e25d13525d9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs b/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs
new file mode 100644
index 00000000..8db94951
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionNotHit : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta
new file mode 100644
index 00000000..7058713f
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionNotHit.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b0d86b3d8867b144f90fcedf4a6351c3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs b/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs
new file mode 100644
index 00000000..9604677a
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionNotHurt : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta
new file mode 100644
index 00000000..bbe77240
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionNotHurt.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ab089a23fff18a647856f2e33a145784
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs b/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs
new file mode 100644
index 00000000..36cbfd05
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs
@@ -0,0 +1,19 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionTowardLeft : ConditionBase
+{
+ Transform m_Obj;
+
+ public ConditionTowardLeft(Transform obj)
+ {
+ m_Obj = obj;
+ }
+
+ public override bool Evaluate()
+ {
+ return Mathf.Approximately(m_Obj.rotation.eulerAngles.y, 270f)
+ || Mathf.Approximately(m_Obj.rotation.eulerAngles.y, -90f);
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta
new file mode 100644
index 00000000..e3a399a6
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionTowardLeft.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e2f90baa8b157234f93cdb949b43cd24
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs b/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs
new file mode 100644
index 00000000..d26a1fd0
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ConditionTowardRight : ConditionBase
+{
+ Transform m_Obj;
+
+ public ConditionTowardRight(Transform obj)
+ {
+ m_Obj = obj;
+ }
+
+ public override bool Evaluate()
+ {
+ return Mathf.Approximately(m_Obj.rotation.eulerAngles.y, 90f);
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta b/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta
new file mode 100644
index 00000000..901efb57
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/ConditionTowardRight.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ab6f3e1b40a1eff4196b069e4fd25469
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive.meta b/Assets/Scripts/Avatar/Conditions/Interactive.meta
new file mode 100644
index 00000000..cf125393
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/Interactive.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 38b2530cdab57854e90007371516c2bf
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs
new file mode 100644
index 00000000..d36cc538
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs
@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// hitbox击中
+public class ConditionHit : ConditionBase
+{
+ IInteractable m_Obj;
+
+ public ConditionHit(IInteractable obj)
+ {
+ m_Obj = obj;
+
+ }
+
+ public override bool Evaluate()
+ {
+ bool isHit = m_Obj.IsHit();
+ return isHit;
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta
new file mode 100644
index 00000000..9c607983
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHit.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c354907230901bf45849e4bb93601b60
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs
new file mode 100644
index 00000000..8a76528d
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs
@@ -0,0 +1,20 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+// hurtbox被击中
+public class ConditionHurt : ConditionBase
+{
+ IInteractable m_Obj;
+
+ public ConditionHurt(IInteractable obj)
+ {
+ m_Obj = obj;
+ }
+
+ public override bool Evaluate()
+ {
+ bool isHit = m_Obj.IsHit();
+ return isHit;
+ }
+}
diff --git a/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta
new file mode 100644
index 00000000..e54feb2d
--- /dev/null
+++ b/Assets/Scripts/Avatar/Conditions/Interactive/ConditionHurt.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 62448f0af4616f64c987ac12131db584
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: