Silly enemy, attack bug fix
This commit is contained in:
1 parent
b02e201cd0
commit
1d107924bf
567 files changed
+197825
-635242
No files matched your search
@@ -7,6 +7,7 @@ using Code.Game.OfficeGame.BattleMode;
|
||||
using Code.Game.OfficeGame.Entities;
|
||||
using Code.Infrastructure.Camera;
|
||||
using Code.OfficeGame.BattleMode.Actions;
|
||||
using Code.OfficeGame.BattleMode.Actions.AI;
|
||||
using Code.OfficeGame.BattleMode.Actions.Deciders;
|
||||
using Code.OfficeGame.BattleMode.Effects;
|
||||
using Code.OfficeGame.BattleMode.Snapshots;
|
||||
@@ -30,6 +31,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|
||||
private Dictionary<BattleActionType, BattleAction> _battleActions;
|
||||
private Dictionary<DeciderType, BattleActionDecider> _battleActionDeciders;
|
||||
private Dictionary<EnemyDeciderTypes, EnemyDecider> _enemyDeciders;
|
||||
|
||||
private Dictionary<EntityId, EntityProperties> _entities;
|
||||
private Dictionary<EntityId, BattleActionData> _battleActionDatas = new();
|
||||
@@ -49,6 +51,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
BattleTimelinePanel timelinePanel,
|
||||
IEnumerable<BattleAction> battleActions,
|
||||
IEnumerable<BattleActionDecider> battleActionDeciders,
|
||||
IEnumerable<EnemyDecider> enemyDeciders,
|
||||
BattleActionDecisionPanel battleActionDecisionPanel,
|
||||
CameraStateMachine cameraStateMachine)
|
||||
{
|
||||
@@ -64,6 +67,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
}
|
||||
|
||||
_battleActionDeciders = battleActionDeciders.ToDictionary(x => x.DeciderType);
|
||||
_enemyDeciders = enemyDeciders.ToDictionary(x=>x.EnemyDeciderType);
|
||||
}
|
||||
|
||||
public async UniTask RunBattleLoopAsync(List<EntityProperties> entities, CancellationToken ctx)
|
||||
@@ -347,9 +351,8 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|
||||
private async UniTask<(BattleActionDecisionResult, BattleActionData)> DecideAction(CancellationToken ctx,
|
||||
EntityProperties entity)
|
||||
|
||||
{
|
||||
if(entity.Team == EntityTeam.Good)
|
||||
if(entity.TeamData.Team == EntityTeam.Good)
|
||||
{
|
||||
var (decisionResult, actionData) = await DecideForPlayer(ctx, entity);
|
||||
|
||||
@@ -358,10 +361,19 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|
||||
return (decisionResult, actionData);
|
||||
}
|
||||
|
||||
if (entity.TeamData.Team == EntityTeam.ChaoticEvil)
|
||||
{
|
||||
var (enemyDecisionResult, enemyActionData) =
|
||||
await _enemyDeciders[entity.TeamData.DeciderType].DecideEnemy(ctx, entity, _battleActions);
|
||||
|
||||
|
||||
|
||||
return (null,null);
|
||||
if (enemyDecisionResult == null || enemyActionData == null)
|
||||
throw new ArgumentNullException(nameof(enemyDecisionResult));
|
||||
|
||||
return (enemyDecisionResult, enemyActionData);
|
||||
}
|
||||
|
||||
return (new AsIsBattleActionDeciderResult(), new NoneBattleActionData());
|
||||
}
|
||||
|
||||
private async UniTask<(BattleActionDecisionResult decisionResult, BattleActionData actionData)> DecideForPlayer(CancellationToken ctx, EntityProperties entity)
|
||||
|
||||
Reference in new issue
Block a user