Something more fixed
This commit is contained in:
1 parent
7d236d14cd
commit
d810ea00b6
676 files changed
+176711
-316402
No files matched your search
@@ -9,6 +9,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
var snapshot = new AttackBattleActionData()
|
||||
{
|
||||
TotalFrames = TotalFrames,
|
||||
Finished = Finished,
|
||||
CurrentFrame = CurrentFrame,
|
||||
TransitionFrames = TransitionFrames,
|
||||
};
|
||||
@@ -21,6 +22,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
if (snapshot is not AttackBattleActionData neededSnapshot) return;
|
||||
|
||||
TotalFrames = neededSnapshot.TotalFrames;
|
||||
Finished = neededSnapshot.Finished;
|
||||
CurrentFrame = neededSnapshot.CurrentFrame;
|
||||
TransitionFrames = neededSnapshot.TransitionFrames;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
return new MovementBattleActionData
|
||||
{
|
||||
TotalFrames = TotalFrames,
|
||||
Finished = Finished,
|
||||
Position = Position,
|
||||
Rotation = Rotation,
|
||||
Path = Path,
|
||||
@@ -40,10 +41,11 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
|
||||
public override void RestoreSnapshot(BattleActionData snapshot)
|
||||
{
|
||||
TotalFrames = snapshot.TotalFrames;
|
||||
|
||||
if (snapshot is not MovementBattleActionData moveSnapshot) return;
|
||||
|
||||
TotalFrames = snapshot.TotalFrames;
|
||||
Finished = snapshot.Finished;
|
||||
|
||||
CurrentFrame = moveSnapshot.CurrentFrame;
|
||||
Position = moveSnapshot.Position;
|
||||
Rotation = moveSnapshot.Rotation;
|
||||
|
||||
@@ -4,12 +4,17 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public override BattleActionData GetSnapshot()
|
||||
{
|
||||
return new NoneBattleActionData();
|
||||
return new NoneBattleActionData()
|
||||
{
|
||||
TotalFrames = TotalFrames,
|
||||
Finished = Finished,
|
||||
};
|
||||
}
|
||||
|
||||
public override void RestoreSnapshot(BattleActionData snapshot)
|
||||
{
|
||||
TotalFrames = snapshot.TotalFrames;
|
||||
Finished = snapshot.Finished;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
var snapshot = new AttackBattleActionData()
|
||||
{
|
||||
TotalFrames = TotalFrames,
|
||||
Finished = Finished,
|
||||
CurrentFrame = CurrentFrame,
|
||||
TransitionFrames = TransitionFrames,
|
||||
};
|
||||
@@ -21,6 +22,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
if (snapshot is not AttackBattleActionData neededSnapshot) return;
|
||||
|
||||
TotalFrames = neededSnapshot.TotalFrames;
|
||||
Finished = neededSnapshot.Finished;
|
||||
CurrentFrame = neededSnapshot.CurrentFrame;
|
||||
TransitionFrames = neededSnapshot.TransitionFrames;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
return new WaitBattleActionData
|
||||
{
|
||||
TotalFrames = TotalFrames,
|
||||
Finished = Finished,
|
||||
WaitFrames = WaitFrames,
|
||||
StartedWaiting = StartedWaiting
|
||||
};
|
||||
@@ -16,9 +17,10 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
|
||||
public override void RestoreSnapshot(BattleActionData snapshot)
|
||||
{
|
||||
TotalFrames = snapshot.TotalFrames;
|
||||
|
||||
if (snapshot is not WaitBattleActionData waitSnapshot) return;
|
||||
|
||||
TotalFrames = snapshot.TotalFrames;
|
||||
Finished = snapshot.Finished;
|
||||
|
||||
WaitFrames = waitSnapshot.WaitFrames;
|
||||
StartedWaiting = waitSnapshot.StartedWaiting;
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
Vector3 targetPos = positionDecisionResult.Position;
|
||||
|
||||
Vector3 toTargetXZ = targetPos - startPos;
|
||||
toTargetXZ.y = 0f;
|
||||
|
||||
Debug.DrawLine(startPos, targetPos, Color.red, 5f);
|
||||
|
||||
@@ -126,12 +127,6 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
entity.KinematicCharacterMotor.SetRotation(nextRot);
|
||||
StopMovementAndFinish(movementController);
|
||||
|
||||
KinematicCharacterSystem.Simulate(
|
||||
tickDelta,
|
||||
KinematicCharacterSystem.CharacterMotors,
|
||||
KinematicCharacterSystem.PhysicsMovers
|
||||
);
|
||||
|
||||
if (movementActionData.CurrentFrame >= movementActionData.TotalFrames || angle <= 0.5f)
|
||||
{
|
||||
entity.KinematicCharacterMotor.SetRotation(positionDecisionResult.Rotation);
|
||||
@@ -147,7 +142,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
entity.KinematicCharacterMotor.SetRotation(positionDecisionResult.Rotation);
|
||||
StopMovementAndFinish(movementController);
|
||||
battleActionData.Finished = true;
|
||||
Debug.Log("Wrong index");
|
||||
Debug.Log($"Corners {movementActionData.Corners == null} || Wrong index {movementActionData.CurrentCornerIndex >= movementActionData.Corners?.Length}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,11 +170,6 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
entity.KinematicCharacterMotor.SetRotation(positionDecisionResult.Rotation);
|
||||
StopMovementAndFinish(movementController);
|
||||
KinematicCharacterSystem.Simulate(
|
||||
tickDelta,
|
||||
KinematicCharacterSystem.CharacterMotors,
|
||||
KinematicCharacterSystem.PhysicsMovers
|
||||
);
|
||||
|
||||
battleActionData.Finished = true;
|
||||
Debug.Log("Last corner");
|
||||
@@ -216,12 +206,6 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
|
||||
movementController.SetInputs(ref aiInputs);
|
||||
|
||||
KinematicCharacterSystem.Simulate(
|
||||
tickDelta,
|
||||
KinematicCharacterSystem.CharacterMotors,
|
||||
KinematicCharacterSystem.PhysicsMovers
|
||||
);
|
||||
|
||||
Vector3 postMovePos = movementController.Motor.TransientPosition;
|
||||
Vector3 toFinal = movementActionData.Corners[^1] - postMovePos;
|
||||
toFinal.y = 0f;
|
||||
|
||||
@@ -220,7 +220,13 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|
||||
entity.animator.Update(TickDelta);
|
||||
}
|
||||
|
||||
|
||||
KinematicCharacterController.KinematicCharacterSystem.Simulate(
|
||||
TickDelta,
|
||||
KinematicCharacterController.KinematicCharacterSystem.CharacterMotors,
|
||||
KinematicCharacterController.KinematicCharacterSystem.PhysicsMovers
|
||||
);
|
||||
|
||||
Physics.Simulate(TickDelta);
|
||||
Physics.SyncTransforms();
|
||||
|
||||
@@ -321,6 +327,8 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
else if (decisionResult.ResultCode == BattleActionDecisionResultCode.CancelDecision)
|
||||
{
|
||||
decidedActionType = BattleActionType.None;
|
||||
_battleActionDatas.Remove(entityId);
|
||||
_actionDecisionResults.Remove(entityId);
|
||||
break;
|
||||
}
|
||||
else break;
|
||||
@@ -328,15 +336,7 @@ namespace Code.OfficeGame.BattleMode.Timeline
|
||||
|
||||
_battleActionDeciders[deciderType].UnmountDecider();
|
||||
}
|
||||
|
||||
if (entityResultSnapshot != null
|
||||
&& !_actionDecisionResults.TryAdd(entityId, entityResultSnapshot))
|
||||
_actionDecisionResults[entityId]?.RestoreSnapshot(entityResultSnapshot);
|
||||
|
||||
if (entityActionDataSnapshot != null
|
||||
&& !_battleActionDatas.TryAdd(entityId, entityActionDataSnapshot))
|
||||
_battleActionDatas[entityId]?.RestoreSnapshot(entityActionDataSnapshot);
|
||||
|
||||
|
||||
if (decisionResult == null || actionData == null) throw new ArgumentNullException(nameof(decisionResult));
|
||||
|
||||
return (decisionResult, actionData);
|
||||
|
||||
Reference in new issue
Block a user