修正玩家状态机

This commit is contained in:
DESKTOP-DDTRVOR\asus 2024-12-23 17:17:43 +08:00
parent f62f8276ff
commit 336c1eb71b

View File

@ -286,6 +286,17 @@ public class BattleManager : MonoBehaviour
exp = 0; exp = 0;
expLevel = 1; expLevel = 1;
maxExp = JsonTab.Instance.tables.ExpRogue.Get(expLevel).Developexp; maxExp = JsonTab.Instance.tables.ExpRogue.Get(expLevel).Developexp;
if (playerItems!=null)
{
foreach (var p in playerItems)
{
if (p.player!=null)
{
PrefabPool.ins.RecycleObj(p.player.gameObject);
p.player = null;
}
}
}
playerItems = new PlayerRunState[playerParent.Length]; playerItems = new PlayerRunState[playerParent.Length];
for (int i = 0; i < playerParent.Length; i++) for (int i = 0; i < playerParent.Length; i++)
{ {
@ -301,7 +312,6 @@ public class BattleManager : MonoBehaviour
playerItems[idex].equipent = BattleEquipments[idex]; playerItems[idex].equipent = BattleEquipments[idex];
playerItems[idex].RestState(); playerItems[idex].RestState();
playerItems[idex].player.SetModel(idex+1); playerItems[idex].player.SetModel(idex+1);
}); });
} }
} }
@ -469,6 +479,16 @@ public class BattleManager : MonoBehaviour
{ {
if (!player) if (!player)
{ {
if (playerItems!=null)
{
foreach (var player in playerItems)
{
if (player!=null)
{
player.player.Type = playerAniType.wait;
}
}
}
return; return;
} }
nowTime += Time.deltaTime; nowTime += Time.deltaTime;
@ -486,9 +506,17 @@ public class BattleManager : MonoBehaviour
{ {
foreach (var player in playerItems) foreach (var player in playerItems)
{ {
if (player!=null&& MousterCount>0) if (player!=null)
{
if (MousterCount>0)
{ {
player.RunTimeMove(); player.RunTimeMove();
player.player.Type = playerAniType.play;
}
else
{
player.player.Type = playerAniType.wait;
}
} }
} }
} }