This commit is contained in:
MuHua-123
2025-07-22 16:35:23 +08:00
parent a7eb4f7bbb
commit 1adce62b71
21 changed files with 379 additions and 106 deletions
@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 阶段类型
/// </summary>
public enum PhaseType {
,
,
,
,
,
}
/// <summary>
/// 阶段
/// </summary>
public interface IPhase {
/// <summary> 开始阶段 </summary>
public void StartPhase();
/// <summary> 更新阶段 </summary>
public void UpdatePhase();
/// <summary> 退出阶段 </summary>
public void QuitPhase();
}
/// <summary>
/// 战斗阶段
/// </summary>
public abstract class BattlePhase : IPhase {
/// <summary> 模拟器 </summary>
public readonly BattleSimulator simulator;
/// <summary> 战斗队列 </summary>
public BattleQueue BattleQueue => simulator.battleQueue;
public BattlePhase(BattleSimulator simulator) => this.simulator = simulator;
public abstract void StartPhase();
public abstract void UpdatePhase();
public abstract void QuitPhase();
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ee046dc0d64f6184c966baba17876ec9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 行动阶段
/// </summary>
public class PhaseAction : BattlePhase {
public PhaseAction(BattleSimulator simulator) : base(simulator) { }
public override void StartPhase() {
// throw new System.NotImplementedException();
}
public override void UpdatePhase() {
// 选择行动目标,没有行动目标则进入结算阶段
if (!BattleQueue.Dequeue(out BattleCharacter character)) { simulator.Transition(PhaseType.); return; }
// 判断是否可以行动
// 选择一个目标
// 对目标进行攻击
// TODO:记录器
// Debug.Log($"正式回合:{roundCount}");
}
public override void QuitPhase() {
// throw new System.NotImplementedException();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad6c0033db83a3c4fa9d92f3f1912d5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 突袭阶段
/// </summary>
public class PhaseAssault : BattlePhase {
public PhaseAssault(BattleSimulator simulator) : base(simulator) { }
public override void StartPhase() {
throw new System.NotImplementedException();
}
public override void UpdatePhase() {
throw new System.NotImplementedException();
}
public override void QuitPhase() {
throw new System.NotImplementedException();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 620e71ced51f8e94997a198ac8b1e6c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 结束阶段
/// </summary>
public class PhaseFinish : BattlePhase {
public PhaseFinish(BattleSimulator simulator) : base(simulator) { }
public override void StartPhase() {
throw new System.NotImplementedException();
}
public override void UpdatePhase() {
throw new System.NotImplementedException();
}
public override void QuitPhase() {
throw new System.NotImplementedException();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 357207f5d09ca394e84210d51916507b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 正式阶段
/// </summary>
public class PhaseFormal : BattlePhase {
/// <summary> 回合计数 </summary>
public int roundCount;
public PhaseFormal(BattleSimulator simulator) : base(simulator) { }
public override void StartPhase() {
// throw new System.NotImplementedException();
}
public override void UpdatePhase() {
roundCount++;
BattleQueue.UpdateQueue();
simulator.Transition(PhaseType.);
// TODO:记录器
Debug.Log($"正式回合:{roundCount}");
}
public override void QuitPhase() {
// throw new System.NotImplementedException();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 066680fafb7f9cf4dbac4f7291e682cc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 先攻阶段
/// </summary>
public class PhaseInitiative : BattlePhase {
public PhaseInitiative(BattleSimulator simulator) : base(simulator) { }
public override void StartPhase() {
// throw new System.NotImplementedException();
}
public override void UpdatePhase() {
BattleQueue.ForEach(obj => obj.sequence = Dice.Roll20(obj.DexModifier));
BattleQueue.OrderByDescending(c => c.sequence);
// TODO:需要添加突袭阶段
simulator.Transition(PhaseType.);
// TODO:记录器
Debug.Log("先攻");
}
public override void QuitPhase() {
// throw new System.NotImplementedException();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4fc0f8aced9d5f04f879b8300fd02e47
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: