summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Avatar/Avatar.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Avatar/Avatar.cs')
-rw-r--r--Assets/Scripts/Avatar/Avatar.cs151
1 files changed, 0 insertions, 151 deletions
diff --git a/Assets/Scripts/Avatar/Avatar.cs b/Assets/Scripts/Avatar/Avatar.cs
deleted file mode 100644
index 8787b942..00000000
--- a/Assets/Scripts/Avatar/Avatar.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-
-/// <summary>
-/// 角色,包括player和opponents
-/// </summary>
-public partial class Avatar : MonoBehaviour, IInteractable
-{
- public string Name;
-
- // 一个角色包括一个身体的collider和若干hitbox和hurtbox
- public PhysicsBody m_Body;
- public PhysicsBox m_BodyCollider;
- public Hitbox[] m_Hitbox;
- public Hurtbox[] m_Hurtbox;
-
- public Transform m_Hips;
-
- protected StateController m_StateController = new StateController();
-
- // 预定义的state,角色必须定义的
- protected StateBase m_StateLightHurt;
- protected StateBase m_StateMidiumHurt;
- protected StateBase m_StateHeavyHurt;
- protected StateBase m_StateGroundHurt;
- protected StateBase m_StateAirHurt;
-
- public PhysicsBody Body
- {
- get
- {
- return m_Body;
- }
- }
-
- public PhysicsPrimitive[] GetAllPrimitive()
- {
- throw new System.NotImplementedException();
- }
-
- protected void Init()
- {
- AvatarManager.Instance.AddAvatar(this);
- }
-
- public PhysicsBox GetHitbox()
- {
- throw new System.NotImplementedException();
- }
-
- public PhysicsBox GetHurtbox()
- {
- throw new System.NotImplementedException();
- }
-
- public PhysicsPrimitive[] GetAllHit()
- {
- throw new System.NotImplementedException();
- }
-
- public bool IsHit()
- {
- for (int i = 0; i < m_Hitbox.Length; ++i)
- {
- if (PhysicsWorld.Instance.HasCollision(m_Hitbox[i].Collider))
- {
- return true;
- }
- }
- return false;
- }
-
- public bool IsHurt()
- {
- for (int i = 0; i < m_Hitbox.Length; ++i)
- {
- if (PhysicsWorld.Instance.HasCollision(m_Hurtbox[i].Collider))
- {
- return true;
- }
- }
- return false;
- }
-
- public void OnUpdate()
- {
- m_StateController.OnUpdate();
- }
-
- // 在物理模拟之后调用
- public void OnPhysicsUpdate()
- {
- m_StateController.OnPhysicsUpdate();
- }
-
- public virtual Vector3 GetEffectPosition()
- {
- return Vector3.zero;
- }
-
- // 获得当前击打如果有的话
- public Hit GetHit()
- {
- return m_StateController.GetHit();
- }
-
- public virtual void OnHit(HitInfo hitInfo)
- {
- //Debug.Log("Hit");
- m_StateController.OnHit(hitInfo);
- }
-
- public virtual void OnHurt(HurtInfo hurtInfo)
- {
- //Debug.Log("Hurt");
- HitDefination hitDef = hurtInfo.hitDef;
- if (hitDef != null)
- ApplyHit(hitDef);
- m_StateController.OnHurt(hurtInfo);
- }
-
-
- protected ConditionBase Not(ConditionBase cond)
- {
- return new ConditionNot(cond);
- }
-
- protected ConditionBase And(ConditionBase c1, ConditionBase c2)
- {
- return new ConditionAnd(c1, c2);
- }
-
- protected ConditionBase Ands(params ConditionBase[] cond)
- {
- List<ConditionBase> conditions = new List<ConditionBase>();
- for (int i = 0; i < cond.Length; ++i)
- {
- conditions.Add(cond[i]);
- }
- ConditionMultiAnd and = new ConditionMultiAnd(conditions);
- return and;
- }
-
- protected ConditionBase Or(ConditionBase c1, ConditionBase c2)
- {
- return new ConditionOr(c1, c2);
- }
-
-}