Progressing fixes
This commit is contained in:
1 parent
d00ce7bb0e
commit
0619ada74f
62 files changed
+81418
-72853
No files matched your search
@@ -11,6 +11,8 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
|
||||
public int HitboxEndFrame;
|
||||
|
||||
public HitBoxPartType AttackingBodyPart;
|
||||
|
||||
public int StuggerFrames;
|
||||
|
||||
public int Damage;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Code.Infrastructure.Utils;
|
||||
using Code.OfficeGame.BattleMode.Actions.Deciders;
|
||||
using Code.OfficeGame.BattleMode.HitBoxes;
|
||||
using Code.OfficeGame.BattleMode.Timeline;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions.Attacks
|
||||
@@ -46,7 +47,7 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
|
||||
if (actionData.CurrentFrame >= _attackData.HitboxStartFrame
|
||||
&& actionData.CurrentFrame <= _attackData.HitboxEndFrame)
|
||||
{
|
||||
entity.EntityHitBoxes.CheckHitsForCurrentFrame(OnEnemyHit, HitBoxPartType.LArm);
|
||||
entity.EntityHitBoxes.CheckHitsForCurrentFrame(OnEnemyHit, _attackData.AttackingBodyPart);
|
||||
}
|
||||
|
||||
if (actionData.CurrentFrame >= _attackData.TotalFrames)
|
||||
@@ -75,7 +76,12 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
|
||||
|
||||
private void OnEnemyHit(Collider enemyCollider)
|
||||
{
|
||||
Debug.Log($"Попадание в {enemyCollider.name}! Урон: {_attackData.Damage}");
|
||||
var originEntityId = enemyCollider.GetComponentInParent<EntityProperties>().GetEntityId();
|
||||
|
||||
var actionData = new StuggerActionData { TotalFrames = _attackData.StuggerFrames};
|
||||
var decisionResult = new AsIsBattleActionDeciderResult {ActionType = BattleActionType.Stugger};
|
||||
|
||||
BattleTimeline.ForceDecideAction(originEntityId, actionData, decisionResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using Code.OfficeGame.BattleMode.Actions.Deciders;
|
||||
using UnityEngine;
|
||||
using Code.OfficeGame.BattleMode.Timeline;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
@@ -9,5 +9,8 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
public abstract BattleActionType ActionType { get; }
|
||||
public abstract DeciderType DeciderType { get; }
|
||||
public abstract BattleActionData MountAndGetFrames(EntityProperties entity, BattleActionDecisionResult result);
|
||||
|
||||
protected BattleTimeline BattleTimeline;
|
||||
public void SetBattleTimeline(BattleTimeline battleTimeline) => BattleTimeline = battleTimeline;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,6 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
|
||||
private void StopMovementAndFinish(MovementController movementController)
|
||||
{
|
||||
Debug.Log("MovementFinished");
|
||||
var emptyInputs = new AICharacterInputs
|
||||
{
|
||||
MoveVector = Vector3.zero,
|
||||
|
||||
@@ -13,8 +13,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
|
||||
private BattleActionParameters _actionParameters;
|
||||
|
||||
[Inject]
|
||||
public void Construct(MultipleConfig<BattleActionParameters> actionData)
|
||||
public BattleActionStugger(MultipleConfig<BattleActionParameters> actionData)
|
||||
{
|
||||
_actionParameters = actionData.Configs.SingleOrDefault(x => x.ActionType == ActionType);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,14 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
_cameraStateMachine = cameraStateMachine;
|
||||
_battleActionDecisionPanel = battleActionDecisionPanel;
|
||||
_timelinePanel = timelinePanel;
|
||||
_battleActions = battleActions.ToDictionary(x => x.ActionType);
|
||||
|
||||
_battleActions = new();
|
||||
foreach (var battleAction in battleActions)
|
||||
{
|
||||
battleAction.SetBattleTimeline(this);
|
||||
_battleActions.Add(battleAction.ActionType, battleAction);
|
||||
}
|
||||
|
||||
_battleActionDeciders = battleActionDeciders.ToDictionary(x => x.DeciderType);
|
||||
}
|
||||
|
||||
@@ -149,12 +156,24 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|| !actionDataSnapshots.TryGetValue(entityId, out var battleActionData))
|
||||
continue;
|
||||
|
||||
bool actionChanged = false;
|
||||
|
||||
if (!_actionDecisionResults.TryAdd(entityId, actionDecisionResult))
|
||||
_actionDecisionResults[entityId]?.RestoreSnapshot(actionDecisionResult);
|
||||
{
|
||||
actionChanged = actionDecisionResult.ActionType !=
|
||||
_actionDecisionResults[entityId].ActionType;
|
||||
if(actionChanged)
|
||||
_actionDecisionResults[entityId] = actionDecisionResult;
|
||||
else
|
||||
_actionDecisionResults[entityId]?.RestoreSnapshot(actionDecisionResult);
|
||||
}
|
||||
|
||||
if (!_battleActionDatas.TryAdd(entityId, battleActionData))
|
||||
_battleActionDatas[entityId]?.RestoreSnapshot(battleActionData);
|
||||
|
||||
{
|
||||
if(actionChanged) _battleActionDatas[entityId] = battleActionData;
|
||||
else _battleActionDatas[entityId]?.RestoreSnapshot(battleActionData);
|
||||
}
|
||||
|
||||
entity.RestoreSnapshot(entitySnapshots[entityId]);
|
||||
}
|
||||
}
|
||||
@@ -290,8 +309,6 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
decisionResult = await _battleActionDeciders[deciderType].GetDecision();
|
||||
decisionResult.ActionType = decidedActionType;
|
||||
|
||||
Debug.Log(decisionResult.ResultCode);
|
||||
|
||||
actionData = _battleActions[decidedActionType].MountAndGetFrames(entity, decisionResult);
|
||||
|
||||
previewCancellationToken.Cancel();
|
||||
@@ -331,5 +348,17 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|
||||
return (decisionResult, actionData);
|
||||
}
|
||||
|
||||
public void ForceDecideAction(
|
||||
EntityId entityId,
|
||||
BattleActionData forcedBattleActionData,
|
||||
BattleActionDecisionResult forcedBattleActionDataResult)
|
||||
{
|
||||
|
||||
_battleActionDatas[entityId] = forcedBattleActionData;
|
||||
_actionDecisionResults[entityId] = forcedBattleActionDataResult;
|
||||
|
||||
Debug.Log($"Задано действие {forcedBattleActionDataResult.ActionType} для {entityId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user