V3.3.7 转移SceneBlockPrefabSet

转移SceneBlockPrefabSet至Scene Start的StartSceneData中
This commit is contained in:
Koha9 2023-10-08 23:56:11 +09:00
parent 86e51f849f
commit 9219b3d0da
21 changed files with 714 additions and 637 deletions

View File

@ -1 +1 @@
{"count":1,"self":55.369945599999994,"total":55.896485899999995,"children":{"InitializeActuators":{"count":2,"self":0.0015002,"total":0.0015002,"children":null},"InitializeSensors":{"count":2,"self":0.0009996,"total":0.0009996,"children":null},"AgentSendState":{"count":2561,"self":0.013006199999999999,"total":0.0744512,"children":{"CollectObservations":{"count":2561,"self":0.050952,"total":0.050952,"children":null},"WriteActionMask":{"count":2561,"self":0.0019971999999999998,"total":0.0019971999999999998,"children":null},"RequestDecision":{"count":2561,"self":0.0084958,"total":0.0084958,"children":null}}},"DecideAction":{"count":2561,"self":0.0092719,"total":0.0092719,"children":null},"AgentAct":{"count":2561,"self":0.43981539999999997,"total":0.43981539999999997,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1694787686","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-VM5NSoJKZXjIkaU6OFyy0 -hubSessionId f1122d18-2ab0-4ade-9f39-17e4ff5d8154 -accessToken YKrI3UzHoKnMGcRQUR3Ubv1tFcBvt7w8ZSwL093jsTg00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Play","end_time_seconds":"1694787742"}}
{"count":1,"self":6.6978924,"total":6.7403838,"children":{"InitializeActuators":{"count":2,"self":0.002,"total":0.002,"children":null},"InitializeSensors":{"count":2,"self":0.001,"total":0.001,"children":null},"AgentSendState":{"count":96,"self":0.0014992999999999999,"total":0.010006899999999999,"children":{"CollectObservations":{"count":96,"self":0.0050103,"total":0.0050103,"children":null},"WriteActionMask":{"count":96,"self":0.0014992,"total":0.0014992,"children":null},"RequestDecision":{"count":96,"self":0.0019981,"total":0.0019981,"children":null}}},"DecideAction":{"count":96,"self":0.0029998,"total":0.0029998,"children":null},"AgentAct":{"count":96,"self":0.0259858,"total":0.0259858,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696776760","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-XEerV7kYNt9lW-ScfLTdo -hubSessionId d21180ac-2b2e-4464-bc29-90cd6d320fc3 -accessToken FUlk05mLlb2dcwVANd09HxpJmsCNwwFXO6GIY0FY5_c00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Play","end_time_seconds":"1696776767"}}

View File

@ -1 +1 @@
{"count":1,"self":7.6867775999999992,"total":7.7230661,"children":{"InitializeActuators":{"count":2,"self":0.0010014,"total":0.0010014,"children":null},"InitializeSensors":{"count":2,"self":0.0009991,"total":0.0009991,"children":null},"AgentSendState":{"count":133,"self":0.0034961999999999997,"total":0.0112705,"children":{"CollectObservations":{"count":133,"self":0.0063840999999999993,"total":0.0063840999999999993,"children":null},"WriteActionMask":{"count":133,"self":0,"total":0,"children":null},"RequestDecision":{"count":133,"self":0.0013901999999999999,"total":0.0013901999999999999,"children":null}}},"DecideAction":{"count":133,"self":0.0010008,"total":0.0010008,"children":null},"AgentAct":{"count":133,"self":0.022017099999999998,"total":0.022017099999999998,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696516721","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-q2quha7JFq52w-SUtj3vv -hubSessionId 61f6b54c-8d4c-45ec-a505-47188486c77c -accessToken QYTEq0ishS-kLjhfwMeB2jbrH3uriRLQpQBsjnaTMm000ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"StartScene","end_time_seconds":"1696516728"}}
{"count":1,"self":242.71572479999998,"total":242.7646804,"children":{"InitializeActuators":{"count":2,"self":0.0010002,"total":0.0010002,"children":null},"InitializeSensors":{"count":2,"self":0.0009999,"total":0.0009999,"children":null},"AgentSendState":{"count":177,"self":0.0019996,"total":0.0124999,"children":{"CollectObservations":{"count":177,"self":0.0084996,"total":0.0084996,"children":null},"WriteActionMask":{"count":177,"self":0.001001,"total":0.001001,"children":null},"RequestDecision":{"count":177,"self":0.00099969999999999985,"total":0.00099969999999999985,"children":null}}},"DecideAction":{"count":177,"self":0.00099739999999999985,"total":0.00099739999999999985,"children":null},"AgentAct":{"count":177,"self":0.033470099999999996,"total":0.033470099999999996,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696737503","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-UCUNI -hubSessionId f3a1d4a3-bb8f-4132-848c-8cb8ce38d7d8 -accessToken ECtl8ZuKWmUs4_h07-nVoxyegu8Z1a3dzsrR1UTfA9400ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"StartScene","end_time_seconds":"1696737746"}}

View File

@ -1 +1 @@
{"count":1,"self":6.9184632,"total":6.9552502,"children":{"InitializeActuators":{"count":2,"self":0.0010014,"total":0.0010014,"children":null},"InitializeSensors":{"count":2,"self":0.0009991,"total":0.0009991,"children":null},"AgentSendState":{"count":133,"self":0.0034961999999999997,"total":0.0112705,"children":{"CollectObservations":{"count":133,"self":0.0063840999999999993,"total":0.0063840999999999993,"children":null},"WriteActionMask":{"count":133,"self":0,"total":0,"children":null},"RequestDecision":{"count":133,"self":0.0013901999999999999,"total":0.0013901999999999999,"children":null}}},"DecideAction":{"count":133,"self":0.0010008,"total":0.0010008,"children":null},"AgentAct":{"count":133,"self":0.022017099999999998,"total":0.022017099999999998,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696516721","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-q2quha7JFq52w-SUtj3vv -hubSessionId 61f6b54c-8d4c-45ec-a505-47188486c77c -accessToken QYTEq0ishS-kLjhfwMeB2jbrH3uriRLQpQBsjnaTMm000ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Train","end_time_seconds":"1696516727"}}
{"count":1,"self":9.8612232,"total":9.95337,"children":{"InitializeActuators":{"count":2,"self":0.0015003,"total":0.0015003,"children":null},"InitializeSensors":{"count":2,"self":0.001501,"total":0.001501,"children":null},"AgentSendState":{"count":256,"self":0.0020004,"total":0.0179841,"children":{"CollectObservations":{"count":256,"self":0.013982099999999999,"total":0.013982099999999999,"children":null},"WriteActionMask":{"count":256,"self":0,"total":0,"children":null},"RequestDecision":{"count":256,"self":0.0020016,"total":0.0020016,"children":null}}},"DecideAction":{"count":256,"self":0.002499,"total":0.002499,"children":null},"AgentAct":{"count":256,"self":0.068162,"total":0.068162,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696754878","unity_version":"2021.3.14f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2021.3.14f1\\Editor\\Unity.exe -projectpath C:\\Users\\UCUNI\\OneDrive\\Unity\\ML-Agents\\Aimbot-ParallelEnv -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-UCUNI -hubSessionId f3a1d4a3-bb8f-4132-848c-8cb8ce38d7d8 -accessToken ECtl8ZuKWmUs4_h07-nVoxyegu8Z1a3dzsrR1UTfA9400ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Train","end_time_seconds":"1696754888"}}

View File

@ -344,6 +344,37 @@ MeshCollider:
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 0}
--- !u!1 &1191148229172999790
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9180676286359522096}
m_Layer: 0
m_Name: EnemyContainer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9180676286359522096
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1191148229172999790}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8016598964665260844}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8016598964375347507
GameObject:
m_ObjectHideFlags: 0
@ -487,6 +518,7 @@ Transform:
m_Children:
- {fileID: 8016598964375347506}
- {fileID: 5048110598405218928}
- {fileID: 9180676286359522096}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c9ed942e5125e924fad7c8ebd13a79f9, type: 3}
m_Name: Scene Blocks Set
m_EditorClassIdentifier:
levels:
targetLevels:
- {fileID: 11400000, guid: e9f031290ad88b1479c80e7adfd6d5fd, type: 2}
- {fileID: 11400000, guid: bf3f37e7f498fad4d8640226f4b70374, type: 2}
targets: 0100000002000000

File diff suppressed because it is too large Load Diff

View File

@ -492,7 +492,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
singleTargetLevelProbabilityPanel: {fileID: 5589415219770305710, guid: 324d8e84c24cdd04ba087763705db1d0, type: 3}
scenePrefabSet: {fileID: 11400000, guid: 6ebbd27eb466c4a41bd2584c1b9c2e1f, type: 2}
startSceneData: {fileID: 1072325866}
targetLevelProbabilityPanel: []
--- !u!1 &294404779
GameObject:
m_ObjectHideFlags: 0
@ -2073,6 +2074,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
gameMode: 0
scenePrefabSet: {fileID: 11400000, guid: 6ebbd27eb466c4a41bd2584c1b9c2e1f, type: 2}
attackProb: 0
attackLevelProbs: []
gotoProb: 0
@ -2622,6 +2624,7 @@ MonoBehaviour:
waitTimeLimit: 45
sceneLoaderObj: {fileID: 1206568295}
startSceneDataObj: {fileID: 1072325866}
targetLevelProbabilityPanelOBJ: {fileID: 237721381}
messageTextObj: {fileID: 294404781}
waitTimeTextObj: {fileID: 431112176}
--- !u!114 &1432557594

View File

@ -6969,6 +6969,7 @@ MonoBehaviour:
attackWinReward: 50
defenceWinReward: 50
freeWinReward: 50
scenePrefabSet: {fileID: 0}
--- !u!4 &707336052
Transform:
m_ObjectHideFlags: 0
@ -11125,7 +11126,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0.000030517578, y: -246.2022}
m_AnchoredPosition: {x: 0.000030517578, y: -246.20206}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1442113294
@ -14263,8 +14264,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
sceneSize: 10
environmentObj: {fileID: 749443372}
parameterContainerObj: {fileID: 707336050}
hudObj: {fileID: 2082200184}
scenePrefabSet: {fileID: 11400000, guid: 6ebbd27eb466c4a41bd2584c1b9c2e1f, type: 2}
nowBlock: {fileID: 0}
--- !u!1 &1815066823
GameObject:
@ -18543,10 +18544,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
gameMode: 0
attackProb: 0.3333333
scenePrefabSet: {fileID: 11400000, guid: 6ebbd27eb466c4a41bd2584c1b9c2e1f, type: 2}
attackProb: 1
attackLevelProbs:
- 1
gotoProb: 0.33333334
gotoProb: 0
gotoLevelProbs:
- 0.2
- 0.2

View File

@ -29,7 +29,6 @@ public void RandomInitEnemys(int EnemyNum)
// initialize enemy by random but not in block area
public void RandomInitEnemysExcept(int enemyNum, Vector3 blockPosition, float sceneSize)
{
Debug.Log("RandomInitEnemysExcept");
float randX = 0f;
float randZ = 0f;
for (int i = 0; i < enemyNum; i++)

View File

@ -130,6 +130,9 @@ public class ParameterContainer : MonoBehaviour
[Tooltip("free Win reward")]
public float freeWinReward = 50.0f;
[Tooltip("Scene Prefab Set")]
public SceneBlocksSet scenePrefabSet;
private float targetTimeBonus = 0f;
private float areaTimeBonus = 0f;
private float freeTimeBonus = 0f;
@ -175,6 +178,7 @@ private void Start()
gotoLevelProbs = startSceneData.gotoLevelProbs;
defenceProb = startSceneData.defenceProb;
defenceLevelProbs = startSceneData.defenceLevelProbs;
scenePrefabSet = startSceneData.scenePrefabSet;
}
private void Update()

View File

@ -4,20 +4,20 @@ public class SceneBlockContainer : MonoBehaviour
{
public float sceneSize = 10f;
public GameObject environmentObj;
public GameObject parameterContainerObj;
public GameObject hudObj;
// public GameObject[] attackBlockPrefabs = new GameObject[1];
// public GameObject[] goBlockPrefabs = new GameObject[1];
// public GameObject[] defencePrefabs = new GameObject[1];
public SceneBlocksSet scenePrefabSet;
private GameObject nowBlockObj;
public SceneBlock nowBlock;
private GameObject nowBlockObj;
private ParameterContainer paramCon;
private void Start()
{
// initialize scene prefab set
scenePrefabSet.InitializeSceneBlocksSet(hudObj);
paramCon = parameterContainerObj.GetComponent<ParameterContainer>();
}
/// <summary>
@ -40,7 +40,7 @@ public void CreateNewBlock(Targets targetType, int level, int blockType, Vector3
DestroyBlock();
}
// choose target type
nowBlockObj = Instantiate(scenePrefabSet.GetPrefab(level, blockType, targetType), blockPosition + environmentObj.transform.position, Quaternion.identity, transform);
nowBlockObj = Instantiate(paramCon.scenePrefabSet.GetPrefab(level, blockType, targetType), blockPosition + environmentObj.transform.position, Quaternion.identity, transform);
nowBlock = nowBlockObj.GetComponent<SceneBlock>();
nowBlock.group1Tag = tag1;
nowBlock.group2Tag = tag2;

View File

@ -105,8 +105,8 @@ private void Start()
freeProb = 1 - attackProb - gotoProb - defenceProb;
targetNum = (int)Targets.Num;
gotoLevelNum = sceneBlockCon.scenePrefabSet.GetLevelNumber(Targets.Go);
attackLevelNum = sceneBlockCon.scenePrefabSet.GetLevelNumber(Targets.Attack);
gotoLevelNum = paramCon.scenePrefabSet.GetLevelNumber(Targets.Go);
attackLevelNum = paramCon.scenePrefabSet.GetLevelNumber(Targets.Attack);
if (freeProb < 0)
{
Debug.LogError("TargetController.Start: target percentage wrong");
@ -166,7 +166,7 @@ public void RollNewScene()
else if (randTargetType > gotoProb && randTargetType <= gotoProb + attackProb)
{
// attack target spawn
Debug.Log("ATTACK!");
Debug.Log("ATTACK Mode Start");
targetTypeInt = (int)Targets.Attack;
RandomSpawnSceneBlock(Targets.Attack);
// set startDistance
@ -176,7 +176,7 @@ public void RollNewScene()
else if (randTargetType > gotoProb + attackProb && randTargetType <= gotoProb + attackProb + defenceProb)
{
// defence target spawn
Debug.Log("DEFENCE!");
Debug.Log("DEFENCE Mode Start");
targetTypeInt = (int)Targets.Defence;
RandomSpawnSceneBlock(Targets.Defence);
// set startDistance
@ -184,7 +184,7 @@ public void RollNewScene()
}
else
{
Debug.Log("Free");
Debug.Log("Free Mode Start");
targetTypeInt = (int)Targets.Free;
enemyCon.DestroyAllEnemys();
enemyCon.RandomInitEnemys(hudCon.enemyNum);
@ -257,8 +257,8 @@ public void MoveAgentTo(Vector3 position)
private void RandomSpawnSceneBlock(Targets targetType)
{
randLevel = RollRandomLevelIndex(targetType);
randBlockType = Random.Range(0, sceneBlockCon.scenePrefabSet.GetBlockNumber(randLevel,targetType));
sceneBlockSize = sceneBlockCon.scenePrefabSet.GetBlockSize(randLevel, randBlockType, targetType);
randBlockType = Random.Range(0, paramCon.scenePrefabSet.GetBlockNumber(randLevel,targetType));
sceneBlockSize = paramCon.scenePrefabSet.GetBlockSize(randLevel, randBlockType, targetType);
float randX = UnityEngine.Random.Range(minEnemyAreaX + sceneBlockSize / 2 + 1f, maxEnemyAreaX - sceneBlockSize / 2 - 1f);
float randZ = UnityEngine.Random.Range(minEnemyAreaZ + sceneBlockSize / 2 + 1f, maxEnemyAreaZ - sceneBlockSize / 2 - 1f);

View File

@ -13,12 +13,14 @@ public class MouseInMap : MonoBehaviour
public GameObject enemyContainerObj;
public GameObject sceneBlockContainerObj;
public GameObject targetControllerObj;
public GameObject parameterContainerObj;
public GameObject HUDObj;
private Vector3 nowHitPosition = Vector3.zero;
private Vector3 nowHitPositionRelative = Vector3.zero;
private LayerMask groundMask;
private int blockNum;
private ParameterContainer paramCon;
private GameObject previewModel;
private TargetController targetCon;
private MousePreview mousePreviewCon;
@ -45,6 +47,7 @@ public enum MouseMode
private void Start()
{
paramCon = parameterContainerObj.GetComponent<ParameterContainer>();
groundMask = LayerMask.GetMask("Ground");
targetCon = targetControllerObj.GetComponent<TargetController>();
mousePreviewCon = mousePreviewObj.GetComponent<MousePreview>();
@ -137,7 +140,7 @@ public void ChangeMouseMode(MouseMode mouseMode, int level = -1, int blockNum =
// while blockLevel is not set, send error message
messageCon.PushMessage(new List<string> { "[ERROR]MouseInMap:ChangeMouseMode:", "Level not set!", "mouseMode=", mouseMode.ToString() },
new List<string> { messageCon.errorColor });
blockLevel = sceneBlockCon.scenePrefabSet.GetLevelNumber(nowTargetType);
blockLevel = paramCon.scenePrefabSet.GetLevelNumber(nowTargetType);
}
else
{
@ -149,7 +152,7 @@ public void ChangeMouseMode(MouseMode mouseMode, int level = -1, int blockNum =
if (blockNum < 0)
{
// while blockNum is not set, random choose block type
this.blockNum = Random.Range(0, sceneBlockCon.scenePrefabSet.GetBlockNumber(blockLevel, nowTargetType));
this.blockNum = Random.Range(0, paramCon.scenePrefabSet.GetBlockNumber(blockLevel, nowTargetType));
}
else
{
@ -157,7 +160,7 @@ public void ChangeMouseMode(MouseMode mouseMode, int level = -1, int blockNum =
this.blockNum = blockNum;
}
// set previewModel
previewModel = sceneBlockCon.scenePrefabSet.GetPrefab(blockLevel, this.blockNum, nowTargetType);
previewModel = paramCon.scenePrefabSet.GetPrefab(blockLevel, this.blockNum, nowTargetType);
mousePreviewCon.ChangePreviewTo(previewModel);
break;

View File

@ -7,12 +7,12 @@
/// </summary>
/// <remarks>
/// This class is responsible for organizing and initializing different sets of scene blocks,
/// which include levels, blocks, and their associated properties.
/// which include targetLevels, blocks, and their associated properties.
/// </remarks>
[CreateAssetMenu(menuName = "All Scene Prefab Set")]
public class SceneBlocksSet : ScriptableObject
{
public LevelsSet[] levels = new LevelsSet[3];
public TargetLevelsSet[] targetLevels = new TargetLevelsSet[3];
public Targets[] targets = new Targets[3];
private GameObject hudObj;
@ -31,10 +31,10 @@ public void InitializeSceneBlocksSet(GameObject hudObj = null)
this.hudObj = hudObj;
messageBoxController = this.hudObj.GetComponent<MessageBoxController>();
}
for (int i = 0; i < levels.Length; i++)
for (int i = 0; i < targetLevels.Length; i++)
{
// initialize all level prefab set
levels[i].InitializeLevelsSet();
targetLevels[i].InitializeLevelsSet();
}
}
@ -48,7 +48,7 @@ public void InitializeSceneBlocksSet(GameObject hudObj = null)
/// If the target type (targetType) or index (index) is provided, it returns the corresponding level prefab set.
/// If neither the target type (targetType) nor the index (index) is provided, an exception will be thrown, and an error message will be logged.
/// </remarks>
public LevelsSet GetAllLevlePrefabSet(Targets? targetType = null, int? index = null)
public TargetLevelsSet GetAllLevlePrefabSet(Targets? targetType = null, int? index = null)
{
if (targetType == null && index == null)
{
@ -76,7 +76,7 @@ public LevelsSet GetAllLevlePrefabSet(Targets? targetType = null, int? index = n
new List<string> { messageBoxController.errorColor });
break;
}
return levels[levelIndex];
return targetLevels[levelIndex];
}
/// <summary>
@ -127,13 +127,13 @@ public GameObject GetPrefab(int level, int blockType, Targets? targetType = null
}
/// <summary>
/// Gets the number of levels for a specific target type and index.
/// Gets the number of targetLevels for a specific target type and index.
/// </summary>
/// <param name="targetType">The target type (optional).</param>
/// <param name="index">The index (optional).</param>
/// <returns>The number of levels.</returns>
/// <returns>The number of targetLevels.</returns>
/// <remarks>
/// If the target type (targetType) or index (index) is provided, it returns the number of levels for the corresponding target type and index.
/// If the target type (targetType) or index (index) is provided, it returns the number of targetLevels for the corresponding target type and index.
/// </remarks>
public int GetLevelNumber(Targets? targetType = null, int? index = null)
{

View File

@ -5,6 +5,9 @@ public class StartSeneData : MonoBehaviour
{
[Header("Game mode")]
public int gameMode = 0;// default trainning mode
[Header("ScenePrefabSet")]
public SceneBlocksSet scenePrefabSet;
[Header("Targets Prob")]
public float attackProb = 0f;
public List<float> attackLevelProbs = new List<float>();
@ -13,6 +16,13 @@ public class StartSeneData : MonoBehaviour
public float defenceProb = 0f;
public List<float> defenceLevelProbs = new List<float>();
private void Start()
{
scenePrefabSet.InitializeSceneBlocksSet();
attackLevelProbs = new List<float>(scenePrefabSet.targetLevels[0].levelSize);
gotoLevelProbs = new List<float>(scenePrefabSet.targetLevels[1].levelSize);
}
void Awake()
{
DontDestroyOnLoad(transform.gameObject);

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
@ -7,11 +8,14 @@ public class StartUIManager : MonoBehaviour
public int waitTimeLimit = 45;
public GameObject sceneLoaderObj;
public GameObject startSceneDataObj;
public GameObject targetLevelProbabilityPanelOBJ;
public TextMeshProUGUI messageTextObj;
public TextMeshProUGUI waitTimeTextObj;
private SceneLoader sceneLoader;
private StartSeneData startSceneData;
private ButtonActivateColorChanger buttonActivateColorChanger;
private StartMenuProbabilityPanel startMenuProbabilityPanel;
private float startTime;
private float nowTime;
// Start is called before the first frame update
@ -20,6 +24,7 @@ void Start()
sceneLoader = sceneLoaderObj.GetComponent<SceneLoader>();
startSceneData = startSceneDataObj.GetComponent<StartSeneData>();
buttonActivateColorChanger = GetComponent<ButtonActivateColorChanger>();
startMenuProbabilityPanel = targetLevelProbabilityPanelOBJ.GetComponent<StartMenuProbabilityPanel>();
messageTextObj.text = "";
buttonActivateColorChanger.InitializeAllButtonColor();
}
@ -48,17 +53,22 @@ public void OnAttackTrainButtonPressed()
{
// while Train-Attack-Button Pressed
startSceneData.attackProb = 1f;
ApplicateProbabilityToData();
LoadTrainScene();
}
public void OnGotoTrainButtonPressed()
{
// while Train-Goto-Button Pressed
startSceneData.gotoProb = 1f;
ApplicateProbabilityToData();
LoadTrainScene();
}
public void OnFreeTrainButtonPressed()
{
// while Train-Free-Button Pressed
startSceneData.attackProb = 0f;
startSceneData.gotoProb = 0f;
startSceneData.defenceProb = 0f;
LoadTrainScene();
}
public void OnMixTrainButtonPressed()
@ -74,7 +84,16 @@ private void LoadTrainScene()
sceneLoader.LoadGameScene(SceneLoader.SceneType.Train);
messageTextObj.text = "Loading Train Scene...";
}
}
private void ApplicateProbabilityToData()
{
for (int i = 0; i < startSceneData.scenePrefabSet.targetLevels[0].levelSize; i++)
{
startSceneData.gotoLevelProbs.Add(startMenuProbabilityPanel.targetLevelProbabilityPanel[0].singleLevelPanels[i].ProbabilityValue);
}
for(int i = 0; i < startSceneData.scenePrefabSet.targetLevels[1].levelSize; i++)
{
startSceneData.attackLevelProbs.Add(startMenuProbabilityPanel.targetLevelProbabilityPanel[1].singleLevelPanels[i].ProbabilityValue);
}
}
}

View File

@ -8,7 +8,7 @@
/// This class is used to organize and initialize multiple level prefab sets.
/// </remarks>
[CreateAssetMenu(menuName = "All Level Prefab Set")]
public class LevelsSet : ScriptableObject
public class TargetLevelsSet : ScriptableObject
{
public BlocksSet[] singleLevelSet;
[NonSerialized] public int levelSize = 0;

View File

@ -4,13 +4,15 @@
public class StartMenuProbabilityPanel : MonoBehaviour
{
public GameObject singleTargetLevelProbabilityPanel;
public SceneBlocksSet scenePrefabSet;
public GameObject startSceneData;
private SceneBlocksSet scenePrefabSet;
private List<TargetLevelProbabilityPanel> targetLevelProbabilityPanel = new List<TargetLevelProbabilityPanel>();
public List<TargetLevelProbabilityPanel> targetLevelProbabilityPanel = new List<TargetLevelProbabilityPanel>();
private void Start()
{
for (int i = 0; i < scenePrefabSet.levels.Length; i++)
scenePrefabSet = startSceneData.GetComponent<StartSeneData>().scenePrefabSet;
for (int i = 0; i < scenePrefabSet.targetLevels.Length; i++)
{
Targets nowTarget = scenePrefabSet.targets[i];
targetLevelProbabilityPanel.Add(Instantiate(singleTargetLevelProbabilityPanel, transform).GetComponent<TargetLevelProbabilityPanel>());

View File

@ -9,13 +9,13 @@ EditorUserSettings:
value: 55090405535008090b5608764626074415151c79747c74602b7c1861e4b96c6c
flags: 0
RecentlyUsedSceneGuid-1:
value: 06570c0704040b0e5a575520137b5e44154f192e292d22367c2c4866b7b3376f
value: 5703025650035e5d090f087148715d4443161e2c7e2c20357b281b31b0e43060
flags: 0
RecentlyUsedSceneGuid-2:
value: 5453565f53020f085f5d0e72157a0844454f4c2b757d7265757a4f64b7b4313c
value: 06570c0704040b0e5a575520137b5e44154f192e292d22367c2c4866b7b3376f
flags: 0
RecentlyUsedSceneGuid-3:
value: 5703025650035e5d090f087148715d4443161e2c7e2c20357b281b31b0e43060
value: 5453565f53020f085f5d0e72157a0844454f4c2b757d7265757a4f64b7b4313c
flags: 0
RecentlyUsedScenePath-0:
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d

View File

@ -14,9 +14,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_PixelRect:
serializedVersion: 2
x: -217
y: 233
width: 1855
x: -185
y: 187
width: 1792
height: 1037
m_ShowMode: 4
m_Title: Game
@ -44,7 +44,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1855
width: 1792
height: 1037
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
@ -69,7 +69,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1855
width: 1792
height: 30
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
@ -91,7 +91,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 1017
width: 1855
width: 1792
height: 20
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
@ -115,12 +115,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 30
width: 1855
width: 1792
height: 987
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 119
controlID: 120
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@ -140,12 +140,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1047
width: 1083
height: 987
m_MinSize: {x: 100, y: 200}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 120
controlID: 121
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@ -163,8 +163,8 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1047
height: 615
width: 1083
height: 608
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 13}
@ -189,9 +189,9 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 615
width: 1047
height: 372
y: 608
width: 1083
height: 379
m_MinSize: {x: 231, y: 271}
m_MaxSize: {x: 10001, y: 10021}
m_ActualView: {fileID: 15}
@ -217,14 +217,14 @@ MonoBehaviour:
- {fileID: 11}
m_Position:
serializedVersion: 2
x: 1047
x: 1083
y: 0
width: 434
width: 348
height: 987
m_MinSize: {x: 100, y: 200}
m_MaxSize: {x: 8096, y: 16192}
vertical: 1
controlID: 52
controlID: 101
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
@ -242,8 +242,8 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 434
height: 443
width: 348
height: 276
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 17}
@ -267,9 +267,9 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 443
width: 434
height: 544
y: 276
width: 348
height: 711
m_MinSize: {x: 102, y: 121}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 18}
@ -293,9 +293,9 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 1481
x: 1431
y: 0
width: 374
width: 361
height: 987
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
@ -324,10 +324,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: -217
y: 263
width: 1046
height: 594
x: -185
y: 217
width: 1082
height: 587
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -562,9 +562,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 224.20319, y: 389.57086, z: -1.7488194}
m_Target: {x: 560, y: 288.25, z: -2.5}
speed: 2
m_Value: {x: 224.20319, y: 389.57086, z: -1.7488194}
m_Value: {x: 560, y: 288.25, z: -2.5}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -615,9 +615,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 500.2853
m_Target: 629.8764
speed: 2
m_Value: 500.2853
m_Value: 629.8764
m_Ortho:
m_Target: 1
speed: 2
@ -635,7 +635,7 @@ MonoBehaviour:
m_FarClip: 10000
m_DynamicClip: 1
m_OcclusionCulling: 0
m_LastSceneViewRotation: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226}
m_LastSceneViewRotation: {x: 0.012911308, y: -0.85104775, z: 0.5244944, w: 0.020943936}
m_LastSceneViewOrtho: 0
m_ReplacementShader: {fileID: 0}
m_ReplacementString:
@ -662,10 +662,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1920
x: 65
y: 73
width: 1083
height: 594
width: 1120
height: 587
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -676,7 +676,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1083, y: 573}
m_TargetSize: {x: 1120, y: 566}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@ -691,10 +691,10 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -541.5
m_HBaseRangeMax: 541.5
m_VBaseRangeMin: -286.5
m_VBaseRangeMax: 286.5
m_HBaseRangeMin: -560
m_HBaseRangeMax: 560
m_VBaseRangeMin: -283
m_VBaseRangeMax: 283
m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1
@ -712,23 +712,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 1083
height: 573
width: 1120
height: 566
m_Scale: {x: 1, y: 1}
m_Translation: {x: 541.5, y: 286.5}
m_Translation: {x: 560, y: 283}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -541.5
y: -286.5
width: 1083
height: 573
x: -560
y: -283
width: 1120
height: 566
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 1083, y: 594}
m_LastWindowPixelSize: {x: 1120, y: 587}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
@ -754,10 +754,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: -217
y: 878
width: 1046
height: 351
x: -185
y: 825
width: 1082
height: 358
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -775,22 +775,22 @@ MonoBehaviour:
m_SkipHidden: 0
m_SearchArea: 1
m_Folders:
- Assets/Script
- Assets/Shader
m_Globs: []
m_OriginalText:
m_ViewMode: 1
m_StartGridSize: 16
m_LastFolders:
- Assets/DelthorGames/AKM/Models
- Assets/Shader
m_LastFoldersGridSize: 16
m_LastProjectPath: C:\Users\UCUNI\OneDrive\Unity\ML-Agents\Aimbot-ParallelEnv
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 06ca9a3b
m_LastClickedID: 1000000006
m_ExpandedIDs: 000000002c7600002e76000030760000327600003476000036760000387600003a7600003c7600003e76000040760000427600004476000046760000487600004a7600004c7600004e7600005076000000ca9a3bffffff7f
scrollPos: {x: 0, y: 302}
m_SelectedIDs: 9c760000
m_LastClickedID: 30364
m_ExpandedIDs: 000000002c7600002e76000030760000327600003476000036760000387600003a7600003c7600003e76000040760000427600004476000046760000487600004a7600004c7600004e760000507600008876000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -849,18 +849,18 @@ MonoBehaviour:
m_ExpandedInstanceIDs: c62300008a5c000000000000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
m_OriginalName:
m_Name: Level-0
m_OriginalName: Level-0
m_EditFieldRect:
serializedVersion: 2
x: 0
y: 0
width: 0
height: 0
m_UserData: 0
m_UserData: 34140
m_IsWaitingForDelay: 0
m_IsRenaming: 0
m_OriginalEventType: 11
m_OriginalEventType: 0
m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 8}
m_CreateAssetUtility:
@ -922,20 +922,20 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 830
y: 263
width: 432
height: 422
x: 1
y: 19
width: 346
height: 255
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 36250000
m_LastClickedID: 0
m_ExpandedIDs: 32fbffff
scrollPos: {x: 0, y: 118}
m_SelectedIDs: bca00000
m_LastClickedID: 41148
m_ExpandedIDs: 6c73ffff7274ffff40a7ffff92d9ffffdcdcffff32fbfffff4ffffff6c810000fa83000098930000dea00000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -979,10 +979,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 830
y: 706
width: 432
height: 523
x: 1
y: 295
width: 346
height: 690
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -1035,9 +1035,9 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1264
y: 263
width: 373
x: 1432
y: 19
width: 360
height: 966
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: