update P2-Job-System-+-Burst-落地.md
This commit is contained in:
@@ -22,6 +22,7 @@ namespace UnityGameFramework.Editor
|
||||
"UnityGameFramework.Runtime",
|
||||
#endif
|
||||
"Assembly-CSharp",
|
||||
"VampireLike"
|
||||
};
|
||||
|
||||
private static readonly string[] RuntimeOrEditorAssemblyNames =
|
||||
@@ -34,6 +35,8 @@ namespace UnityGameFramework.Editor
|
||||
"UnityGameFramework.Editor",
|
||||
#endif
|
||||
"Assembly-CSharp-Editor",
|
||||
"VampireLike",
|
||||
"VampireLike.Editor"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
<CompressionHelperTypeName>UnityGameFramework.Runtime.DefaultCompressionHelper</CompressionHelperTypeName>
|
||||
<AdditionalCompressionSelected>False</AdditionalCompressionSelected>
|
||||
<ForceRebuildAssetBundleSelected>False</ForceRebuildAssetBundleSelected>
|
||||
<BuildEventHandlerTypeName>StarForce.Editor.StarForceBuildEventHandler</BuildEventHandlerTypeName>
|
||||
<OutputDirectory>D:/Learn/GameLearn/UnityProjects/VampireLike/bin</OutputDirectory>
|
||||
<BuildEventHandlerTypeName>VampireLike.Editor.VampireLikeBuildEventHandler</BuildEventHandlerTypeName>
|
||||
<OutputDirectory>C:/UnityProjects/VampireLike/bin/AssetBundles</OutputDirectory>
|
||||
<OutputPackageSelected>True</OutputPackageSelected>
|
||||
<OutputFullSelected>True</OutputFullSelected>
|
||||
<OutputPackedSelected>True</OutputPackedSelected>
|
||||
<OutputFullSelected>False</OutputFullSelected>
|
||||
<OutputPackedSelected>False</OutputPackedSelected>
|
||||
</Settings>
|
||||
</ResourceBuilder>
|
||||
</UnityGameFramework>
|
||||
@@ -17,6 +17,7 @@
|
||||
<Resource Name="Music/Menu" FileSystem="Resources" LoadType="0" Packed="True" ResourceGroups="Music" />
|
||||
<Resource Name="Scenes" FileSystem="Resources" LoadType="0" Packed="True" />
|
||||
<Resource Name="SceneSettings" LoadType="0" Packed="False" />
|
||||
<Resource Name="Scripts" LoadType="0" Packed="False" />
|
||||
<Resource Name="Sounds" FileSystem="Resources" LoadType="0" Packed="True" />
|
||||
<Resource Name="Textures" FileSystem="Resources" LoadType="0" Packed="True" />
|
||||
<Resource Name="UI/UIForms" FileSystem="UI" LoadType="0" Packed="True" />
|
||||
@@ -42,6 +43,7 @@
|
||||
<Asset Guid="0f995b3145e0e7247a42da6cef1dbf23" ResourceName="Materials" />
|
||||
<Asset Guid="1046dcb12e547564d8b54bd15419a787" ResourceName="Entities" />
|
||||
<Asset Guid="1053b0070685be347ab58587156842dc" ResourceName="Localization/Dictionaries" ResourceVariant="zh-tw" />
|
||||
<Asset Guid="11143001bcbdc864b8d8fe2083142e5a" ResourceName="Entities" />
|
||||
<Asset Guid="1478894bc9a1ed241b05b0862a7b8bce" ResourceName="Textures" />
|
||||
<Asset Guid="14869ac0d4433f04db1704e39d03412e" ResourceName="Localization/Dictionaries" ResourceVariant="en-us" />
|
||||
<Asset Guid="156d241f796508c4da4fc354a7fbf5a8" ResourceName="UI/UISprites/Common" />
|
||||
@@ -83,6 +85,7 @@
|
||||
<Asset Guid="4473d81b14ddb0143addf0e6050d8491" ResourceName="Scenes" />
|
||||
<Asset Guid="44c8db52241385c45bbb14a1718f17bf" ResourceName="Configs" />
|
||||
<Asset Guid="44cfa1c448225554c961ad6eb667d80b" ResourceName="DataTables" />
|
||||
<Asset Guid="47a82ffa13c291447ab895cd0bc251cd" ResourceName="Scripts" />
|
||||
<Asset Guid="4c3865b2ac420cd46a9cde6ab468d016" ResourceName="Materials" />
|
||||
<Asset Guid="4ca22ae3bc068c84eb7858d5b9bdf3e2" ResourceName="Fonts" />
|
||||
<Asset Guid="4f688097e85071841a2c3ba165000c20" ResourceName="Textures" />
|
||||
@@ -94,6 +97,7 @@
|
||||
<Asset Guid="5b5a6a737c460eb4abc105d6583d405e" ResourceName="Fonts" />
|
||||
<Asset Guid="5dcd89912e222bf4c87f76db4044bc5e" ResourceName="Localization/Dictionaries" ResourceVariant="ko-kr" />
|
||||
<Asset Guid="5ebb46af6f16ae94e87f64a7dc0a49cb" ResourceName="Entities" />
|
||||
<Asset Guid="602d791ab1251f74ca2470c53bf382a3" ResourceName="Scripts" />
|
||||
<Asset Guid="62af9e5c8f39cfa49af9e10ccf42f1da" ResourceName="UI/UISprites/Common" />
|
||||
<Asset Guid="638ff8ae4a0d15047839cd265d3bc296" ResourceName="Music/Background" />
|
||||
<Asset Guid="63fe6ff9ab9e1433f8db4ebd940f2442" ResourceName="Materials" />
|
||||
|
||||
+164
-102
@@ -23,6 +23,17 @@ namespace CustomComponent
|
||||
private const int RequiredCornerTapCount = 3;
|
||||
private const int DebugHealAmount = 200;
|
||||
|
||||
[Header("Window Content")]
|
||||
[SerializeField] private bool _showBuffSection = true;
|
||||
[SerializeField] private bool _showBattleOverview = true;
|
||||
[SerializeField] private bool _showCollisionStats = true;
|
||||
[SerializeField] private bool _showSpawnControls = true;
|
||||
[SerializeField] private bool _showBattleDurationControls = true;
|
||||
[SerializeField] private bool _showSeparationSolverControls = true;
|
||||
[SerializeField] private bool _showPlayerWeaponControls = true;
|
||||
[SerializeField] private bool _showPlayerHealthControls = true;
|
||||
[SerializeField] private bool _showTips = true;
|
||||
|
||||
private Rect _windowRect = new Rect(20f, 60f, 460f, 800f);
|
||||
private bool _isPanelVisible;
|
||||
private int _windowId;
|
||||
@@ -85,20 +96,42 @@ namespace CustomComponent
|
||||
|
||||
private void DrawWindow(int windowId)
|
||||
{
|
||||
EnsurePropList();
|
||||
if (_showBuffSection)
|
||||
{
|
||||
EnsurePropList();
|
||||
}
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
DrawBuffSection();
|
||||
bool hasPreviousSection = false;
|
||||
if (_showBuffSection)
|
||||
{
|
||||
DrawBuffSection();
|
||||
hasPreviousSection = true;
|
||||
}
|
||||
|
||||
GUILayout.Space(8f);
|
||||
GUILayout.Label(string.Empty, GUI.skin.horizontalSlider);
|
||||
GUILayout.Space(8f);
|
||||
if (HasVisibleBattleSection())
|
||||
{
|
||||
if (hasPreviousSection)
|
||||
{
|
||||
GUILayout.Space(8f);
|
||||
GUILayout.Label(string.Empty, GUI.skin.horizontalSlider);
|
||||
GUILayout.Space(8f);
|
||||
}
|
||||
|
||||
DrawBattleSection();
|
||||
DrawBattleSection();
|
||||
hasPreviousSection = true;
|
||||
}
|
||||
|
||||
GUILayout.Space(8f);
|
||||
GUILayout.Label("Tips: press `F8` or tap top-left corner 3 times to toggle.", GUILayout.Height(20f));
|
||||
if (_showTips)
|
||||
{
|
||||
if (hasPreviousSection)
|
||||
{
|
||||
GUILayout.Space(8f);
|
||||
}
|
||||
|
||||
GUILayout.Label("Tips: press `F8` or tap top-left corner 3 times to toggle.", GUILayout.Height(20f));
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow(new Rect(0, 0, 10000, 22));
|
||||
@@ -169,12 +202,15 @@ namespace CustomComponent
|
||||
return;
|
||||
}
|
||||
|
||||
GUILayout.Label($"Spawn Rate: {enemyManager.SpawnRateScale:F2}");
|
||||
GUILayout.Label($"Battle Time: {enemyManager.ElapsedBattleTime:F1}s / {enemyManager.BattleDuration:F1}s");
|
||||
GUILayout.Label($"Enemy Count: {enemyManager.CurrentEnemyCount}");
|
||||
if (_showBattleOverview)
|
||||
{
|
||||
GUILayout.Label($"Spawn Rate: {enemyManager.SpawnRateScale:F2}");
|
||||
GUILayout.Label($"Battle Time: {enemyManager.ElapsedBattleTime:F1}s / {enemyManager.BattleDuration:F1}s");
|
||||
GUILayout.Label($"Enemy Count: {enemyManager.CurrentEnemyCount}");
|
||||
}
|
||||
|
||||
Simulation.SimulationWorld simulationWorld = GameEntry.SimulationWorld;
|
||||
if (simulationWorld != null)
|
||||
if (_showCollisionStats && simulationWorld != null)
|
||||
{
|
||||
GUILayout.Space(4f);
|
||||
GUILayout.Label(
|
||||
@@ -196,104 +232,130 @@ namespace CustomComponent
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Rate", GUILayout.Width(52f));
|
||||
string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(60f));
|
||||
if (float.TryParse(rateText, out float parsedRate))
|
||||
if (_showSpawnControls)
|
||||
{
|
||||
_spawnRateScaleInput = Mathf.Clamp(parsedRate, MinSpawnRate, 50f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Apply", GUILayout.Width(70f)))
|
||||
{
|
||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("x0.5", GUILayout.Width(60f)))
|
||||
{
|
||||
_spawnRateScaleInput = Mathf.Max(MinSpawnRate, enemyManager.SpawnRateScale * 0.5f);
|
||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("x2", GUILayout.Width(60f)))
|
||||
{
|
||||
_spawnRateScaleInput = enemyManager.SpawnRateScale * 2f;
|
||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Add Sec", GUILayout.Width(52f));
|
||||
string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(60f));
|
||||
if (float.TryParse(durationText, out float parsedDuration))
|
||||
{
|
||||
_extendDurationSeconds = Mathf.Clamp(parsedDuration, 1f, 3600f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Extend Battle", GUILayout.Height(24f)))
|
||||
{
|
||||
if (procedure.CurrentGameState is GameStateBattle gameState)
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Rate", GUILayout.Width(52f));
|
||||
string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(60f));
|
||||
if (float.TryParse(rateText, out float parsedRate))
|
||||
{
|
||||
gameState.AddBattleDuration(_extendDurationSeconds);
|
||||
_spawnRateScaleInput = Mathf.Clamp(parsedRate, MinSpawnRate, 50f);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(4f);
|
||||
GUILayout.Label($"Enemy Separation Solver: {EnemySeparationSolverProvider.CurrentSolverName}");
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Use Naive O(N^2)", GUILayout.Height(24f)))
|
||||
{
|
||||
EnemySeparationSolverProvider.UseNaiveSolver();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Use Grid Bucket", GUILayout.Height(24f)))
|
||||
{
|
||||
EnemySeparationSolverProvider.UseGridBucketSolver();
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Label(
|
||||
$"Player Weapon: {(player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled"))}");
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.enabled = player != null;
|
||||
if (GUILayout.Button("Disable Weapons", GUILayout.Height(24f)))
|
||||
{
|
||||
player.SetWeaponEnabled(false);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Enable Weapons", GUILayout.Height(24f)))
|
||||
{
|
||||
player.SetWeaponEnabled(true);
|
||||
}
|
||||
|
||||
GUI.enabled = true;
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(4f);
|
||||
GUILayout.Label(
|
||||
$"Player HP: {(playerHealth == null ? "Unavailable" : $"{playerHealth.CurrentHealth}/{playerHealth.MaxHealth}")}");
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.enabled = playerHealth != null;
|
||||
if (GUILayout.Button($"+{DebugHealAmount} HP", GUILayout.Height(24f)))
|
||||
{
|
||||
AddPlayerHealth(playerHealth, DebugHealAmount);
|
||||
}
|
||||
|
||||
if (GUILayout.Button(_lockPlayerHealthToMax ? "GodMode: ON" : "GodMode: OFF", GUILayout.Height(24f)))
|
||||
{
|
||||
_lockPlayerHealthToMax = !_lockPlayerHealthToMax;
|
||||
if (_lockPlayerHealthToMax)
|
||||
if (GUILayout.Button("Apply", GUILayout.Width(70f)))
|
||||
{
|
||||
RestorePlayerHealthToMax(playerHealth);
|
||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("x0.5", GUILayout.Width(60f)))
|
||||
{
|
||||
_spawnRateScaleInput = Mathf.Max(MinSpawnRate, enemyManager.SpawnRateScale * 0.5f);
|
||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("x2", GUILayout.Width(60f)))
|
||||
{
|
||||
_spawnRateScaleInput = enemyManager.SpawnRateScale * 2f;
|
||||
enemyManager.SetSpawnRateScale(_spawnRateScaleInput);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUI.enabled = true;
|
||||
GUILayout.EndHorizontal();
|
||||
if (_showBattleDurationControls)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Add Sec", GUILayout.Width(52f));
|
||||
string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(60f));
|
||||
if (float.TryParse(durationText, out float parsedDuration))
|
||||
{
|
||||
_extendDurationSeconds = Mathf.Clamp(parsedDuration, 1f, 3600f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Extend Battle", GUILayout.Height(24f)))
|
||||
{
|
||||
if (procedure.CurrentGameState is GameStateBattle gameState)
|
||||
{
|
||||
gameState.AddBattleDuration(_extendDurationSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
if (_showSeparationSolverControls)
|
||||
{
|
||||
GUILayout.Space(4f);
|
||||
GUILayout.Label($"Enemy Separation Solver: {EnemySeparationSolverProvider.CurrentSolverName}");
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Use Naive O(N^2)", GUILayout.Height(24f)))
|
||||
{
|
||||
EnemySeparationSolverProvider.UseNaiveSolver();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Use Grid Bucket", GUILayout.Height(24f)))
|
||||
{
|
||||
EnemySeparationSolverProvider.UseGridBucketSolver();
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
if (_showPlayerWeaponControls)
|
||||
{
|
||||
GUILayout.Label(
|
||||
$"Player Weapon: {(player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled"))}");
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.enabled = player != null;
|
||||
if (GUILayout.Button("Disable Weapons", GUILayout.Height(24f)))
|
||||
{
|
||||
player.SetWeaponEnabled(false);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Enable Weapons", GUILayout.Height(24f)))
|
||||
{
|
||||
player.SetWeaponEnabled(true);
|
||||
}
|
||||
|
||||
GUI.enabled = true;
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
if (_showPlayerHealthControls)
|
||||
{
|
||||
GUILayout.Space(4f);
|
||||
GUILayout.Label(
|
||||
$"Player HP: {(playerHealth == null ? "Unavailable" : $"{playerHealth.CurrentHealth}/{playerHealth.MaxHealth}")}");
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.enabled = playerHealth != null;
|
||||
if (GUILayout.Button($"+{DebugHealAmount} HP", GUILayout.Height(24f)))
|
||||
{
|
||||
AddPlayerHealth(playerHealth, DebugHealAmount);
|
||||
}
|
||||
|
||||
if (GUILayout.Button(_lockPlayerHealthToMax ? "GodMode: ON" : "GodMode: OFF", GUILayout.Height(24f)))
|
||||
{
|
||||
_lockPlayerHealthToMax = !_lockPlayerHealthToMax;
|
||||
if (_lockPlayerHealthToMax)
|
||||
{
|
||||
RestorePlayerHealthToMax(playerHealth);
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = true;
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasVisibleBattleSection()
|
||||
{
|
||||
return _showBattleOverview ||
|
||||
_showCollisionStats ||
|
||||
_showSpawnControls ||
|
||||
_showBattleDurationControls ||
|
||||
_showSeparationSolverControls ||
|
||||
_showPlayerWeaponControls ||
|
||||
_showPlayerHealthControls;
|
||||
}
|
||||
|
||||
private void EnsurePropList(bool force = false)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "VampireLike.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"VampireLike",
|
||||
"UnityGameFramework.Runtime",
|
||||
"UnityGameFramework.Editor"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b0d24fd3a44b6f45b3794cdfefd1ac0
|
||||
DefaultImporter:
|
||||
guid: 602d791ab1251f74ca2470c53bf382a3
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
+3
-10
@@ -1,19 +1,12 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using GameFramework;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Editor.ResourceTools;
|
||||
|
||||
namespace StarForce.Editor
|
||||
namespace VampireLike.Editor
|
||||
{
|
||||
public sealed class StarForceBuildEventHandler : IBuildEventHandler
|
||||
public sealed class VampireLikeBuildEventHandler : IBuildEventHandler
|
||||
{
|
||||
public bool ContinueOnFailure
|
||||
{
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64311189c3f9ae140b59a31db9831950
|
||||
timeCreated: 1528026151
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "VampireLike",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:363c5eb08ff8e6a439b85e37b8c20d96",
|
||||
"GUID:a2d8a19598eca814496b089021d08d60",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:e0cd26848372d4e5c891c569017e11f1",
|
||||
"GUID:2665a8d13d1b3f18800f46e256720795",
|
||||
"GUID:fca0f81bc71f1944887dd65f134c54a0"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0372088d74296e44c9eb9185a2d4021e
|
||||
DefaultImporter:
|
||||
guid: 47a82ffa13c291447ab895cd0bc251cd
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
+13
-4
@@ -390,7 +390,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11405216, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
|
||||
propertyPath: m_AvailableProcedureTypeNames.Array.size
|
||||
value: 12
|
||||
value: 13
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11405216, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
|
||||
propertyPath: m_AvailableProcedureTypeNames.Array.data[0]
|
||||
@@ -430,15 +430,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11405216, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
|
||||
propertyPath: m_AvailableProcedureTypeNames.Array.data[9]
|
||||
value: Procedure.ProcedureUpdateResources
|
||||
value: Procedure.ProcedureStressTest
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11405216, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
|
||||
propertyPath: m_AvailableProcedureTypeNames.Array.data[10]
|
||||
value: Procedure.ProcedureUpdateVersion
|
||||
value: Procedure.ProcedureUpdateResources
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11405216, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
|
||||
propertyPath: m_AvailableProcedureTypeNames.Array.data[11]
|
||||
value: Procedure.ProcedureVerifyResources
|
||||
value: Procedure.ProcedureUpdateVersion
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11405216, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
|
||||
propertyPath: m_AvailableProcedureTypeNames.Array.data[12]
|
||||
@@ -848,6 +848,15 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1d8ada5157a04921a6e543a040e57960, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_showBuffSection: 0
|
||||
_showBattleOverview: 0
|
||||
_showCollisionStats: 0
|
||||
_showSpawnControls: 1
|
||||
_showBattleDurationControls: 1
|
||||
_showSeparationSolverControls: 0
|
||||
_showPlayerWeaponControls: 1
|
||||
_showPlayerHealthControls: 1
|
||||
_showTips: 0
|
||||
--- !u!1 &513208572
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "DOTween.Modules"
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5e646a0b90b55940be09d61810d429d
|
||||
DefaultImporter:
|
||||
guid: fca0f81bc71f1944887dd65f134c54a0
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -49,6 +49,6 @@ MonoBehaviour:
|
||||
deAudioEnabled: 0
|
||||
deUnityExtendedEnabled: 0
|
||||
epoOutlineEnabled: 0
|
||||
createASMDEF: 0
|
||||
createASMDEF: 1
|
||||
showPlayingTweens: 0
|
||||
showPausedTweens: 0
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa53b8776f6a8ce4598fe035cb4356b8
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026174
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7d40db10aa401f4db624fec03b19854
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff394cf6a35932247b0649240bbbd5fc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b6ba43d50137a44a9cac13aee7c79b4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b692b20b915b5384bb238bbe1e86f6c8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa252b664de661c40bee3ddc89dfc7e0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccdf2a9817ba952488f12dadb5e278c6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74423cdaf48700645bc031c80e5b3fc7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,11 +1,26 @@
|
||||
{
|
||||
"name": "Simulation.EditModeTests",
|
||||
"references": [],
|
||||
"optionalUnityReferences": [
|
||||
"TestAssemblies"
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"UnityGameFramework.Runtime",
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"VampireLike"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": []
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"nunit.framework.dll",
|
||||
"GameFramework.dll"
|
||||
],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
using Procedure;
|
||||
using GameFramework.Fsm;
|
||||
using GameFramework.Procedure;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Simulation.Tests.Editor
|
||||
{
|
||||
public class SimulationWorldTickTests
|
||||
{
|
||||
private const string GameAssemblyName = "Assembly-CSharp";
|
||||
private const string GameAssemblyName = "VampireLike";
|
||||
private const string RuntimeAssemblyName = "UnityGameFramework.Runtime";
|
||||
private const BindingFlags PublicStatic = BindingFlags.Public | BindingFlags.Static;
|
||||
private const BindingFlags PublicInstance = BindingFlags.Public | BindingFlags.Instance;
|
||||
@@ -28,6 +31,9 @@ namespace Simulation.Tests.Editor
|
||||
private static readonly System.Type ProjectileSimDataType =
|
||||
System.Type.GetType($"Simulation.ProjectileSimData, {GameAssemblyName}");
|
||||
|
||||
private static readonly System.Type PickupSimDataType =
|
||||
System.Type.GetType($"Simulation.PickupSimData, {GameAssemblyName}");
|
||||
|
||||
private static readonly System.Type EnemyProjectileType =
|
||||
System.Type.GetType($"Entity.EnemyProjectile, {GameAssemblyName}");
|
||||
|
||||
@@ -88,6 +94,12 @@ namespace Simulation.Tests.Editor
|
||||
private static readonly MethodInfo RemoveProjectileByEntityIdMethod =
|
||||
SimulationWorldType?.GetMethod("RemoveProjectileByEntityId", NonPublicInstance);
|
||||
|
||||
private static readonly MethodInfo UpsertPickupMethod =
|
||||
SimulationWorldType?.GetMethod("UpsertPickup", NonPublicInstance);
|
||||
|
||||
private static readonly MethodInfo RemovePickupByEntityIdMethod =
|
||||
SimulationWorldType?.GetMethod("RemovePickupByEntityId", NonPublicInstance);
|
||||
|
||||
private static readonly MethodInfo TryGetEnemyDataMethod =
|
||||
SimulationWorldType?.GetMethod("TryGetEnemyData", NonPublicInstance);
|
||||
|
||||
@@ -124,6 +136,9 @@ namespace Simulation.Tests.Editor
|
||||
private static readonly PropertyInfo ProjectilesProperty =
|
||||
SimulationWorldType?.GetProperty("Projectiles", PublicInstance);
|
||||
|
||||
private static readonly PropertyInfo PickupsProperty =
|
||||
SimulationWorldType?.GetProperty("Pickups", PublicInstance);
|
||||
|
||||
private static readonly PropertyInfo CollisionCandidateCountProperty =
|
||||
SimulationWorldType?.GetProperty("CollisionCandidateCount", PublicInstance);
|
||||
|
||||
@@ -197,6 +212,7 @@ namespace Simulation.Tests.Editor
|
||||
Assert.NotNull(SimulationTickContextType, "SimulationTickContext type lookup failed.");
|
||||
Assert.NotNull(EnemySimDataType, "EnemySimData type lookup failed.");
|
||||
Assert.NotNull(ProjectileSimDataType, "ProjectileSimData type lookup failed.");
|
||||
Assert.NotNull(PickupSimDataType, "PickupSimData type lookup failed.");
|
||||
Assert.NotNull(EnemyProjectileType, "EnemyProjectile type lookup failed.");
|
||||
Assert.NotNull(EnemyProjectileDataType, "EnemyProjectileData type lookup failed.");
|
||||
Assert.NotNull(CampTypeType, "CampType type lookup failed.");
|
||||
@@ -217,6 +233,8 @@ namespace Simulation.Tests.Editor
|
||||
Assert.NotNull(RemoveEnemyByEntityIdMethod, "RemoveEnemyByEntityId reflection lookup failed.");
|
||||
Assert.NotNull(UpsertProjectileMethod, "UpsertProjectile reflection lookup failed.");
|
||||
Assert.NotNull(RemoveProjectileByEntityIdMethod, "RemoveProjectileByEntityId reflection lookup failed.");
|
||||
Assert.NotNull(UpsertPickupMethod, "UpsertPickup reflection lookup failed.");
|
||||
Assert.NotNull(RemovePickupByEntityIdMethod, "RemovePickupByEntityId reflection lookup failed.");
|
||||
Assert.NotNull(TryGetEnemyDataMethod, "TryGetEnemyData reflection lookup failed.");
|
||||
Assert.NotNull(TickMethod, "Tick reflection lookup failed.");
|
||||
Assert.NotNull(TryGetNearestEnemyEntityIdMethod, "TryGetNearestEnemyEntityId reflection lookup failed.");
|
||||
@@ -225,6 +243,7 @@ namespace Simulation.Tests.Editor
|
||||
Assert.NotNull(UseGridBucketSolverMethod, "UseGridBucketSolver reflection lookup failed.");
|
||||
Assert.NotNull(EnemiesProperty, "Enemies property reflection lookup failed.");
|
||||
Assert.NotNull(ProjectilesProperty, "Projectiles property reflection lookup failed.");
|
||||
Assert.NotNull(PickupsProperty, "Pickups property reflection lookup failed.");
|
||||
Assert.NotNull(CollisionCandidateCountProperty, "CollisionCandidateCount property reflection lookup failed.");
|
||||
Assert.NotNull(UseSimulationMovementProperty, "UseSimulationMovement property reflection lookup failed.");
|
||||
Assert.NotNull(UseSimulationMovementField, "_useSimulationMovement field reflection lookup failed.");
|
||||
@@ -710,6 +729,80 @@ namespace Simulation.Tests.Editor
|
||||
Assert.That(GetLastResolvedAreaHitCount(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ProcedureGame_TransitionsBattleToLevelUpShopAndBackToBattle()
|
||||
{
|
||||
var procedureGame = (ProcedureGame)Activator.CreateInstance(ProcedureGameType);
|
||||
GameObject playerObject = new GameObject("ProcedureGameTransitionPlayer");
|
||||
try
|
||||
{
|
||||
var player = playerObject.AddComponent(PlayerType);
|
||||
Assert.NotNull(player);
|
||||
PlayerType.GetProperty("PendingLevelPoints", PublicInstance)?.SetValue(player, 1);
|
||||
ProcedureGameType.GetField("Player", PublicInstance)?.SetValue(procedureGame, player);
|
||||
|
||||
var battleState = new TrackingGameState(GameStateType.Battle);
|
||||
var levelUpState = new TrackingGameState(GameStateType.LevelUp);
|
||||
var shopState = new TrackingGameState(GameStateType.Shop);
|
||||
var gameStates = new Dictionary<GameStateType, GameStateBase>
|
||||
{
|
||||
{ GameStateType.Battle, battleState },
|
||||
{ GameStateType.LevelUp, levelUpState },
|
||||
{ GameStateType.Shop, shopState },
|
||||
};
|
||||
|
||||
SetPrivateField(procedureGame, "_gameStates", gameStates);
|
||||
SetPrivateField(procedureGame, "_currentGameState", GameStateType.Battle);
|
||||
SetPrivateField(procedureGame, "_procedureOwner", null);
|
||||
|
||||
procedureGame.BattleToShopOrLevelUp();
|
||||
Assert.That(procedureGame.CurrentLevel, Is.EqualTo(2));
|
||||
Assert.That(procedureGame.CurrentGameStateType, Is.EqualTo(GameStateType.LevelUp));
|
||||
Assert.That(battleState.LeaveCount, Is.EqualTo(1));
|
||||
Assert.That(levelUpState.EnterCount, Is.EqualTo(1));
|
||||
|
||||
PlayerType.GetProperty("PendingLevelPoints", PublicInstance)?.SetValue(player, 0);
|
||||
procedureGame.LevelUpToShop();
|
||||
Assert.That(procedureGame.CurrentGameStateType, Is.EqualTo(GameStateType.Shop));
|
||||
Assert.That(levelUpState.LeaveCount, Is.EqualTo(1));
|
||||
Assert.That(shopState.EnterCount, Is.EqualTo(1));
|
||||
|
||||
procedureGame.ShopToBattle();
|
||||
Assert.That(procedureGame.CurrentGameStateType, Is.EqualTo(GameStateType.Battle));
|
||||
Assert.That(shopState.LeaveCount, Is.EqualTo(1));
|
||||
Assert.That(battleState.EnterCount, Is.EqualTo(1));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Object.DestroyImmediate(playerObject);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PickupLifecycle_UpsertAndRemove_KeepsBindingsConsistent()
|
||||
{
|
||||
UpsertPickup(CreatePickup(entityId: 6101, position: new Vector3(1f, 0f, 0f), pickupRadius: 0.35f, state: 0));
|
||||
UpsertPickup(CreatePickup(entityId: 6102, position: new Vector3(2f, 0f, 0f), pickupRadius: 0.35f, state: 0));
|
||||
UpsertPickup(CreatePickup(entityId: 6103, position: new Vector3(3f, 0f, 0f), pickupRadius: 0.35f, state: 0));
|
||||
|
||||
Assert.That(GetPickupsCount(), Is.EqualTo(3));
|
||||
|
||||
UpsertPickup(CreatePickup(entityId: 6101, position: new Vector3(10f, 0f, 0f), pickupRadius: 0.5f, state: 1));
|
||||
Assert.That(GetPickupsCount(), Is.EqualTo(3));
|
||||
object updatedPickup = GetPickupAt(0);
|
||||
Assert.That((int)GetField(updatedPickup, "EntityId"), Is.EqualTo(6101));
|
||||
Assert.That(((Vector3)GetField(updatedPickup, "Position")).x, Is.EqualTo(10f).Within(0.0001f));
|
||||
Assert.That((float)GetField(updatedPickup, "PickupRadius"), Is.EqualTo(0.5f).Within(0.0001f));
|
||||
|
||||
bool removedMiddle = RemovePickupByEntityId(6102);
|
||||
bool removedMoved = RemovePickupByEntityId(6103);
|
||||
|
||||
Assert.IsTrue(removedMiddle);
|
||||
Assert.That(GetPickupsCount(), Is.EqualTo(1));
|
||||
Assert.IsTrue(removedMoved);
|
||||
Assert.That((int)GetField(GetPickupAt(0), "EntityId"), Is.EqualTo(6101));
|
||||
}
|
||||
|
||||
private object CreateEnemy(int entityId, Vector3 position, float speed, float attackRange,
|
||||
bool avoidEnemyOverlap = false, float enemyBodyRadius = 0.45f, int separationIterations = 1)
|
||||
{
|
||||
@@ -746,6 +839,16 @@ namespace Simulation.Tests.Editor
|
||||
return projectile;
|
||||
}
|
||||
|
||||
private object CreatePickup(int entityId, Vector3 position, float pickupRadius, int state)
|
||||
{
|
||||
object pickup = Activator.CreateInstance(PickupSimDataType);
|
||||
SetField(ref pickup, "EntityId", entityId);
|
||||
SetField(ref pickup, "Position", position);
|
||||
SetField(ref pickup, "PickupRadius", pickupRadius);
|
||||
SetField(ref pickup, "State", state);
|
||||
return pickup;
|
||||
}
|
||||
|
||||
private void InvokeTick(float deltaTime, float realDeltaTime, Vector3 playerPosition)
|
||||
{
|
||||
object tickContext = System.Activator.CreateInstance(
|
||||
@@ -773,6 +876,11 @@ namespace Simulation.Tests.Editor
|
||||
UpsertProjectileMethod.Invoke(_worldComponent, new[] { projectile });
|
||||
}
|
||||
|
||||
private void UpsertPickup(object pickup)
|
||||
{
|
||||
UpsertPickupMethod.Invoke(_worldComponent, new[] { pickup });
|
||||
}
|
||||
|
||||
private bool RemoveEnemyByEntityId(int entityId)
|
||||
{
|
||||
return (bool)RemoveEnemyByEntityIdMethod.Invoke(_worldComponent, new object[] { entityId });
|
||||
@@ -783,6 +891,11 @@ namespace Simulation.Tests.Editor
|
||||
return (bool)RemoveProjectileByEntityIdMethod.Invoke(_worldComponent, new object[] { entityId });
|
||||
}
|
||||
|
||||
private bool RemovePickupByEntityId(int entityId)
|
||||
{
|
||||
return (bool)RemovePickupByEntityIdMethod.Invoke(_worldComponent, new object[] { entityId });
|
||||
}
|
||||
|
||||
private static object GetGameEntrySimulationWorld()
|
||||
{
|
||||
return GameEntryGetSimulationWorldMethod.Invoke(null, null);
|
||||
@@ -856,6 +969,20 @@ namespace Simulation.Tests.Editor
|
||||
return (int)countProperty.GetValue(projectiles);
|
||||
}
|
||||
|
||||
private object GetPickupAt(int index)
|
||||
{
|
||||
object pickups = PickupsProperty.GetValue(_worldComponent);
|
||||
PropertyInfo itemProperty = pickups.GetType().GetProperty("Item", PublicInstance);
|
||||
return itemProperty.GetValue(pickups, new object[] { index });
|
||||
}
|
||||
|
||||
private int GetPickupsCount()
|
||||
{
|
||||
object pickups = PickupsProperty.GetValue(_worldComponent);
|
||||
PropertyInfo countProperty = pickups.GetType().GetProperty("Count", PublicInstance);
|
||||
return (int)countProperty.GetValue(pickups);
|
||||
}
|
||||
|
||||
private int GetCollisionCandidateCount()
|
||||
{
|
||||
return (int)CollisionCandidateCountProperty.GetValue(_worldComponent);
|
||||
@@ -895,5 +1022,42 @@ namespace Simulation.Tests.Editor
|
||||
|
||||
Assert.Fail($"Field '{fieldName}' was not found on type '{target.GetType().FullName}'.");
|
||||
}
|
||||
|
||||
private sealed class TrackingGameState : GameStateBase
|
||||
{
|
||||
public TrackingGameState(GameStateType gameStateType)
|
||||
{
|
||||
GameStateType = gameStateType;
|
||||
}
|
||||
|
||||
public override GameStateType GameStateType { get; }
|
||||
|
||||
public int EnterCount { get; private set; }
|
||||
|
||||
public int LeaveCount { get; private set; }
|
||||
|
||||
public override void OnInit(ProcedureGame master)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnEnter(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
EnterCount++;
|
||||
}
|
||||
|
||||
public override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds,
|
||||
float realElapseSeconds)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnLeave(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
LeaveCount++;
|
||||
}
|
||||
|
||||
public override void OnDestroy(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
{
|
||||
"name": "Simulation.PlayModeTests",
|
||||
"references": [],
|
||||
"optionalUnityReferences": [
|
||||
"TestAssemblies"
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"UnityGameFramework.Runtime",
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"VampireLike"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": []
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"nunit.framework.dll",
|
||||
"GameFramework.dll"
|
||||
],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Simulation.Tests.PlayMode
|
||||
{
|
||||
public class SimulationWorldPlayModeTests
|
||||
{
|
||||
private const string GameAssemblyName = "Assembly-CSharp";
|
||||
private const string GameAssemblyName = "VampireLike";
|
||||
private const string RuntimeAssemblyName = "UnityGameFramework.Runtime";
|
||||
private const BindingFlags PublicStatic = BindingFlags.Public | BindingFlags.Static;
|
||||
private const BindingFlags PublicInstance = BindingFlags.Public | BindingFlags.Instance;
|
||||
|
||||
Reference in New Issue
Block a user