V3.4 追加Save Model按钮
追加Save Model按钮,对应按钮按下时显示message修改了font
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1cf9135c82794064587b2e47599b3340
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b289d6e0bb9f5e748a59028393bf427d
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- CaskaydiaCove Nerd Font
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07e34e9000492a2468743178b0960f4e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7938ed018a37ba0469a786e98be41b92
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Sarasa Mono J
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1704efe54f1ed2e4ebd76936eccbd58c
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03541a27e9f900640b076f7caa9c603e
|
||||
TrueTypeFontImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
fontSize: 16
|
||||
forceTextureCase: -2
|
||||
characterSpacing: 0
|
||||
characterPadding: 1
|
||||
includeFontData: 1
|
||||
fontNames:
|
||||
- Sarasa Gothic CL
|
||||
fallbackFontReferences: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
ascentCalculationMode: 1
|
||||
useLegacyBoundsCalculation: 0
|
||||
shouldRoundAdvanceValue: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1 +1 @@
|
||||
{"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"}}
|
||||
{"count":1,"self":10.2447512,"total":10.2987626,"children":{"InitializeActuators":{"count":2,"self":0.0009994,"total":0.0009994,"children":null},"InitializeSensors":{"count":2,"self":0.00099859999999999988,"total":0.00099859999999999988,"children":null},"AgentSendState":{"count":169,"self":0.0025004,"total":0.009501299999999999,"children":{"CollectObservations":{"count":169,"self":0.0050025999999999994,"total":0.0050025999999999994,"children":null},"WriteActionMask":{"count":169,"self":0.0004994,"total":0.0004994,"children":null},"RequestDecision":{"count":169,"self":0.0014988999999999998,"total":0.0014988999999999998,"children":null}}},"DecideAction":{"count":169,"self":0.0025041,"total":0.0025041,"children":null},"AgentAct":{"count":169,"self":0.0400077,"total":0.0400077,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1696963654","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 7c3dcd5a-daae-43b1-a2e8-4bb346bbb4e5 -accessToken G6W4ifPeN-JJvIEsustzRofGrXpwOepV108yPK_cjPA00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"StartScene","end_time_seconds":"1696963665"}}
|
||||
@@ -1 +1 @@
|
||||
{"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"}}
|
||||
{"count":1,"self":19.2906048,"total":19.4695413,"children":{"InitializeActuators":{"count":2,"self":0.0014994,"total":0.0014994,"children":null},"InitializeSensors":{"count":2,"self":0.00099779999999999986,"total":0.00099779999999999986,"children":null},"AgentSendState":{"count":727,"self":0.0050041,"total":0.033594399999999996,"children":{"CollectObservations":{"count":727,"self":0.0250634,"total":0.0250634,"children":null},"WriteActionMask":{"count":727,"self":0.0010282,"total":0.0010282,"children":null},"RequestDecision":{"count":727,"self":0.0024987,"total":0.0024987,"children":null}}},"DecideAction":{"count":727,"self":0.0056329,"total":0.0056329,"children":null},"AgentAct":{"count":727,"self":0.1362135,"total":0.1362135,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1697118015","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 7c3dcd5a-daae-43b1-a2e8-4bb346bbb4e5 -accessToken fDTPm6DDX6m8N5sHd6_icCP4xTShnR6KWHgyj4_SsR800ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Train","end_time_seconds":"1697118034"}}
|
||||
@@ -225,7 +225,7 @@ GameObject:
|
||||
- component: {fileID: 6351599098574612647}
|
||||
m_Layer: 0
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_TagString: Wall
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
|
||||
@@ -68,8 +68,8 @@ MonoBehaviour:
|
||||
m_Calls: []
|
||||
m_text: <color=red>New Text
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: f653ac5b85a721e4c9383008e6a565a7, type: 2}
|
||||
m_sharedMaterial: {fileID: -4662725986004701985, guid: f653ac5b85a721e4c9383008e6a565a7, type: 2}
|
||||
m_fontAsset: {fileID: 11400000, guid: 07e34e9000492a2468743178b0960f4e, type: 2}
|
||||
m_sharedMaterial: {fileID: -5512001432465614552, guid: 07e34e9000492a2468743178b0960f4e, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
|
||||
+636
-360
File diff suppressed because it is too large
Load Diff
+6
-1
@@ -2,7 +2,7 @@ using Unity.MLAgents;
|
||||
using Unity.MLAgents.SideChannels;
|
||||
using UnityEngine;
|
||||
|
||||
public class AimBotSideChennelController : MonoBehaviour
|
||||
public class AimBotSideChannelController : MonoBehaviour
|
||||
{
|
||||
public AimbotSideChannel aimbotSideChannel;
|
||||
|
||||
@@ -28,4 +28,9 @@ public class AimBotSideChennelController : MonoBehaviour
|
||||
SideChannelManager.UnregisterSideChannel(aimbotSideChannel);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendSideChannelMessage(string MessageType, string message)
|
||||
{
|
||||
Debug.LogWarning(MessageType + "|" + message);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea781484763623c438c1806e3a965667
|
||||
guid: 9585e6d628809d14ba93cb74005c3514
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -206,7 +206,7 @@ public class AgentController : MonoBehaviour
|
||||
lastShootTime = Time.time;
|
||||
if (Physics.Raycast(ray, out hit, 100))
|
||||
{
|
||||
if (hit.collider.tag != myTag && hit.collider.tag != "Wall")
|
||||
if (hit.collider.tag != myTag && hit.collider.tag != "Wall" && hit.collider.tag != "Untagged")
|
||||
{
|
||||
// kill enemy
|
||||
GameObject gotHitObj = hit.transform.gameObject;//获取受到Ray撞击的对象
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -6,13 +7,24 @@ using UnityEngine.UI;
|
||||
public class HUDController : MonoBehaviour
|
||||
{
|
||||
public bool chartOn = false;
|
||||
public GameObject sideChannelObj;
|
||||
public Toggle chartOnToggleObj;
|
||||
public Button saveModelButton;
|
||||
public TMP_InputField chartOnTimeOutInputObj;
|
||||
public TMP_InputField enemyNumInputObj;
|
||||
public float chartOnTimeOut = 1;
|
||||
public int enemyNum = 3;
|
||||
public float chartOnTimeOutDefault = 120f;
|
||||
|
||||
private float chatOntimeStart = 0;
|
||||
private AimBotSideChannelController sideChannelController;
|
||||
private MessageBoxController messageBox;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
sideChannelController = sideChannelObj.GetComponent<AimBotSideChannelController>();
|
||||
messageBox = gameObject.GetComponent<MessageBoxController>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
@@ -55,4 +67,11 @@ public class HUDController : MonoBehaviour
|
||||
chartOnTimeOut = chartOnTimeOutDefault;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSaveModelButtonPressed()
|
||||
{
|
||||
// Send message to python to save model
|
||||
sideChannelController.SendSideChannelMessage("Command", "SaveModel");
|
||||
messageBox.PushMessage(new List<string> { "☑Model Will be Saved In Next Train Episode:)" }, new List<string> { messageBox.goodColor });
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class MLAgentsCustomController : Agent
|
||||
public GameObject paramContainerObj;
|
||||
public GameObject targetControllerObj;
|
||||
public GameObject environmentUIObj;
|
||||
public GameObject sideChannelObj;
|
||||
public GameObject hudUIObj;
|
||||
|
||||
[Header("Env")]
|
||||
@@ -25,6 +26,7 @@ public class MLAgentsCustomController : Agent
|
||||
private TargetUIController targetUIController;
|
||||
private RaySensors raySensors;
|
||||
private MessageBoxController messageBoxController;
|
||||
private AimBotSideChannelController sideChannelController;
|
||||
|
||||
// observation
|
||||
private float[] myObserve = new float[4];
|
||||
@@ -50,6 +52,7 @@ public class MLAgentsCustomController : Agent
|
||||
hudController = hudUIObj.GetComponent<HUDController>();
|
||||
targetUIController = hudUIObj.GetComponent<TargetUIController>();
|
||||
messageBoxController = hudUIObj.GetComponent<MessageBoxController>();
|
||||
sideChannelController = sideChannelObj.GetComponent<AimBotSideChannelController>();
|
||||
}
|
||||
|
||||
#region On episode begin function
|
||||
@@ -175,14 +178,14 @@ public class MLAgentsCustomController : Agent
|
||||
switch (finishedState)
|
||||
{
|
||||
case (int)TargetController.EndType.Win:
|
||||
Debug.LogWarning("Result|" + targetString + "|Win");
|
||||
sideChannelController.SendSideChannelMessage("Result",targetString+ "|Win");
|
||||
messageBoxController.PushMessage(
|
||||
new List<string> { "Game Win" },
|
||||
new List<string> { "green" });
|
||||
break;
|
||||
|
||||
case (int)TargetController.EndType.Lose:
|
||||
Debug.LogWarning("Result|" + targetString + "|Lose");
|
||||
sideChannelController.SendSideChannelMessage("Result", targetString + "|Lose");
|
||||
messageBoxController.PushMessage(
|
||||
new List<string> { "Game Lose" },
|
||||
new List<string> { "red" });
|
||||
|
||||
@@ -8,6 +8,7 @@ public class MessageBoxController : MonoBehaviour
|
||||
public string defaultColor = "white";
|
||||
public string warningColor = "#ffa500ff";
|
||||
public string errorColor = "#800000ff";
|
||||
public string goodColor = "#00ff00ff";
|
||||
public GameObject messagePanelObj;
|
||||
public GameObject messageTextPrefab;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user