V3.3.7 转移SceneBlockPrefabSet
转移SceneBlockPrefabSet至Scene Start的StartSceneData中
This commit is contained in:
@@ -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"}}
|
||||
@@ -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"}}
|
||||
@@ -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"}}
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
+517
-514
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,7 +29,6 @@ public class EnemyContainer : MonoBehaviour
|
||||
// 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++)
|
||||
|
||||
@@ -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 @@ public class ParameterContainer : MonoBehaviour
|
||||
gotoLevelProbs = startSceneData.gotoLevelProbs;
|
||||
defenceProb = startSceneData.defenceProb;
|
||||
defenceLevelProbs = startSceneData.defenceLevelProbs;
|
||||
scenePrefabSet = startSceneData.scenePrefabSet;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
@@ -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 class SceneBlockContainer : MonoBehaviour
|
||||
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;
|
||||
|
||||
@@ -105,8 +105,8 @@ public class TargetController : MonoBehaviour
|
||||
|
||||
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 class TargetController : MonoBehaviour
|
||||
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 class TargetController : MonoBehaviour
|
||||
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 class TargetController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Free");
|
||||
Debug.Log("Free Mode Start");
|
||||
targetTypeInt = (int)Targets.Free;
|
||||
enemyCon.DestroyAllEnemys();
|
||||
enemyCon.RandomInitEnemys(hudCon.enemyNum);
|
||||
@@ -257,8 +257,8 @@ public class TargetController : MonoBehaviour
|
||||
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);
|
||||
|
||||
@@ -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 class MouseInMap : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
paramCon = parameterContainerObj.GetComponent<ParameterContainer>();
|
||||
groundMask = LayerMask.GetMask("Ground");
|
||||
targetCon = targetControllerObj.GetComponent<TargetController>();
|
||||
mousePreviewCon = mousePreviewObj.GetComponent<MousePreview>();
|
||||
@@ -137,7 +140,7 @@ public class MouseInMap : MonoBehaviour
|
||||
// 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 class MouseInMap : MonoBehaviour
|
||||
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 class MouseInMap : MonoBehaviour
|
||||
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;
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ using UnityEngine;
|
||||
/// </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 class SceneBlocksSet : ScriptableObject
|
||||
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 class SceneBlocksSet : ScriptableObject
|
||||
/// 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 class SceneBlocksSet : ScriptableObject
|
||||
new List<string> { messageBoxController.errorColor });
|
||||
break;
|
||||
}
|
||||
return levels[levelIndex];
|
||||
return targetLevels[levelIndex];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -127,13 +127,13 @@ public class SceneBlocksSet : ScriptableObject
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 @@ public class StartUIManager : MonoBehaviour
|
||||
sceneLoader = sceneLoaderObj.GetComponent<SceneLoader>();
|
||||
startSceneData = startSceneDataObj.GetComponent<StartSeneData>();
|
||||
buttonActivateColorChanger = GetComponent<ButtonActivateColorChanger>();
|
||||
startMenuProbabilityPanel = targetLevelProbabilityPanelOBJ.GetComponent<StartMenuProbabilityPanel>();
|
||||
messageTextObj.text = "";
|
||||
buttonActivateColorChanger.InitializeAllButtonColor();
|
||||
}
|
||||
@@ -48,17 +53,22 @@ public class StartUIManager : MonoBehaviour
|
||||
{
|
||||
// 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 @@ public class StartUIManager : MonoBehaviour
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using UnityEngine;
|
||||
/// 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;
|
||||
@@ -4,13 +4,15 @@ using UnityEngine;
|
||||
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>());
|
||||
|
||||
Reference in New Issue
Block a user