|
|
@@ -38,7 +38,7 @@ public enum CharacterState
|
|
|
|
|
|
public class Character : MonoBehaviour
|
|
|
{
|
|
|
- [FoldoutGroup("组件",order:-1)] public Rigidbody rb;
|
|
|
+ [FoldoutGroup("组件", order: -1)] public Rigidbody rb;
|
|
|
[FoldoutGroup("组件")] public Transform bodyTrans;
|
|
|
[FoldoutGroup("组件")] public BeSearchTrigger beSearchTrigger;
|
|
|
[FoldoutGroup("组件")] public SearchTrigger searchTrigger;
|
|
|
@@ -47,7 +47,7 @@ public class Character : MonoBehaviour
|
|
|
[FoldoutGroup("组件")] public BeHitTrigger beHitTrigger;
|
|
|
[FoldoutGroup("组件")] public AttackController attackController;
|
|
|
[FoldoutGroup("组件")] public Platform platform;
|
|
|
-
|
|
|
+
|
|
|
[Header("骨骼")]
|
|
|
public SkeletonMecanim mecanim;
|
|
|
public Skeleton skeleton;
|
|
|
@@ -55,8 +55,8 @@ public class Character : MonoBehaviour
|
|
|
public MeshRenderer meshRenderer;
|
|
|
|
|
|
[Header("动画控制器")]
|
|
|
- [FoldoutGroup("动画",order:-1)] public Animator ani;
|
|
|
-
|
|
|
+ [FoldoutGroup("动画", order: -1)] public Animator ani;
|
|
|
+
|
|
|
[Header("重要动画时间")]
|
|
|
[FoldoutGroup("动画")] public float totalDieKeepTime = 2f;
|
|
|
[FoldoutGroup("动画")] public float totalAttack_summonTime = 0.5f;
|
|
|
@@ -78,7 +78,7 @@ public class Character : MonoBehaviour
|
|
|
[Header("死亡后多久尸体消失")]
|
|
|
[HideInInspector]
|
|
|
public float dieKeepTime;
|
|
|
-
|
|
|
+
|
|
|
[Header("受击距离")]
|
|
|
public float beHitDistance;
|
|
|
[HideInInspector]
|
|
|
@@ -199,7 +199,7 @@ public class Character : MonoBehaviour
|
|
|
public virtual void ChangeState(CharacterState newState)
|
|
|
{
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public void DebugAttackFrom(string attackFrom, int damage)
|
|
|
{
|
|
|
Debug.Log(attackFrom + "对" + gameObject.name + "使用了" + damage.ToString() + "点伤害的攻击");
|
|
|
@@ -222,22 +222,22 @@ public class Character : MonoBehaviour
|
|
|
//是起手式
|
|
|
if (isBeHitBySummonAttack)
|
|
|
{
|
|
|
- injuryNum = Instantiate(injuryNumTextSummon);
|
|
|
+ injuryNum = PoolManager.Instantiate(injuryNumTextSummon);
|
|
|
injuryNum.transform.position = new Vector3(
|
|
|
- transform.position.x + injuryNumPos_summon.x + Random.Range(-injuryNumRandom_summon.x/2f, injuryNumRandom_summon.x/2f),
|
|
|
- transform.position.y + injuryNumPos_summon.y + Random.Range(-injuryNumRandom_summon.y/2f, injuryNumRandom_summon.y/2f),
|
|
|
+ transform.position.x + injuryNumPos_summon.x + Random.Range(-injuryNumRandom_summon.x / 2f, injuryNumRandom_summon.x / 2f),
|
|
|
+ transform.position.y + injuryNumPos_summon.y + Random.Range(-injuryNumRandom_summon.y / 2f, injuryNumRandom_summon.y / 2f),
|
|
|
transform.position.z);
|
|
|
}
|
|
|
//不是起手式
|
|
|
else
|
|
|
{
|
|
|
- injuryNum = Instantiate(injuryNumText);
|
|
|
+ injuryNum = PoolManager.Instantiate(injuryNumText);
|
|
|
injuryNum.transform.position = injuryNum.transform.position = new Vector3(
|
|
|
- transform.position.x + injuryNumPos_march.x + Random.Range(-injuryNumRandom_march.x/2f, injuryNumRandom_march.x/2f),
|
|
|
- transform.position.y + injuryNumPos_march.y + Random.Range(-injuryNumRandom_march.y/2f, injuryNumRandom_march.y/2f),
|
|
|
+ transform.position.x + injuryNumPos_march.x + Random.Range(-injuryNumRandom_march.x / 2f, injuryNumRandom_march.x / 2f),
|
|
|
+ transform.position.y + injuryNumPos_march.y + Random.Range(-injuryNumRandom_march.y / 2f, injuryNumRandom_march.y / 2f),
|
|
|
transform.position.z);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
TextMeshProUGUI text = injuryNum.GetComponentInChildren<TextMeshProUGUI>();
|
|
|
text.text = damage.ToString();
|
|
|
if (gameObject.CompareTag("Player"))
|
|
|
@@ -308,11 +308,9 @@ public class Character : MonoBehaviour
|
|
|
|
|
|
public void ChangeStateText(CharacterState state)
|
|
|
{
|
|
|
- if (curStateObj == null)
|
|
|
- {
|
|
|
- curStateObj = Instantiate(statePre, transform);
|
|
|
- stateText = curStateObj.GetComponentInChildren<TextMeshProUGUI>();
|
|
|
- }
|
|
|
+ curStateObj = PoolManager.Instantiate(statePre);
|
|
|
+ stateText = curStateObj.GetComponentInChildren<TextMeshProUGUI>();
|
|
|
+ curStateObj.transform.position = transform.position + Vector3.up;
|
|
|
pastWordTime += 0.5f;
|
|
|
switch (state)
|
|
|
{
|