Great timeline system (Age of AI WON)
This commit is contained in:
1 parent
2ce0391c16
commit
e312131725
182 files changed
+380070
-470221
No files matched your search
@@ -0,0 +1,131 @@
|
||||
using Code.OfficeGame.BattleMode.Actions;
|
||||
using Code.OfficeGame.BattleMode.HitBoxes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Timeline
|
||||
{
|
||||
public enum TimelineMode
|
||||
{
|
||||
Idle,
|
||||
Deciding,
|
||||
PreviewPlaying,
|
||||
Scrubbing,
|
||||
BattlePlaying
|
||||
}
|
||||
|
||||
public enum TimelineEventType
|
||||
{
|
||||
ActionCompleted, // Прерывание на выбор действия
|
||||
HitLanded, // Реальное попадание (уже после эффектов и проверки смерти)
|
||||
Staggered, // Наложен стаггер
|
||||
EntityDied // Смерть сущности
|
||||
}
|
||||
|
||||
public readonly struct TimelineEvent
|
||||
{
|
||||
public readonly int Frame;
|
||||
public readonly int SlotIndex;
|
||||
public readonly EntityId EntityId;
|
||||
public readonly TimelineEventType EventType;
|
||||
public readonly int InterruptionStage;
|
||||
public readonly Vector3 WorldPosition;
|
||||
public readonly HitBoxPartType HitPart;
|
||||
public readonly int Value; // Например, итоговый урон
|
||||
|
||||
public TimelineEvent(
|
||||
int frame,
|
||||
int slotIndex,
|
||||
EntityId entityId,
|
||||
TimelineEventType eventType,
|
||||
int interruptionStage,
|
||||
Vector3 worldPosition = default,
|
||||
HitBoxPartType hitPart = default,
|
||||
int value = 0)
|
||||
{
|
||||
Frame = frame;
|
||||
SlotIndex = slotIndex;
|
||||
EntityId = entityId;
|
||||
EventType = eventType;
|
||||
InterruptionStage = interruptionStage;
|
||||
WorldPosition = worldPosition;
|
||||
HitPart = hitPart;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct EntityActionSlotSnapshot
|
||||
{
|
||||
public BattleActionType ActionType;
|
||||
public BattleActionDecisionResult DecisionResult;
|
||||
public BattleActionData ActionData;
|
||||
public BattleActionType LastCompletedActionType;
|
||||
public int ActionStartFrame;
|
||||
public int EstimatedEndFrame;
|
||||
|
||||
public readonly EntityActionSlotSnapshot Clone()
|
||||
{
|
||||
return new EntityActionSlotSnapshot
|
||||
{
|
||||
ActionType = ActionType,
|
||||
DecisionResult = DecisionResult?.GetSnapshot(),
|
||||
ActionData = ActionData?.GetSnapshot(),
|
||||
LastCompletedActionType = LastCompletedActionType,
|
||||
ActionStartFrame = ActionStartFrame,
|
||||
EstimatedEndFrame = EstimatedEndFrame
|
||||
};
|
||||
}
|
||||
|
||||
public static EntityActionSlotSnapshot CreateNone(
|
||||
int frame,
|
||||
BattleActionType lastCompleted = BattleActionType.None)
|
||||
{
|
||||
return new EntityActionSlotSnapshot
|
||||
{
|
||||
ActionType = BattleActionType.None,
|
||||
DecisionResult = new AsIsBattleActionDeciderResult
|
||||
{
|
||||
ActionType = BattleActionType.None,
|
||||
ResultCode = BattleActionDecisionResultCode.Decided
|
||||
},
|
||||
ActionData = new NoneBattleActionData { TotalFrames = 0, Finished = true },
|
||||
LastCompletedActionType = lastCompleted,
|
||||
ActionStartFrame = frame,
|
||||
EstimatedEndFrame = frame
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public struct EntityFrameSnapshot
|
||||
{
|
||||
public EntityId EntityId;
|
||||
public EntitySnapshot PhysicsAndVisuals;
|
||||
public EntityActionSlotSnapshot ActionSlot;
|
||||
}
|
||||
|
||||
public struct FrameHitboxVisual
|
||||
{
|
||||
public Matrix4x4 Matrix;
|
||||
public Color Color;
|
||||
}
|
||||
|
||||
public sealed class BattleFrameSnapshot
|
||||
{
|
||||
public int Frame;
|
||||
|
||||
/// <summary>
|
||||
/// Сколько прерываний уже прошло к этому кадру в текущем прогнозе (0 = до первого прерывания).
|
||||
/// Используется для смены цвета проекции.
|
||||
/// </summary>
|
||||
public int InterruptionStage;
|
||||
|
||||
public EntityFrameSnapshot[] Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Битовая маска слотов (0..63), чьё действие ЗАВЕРШИЛОСЬ именно на этом кадре.
|
||||
/// </summary>
|
||||
public ulong ReadySlotsMask;
|
||||
|
||||
public TimelineEvent[] Events;
|
||||
public FrameHitboxVisual[] HitboxVisuals;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user