From 22891bf59032ba88262824255a706d652031384b Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 10 Mar 2022 14:07:40 +0800 Subject: * move folder --- Assets/Scripts/Avatar/Avatar.cs | 151 ---------------------------------------- 1 file changed, 151 deletions(-) delete mode 100644 Assets/Scripts/Avatar/Avatar.cs (limited to 'Assets/Scripts/Avatar/Avatar.cs') 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; - - -/// -/// 角色,包括player和opponents -/// -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 conditions = new List(); - 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); - } - -} -- cgit v1.1-26-g67d0