V3.2.1 向InGameMessageBox添加颜色功能 整理代码
V3.2.1 向InGameMessageBox添加颜色功能 整理代码
This commit is contained in:
parent
709f7cf9d3
commit
3381c83604
@ -1 +1 @@
|
||||
{"count":1,"self":17.432375999999998,"total":17.601931399999998,"children":{"InitializeActuators":{"count":2,"self":0.0014985999999999999,"total":0.0014985999999999999,"children":null},"InitializeSensors":{"count":2,"self":0.0010000999999999999,"total":0.0010000999999999999,"children":null},"AgentSendState":{"count":649,"self":0.0039967,"total":0.027996999999999998,"children":{"CollectObservations":{"count":649,"self":0.0195028,"total":0.0195028,"children":null},"WriteActionMask":{"count":649,"self":0.0010004999999999999,"total":0.0010004999999999999,"children":null},"RequestDecision":{"count":649,"self":0.0034969999999999997,"total":0.0034969999999999997,"children":null}}},"DecideAction":{"count":649,"self":0.0049997999999999996,"total":0.0049997999999999996,"children":null},"AgentAct":{"count":649,"self":0.1315598,"total":0.1315598,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1691511445","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 7a25a02a-ac39-4928-b96b-8b55c0718304 -accessToken VfIHxMjB35w5fMmo90NJJ3FYRsNmtt785aeyJrUBNSY00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Play","end_time_seconds":"1691511463"}}
|
||||
{"count":1,"self":12.547696799999999,"total":12.6451887,"children":{"InitializeActuators":{"count":2,"self":0.0010000999999999999,"total":0.0010000999999999999,"children":null},"InitializeSensors":{"count":2,"self":0.0010008,"total":0.0010008,"children":null},"AgentSendState":{"count":405,"self":0.0054938999999999995,"total":0.0224981,"children":{"CollectObservations":{"count":405,"self":0.014002599999999999,"total":0.014002599999999999,"children":null},"WriteActionMask":{"count":405,"self":0.0004999,"total":0.0004999,"children":null},"RequestDecision":{"count":405,"self":0.0025017,"total":0.0025017,"children":null}}},"DecideAction":{"count":405,"self":0.0020003,"total":0.0020003,"children":null},"AgentAct":{"count":405,"self":0.0699914,"total":0.0699914,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1692078727","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 a91c3aeb-d04f-45af-8b4f-7a795a141598 -accessToken KyeiQM8GLhjyRyJ8iW1LoNnCDKwS-XarlYBS2WW5veM00ef","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Play","end_time_seconds":"1692078740"}}
|
@ -4,6 +4,8 @@
|
||||
|
||||
public class MessageBoxController : MonoBehaviour
|
||||
{
|
||||
public int maxMessageNum = 50;
|
||||
public string defaultColor = "white";
|
||||
public GameObject messagePanelObj;
|
||||
public GameObject messageTextPrefab;
|
||||
|
||||
@ -12,6 +14,8 @@ public class MessageBoxController : MonoBehaviour
|
||||
|
||||
public void PushMessage(string text)
|
||||
{
|
||||
// push simple message to message list
|
||||
MessageOverflowHandler();
|
||||
Message newMessage = new Message();
|
||||
newMessage.text = text;
|
||||
|
||||
@ -22,10 +26,55 @@ public void PushMessage(string text)
|
||||
messages.Add(newMessage);
|
||||
}
|
||||
|
||||
// push multi color message to message list
|
||||
public void PushMessage(List<string> messageList,List<string> colorList)
|
||||
{
|
||||
// check messages and colors list length match
|
||||
if (messageList.Count != colorList.Count)
|
||||
{
|
||||
// delete extra messages or add white color to extra messages
|
||||
if (messageList.Count > colorList.Count)
|
||||
{
|
||||
for (int i = 0; i < messageList.Count - colorList.Count; i++)
|
||||
{
|
||||
colorList.Add(defaultColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colorList.RemoveRange(messageList.Count, colorList.Count - messageList.Count);
|
||||
}
|
||||
|
||||
}
|
||||
MessageOverflowHandler();
|
||||
Message newMessage = new Message();
|
||||
newMessage.text = "";
|
||||
// assemble message text with color
|
||||
for (int i = 0; i < messageList.Count; i++)
|
||||
{
|
||||
newMessage.text += "<color=" + colorList[i] + ">" + messageList[i] + "</color>";
|
||||
}
|
||||
GameObject newText = Instantiate(messageTextPrefab, messagePanelObj.transform);
|
||||
newMessage.textObject = newText.GetComponent<TextMeshProUGUI>();
|
||||
newMessage.textObject.text = newMessage.text;
|
||||
|
||||
messages.Add(newMessage);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Message
|
||||
{
|
||||
public string text;
|
||||
public TMPro.TextMeshProUGUI textObject;
|
||||
}
|
||||
|
||||
private void MessageOverflowHandler()
|
||||
{
|
||||
// destroy the oldest message if message list is full
|
||||
if (messages.Count >= maxMessageNum)
|
||||
{
|
||||
Destroy(messages[0].textObject.gameObject);
|
||||
messages.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ GameObject:
|
||||
- component: {fileID: 8689853706318896445}
|
||||
- component: {fileID: 6514250983489383611}
|
||||
m_Layer: 5
|
||||
m_Name: Message
|
||||
m_Name: SingleMessage
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -66,7 +66,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: New Text
|
||||
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}
|
@ -2891,7 +2891,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.20216}
|
||||
m_AnchoredPosition: {x: 0.000030517578, y: -246.2022}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!114 &324069808
|
||||
@ -7700,6 +7700,7 @@ MonoBehaviour:
|
||||
targetConObj: {fileID: 1692325237}
|
||||
blockConObj: {fileID: 1811162388}
|
||||
agentObj: {fileID: 629870337}
|
||||
hudObj: {fileID: 2082200184}
|
||||
lockMouse: 0
|
||||
damage: 50
|
||||
fireRate: 0.5
|
||||
@ -19851,6 +19852,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0d0b754dfadef484bbd36745abf1d796, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
maxMessageNum: 50
|
||||
messagePanelObj: {fileID: 324069806}
|
||||
messageTextPrefab: {fileID: 7800828413105135976, guid: bdd79ceda95d4bd44a402c80049df6e8, type: 3}
|
||||
messages: []
|
||||
|
@ -12803,6 +12803,43 @@ Transform:
|
||||
m_Father: {fileID: 647052302}
|
||||
m_RootOrder: 9
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &436500461
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 436500462}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &436500462
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 436500461}
|
||||
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:
|
||||
- {fileID: 1766662801}
|
||||
m_Father: {fileID: 1929752912}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &437578562
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -26319,6 +26356,43 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 853664540}
|
||||
m_Mesh: {fileID: -3139941974747981782, guid: 99fcce1f10b2ebd4a8cd31a345f6bed8, type: 3}
|
||||
--- !u!1 &855565252
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 855565253}
|
||||
m_Layer: 5
|
||||
m_Name: MessageBox
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &855565253
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 855565252}
|
||||
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:
|
||||
- {fileID: 1815066824}
|
||||
m_Father: {fileID: 2082200189}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &861779682
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -40303,6 +40377,97 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1435664621}
|
||||
m_Mesh: {fileID: -8211673063228289779, guid: 99fcce1f10b2ebd4a8cd31a345f6bed8, type: 3}
|
||||
--- !u!1 &1437402752
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1437402753}
|
||||
- component: {fileID: 1437402756}
|
||||
- component: {fileID: 1437402755}
|
||||
- component: {fileID: 1437402754}
|
||||
m_Layer: 5
|
||||
m_Name: Viewport
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1437402753
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1437402752}
|
||||
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:
|
||||
- {fileID: 1442113293}
|
||||
m_Father: {fileID: 1815066824}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &1437402754
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1437402752}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 0
|
||||
--- !u!114 &1437402755
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1437402752}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: d29a01ced066fbe4f8366788af0ecb1a, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1437402756
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1437402752}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1437859567
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -40609,6 +40774,84 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &1442113292
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1442113293}
|
||||
- component: {fileID: 1442113295}
|
||||
- component: {fileID: 1442113294}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1442113293
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1442113292}
|
||||
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: 1437402753}
|
||||
m_RootOrder: 0
|
||||
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.2021}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!114 &1442113294
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1442113292}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!114 &1442113295
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1442113292}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 7
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &1447300215
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -50331,6 +50574,82 @@ Transform:
|
||||
m_Father: {fileID: 2020368924}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1766662800
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1766662801}
|
||||
- component: {fileID: 1766662803}
|
||||
- component: {fileID: 1766662802}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1766662801
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1766662800}
|
||||
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: 436500462}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1766662802
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1766662800}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1766662803
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1766662800}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1769313426
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -52029,6 +52348,115 @@ MonoBehaviour:
|
||||
- {fileID: 8846414053615828488, guid: 2f053dfedc7fd534d8ef4ed4015edecd, type: 3}
|
||||
- {fileID: 3752399968333756393, guid: ab266ed339e7ab14f93d93b70ca3b843, type: 3}
|
||||
thisBlock: {fileID: 0}
|
||||
--- !u!1 &1815066823
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1815066824}
|
||||
- component: {fileID: 1815066827}
|
||||
- component: {fileID: 1815066826}
|
||||
- component: {fileID: 1815066825}
|
||||
m_Layer: 5
|
||||
m_Name: Scroll View
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1815066824
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1815066823}
|
||||
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:
|
||||
- {fileID: 1437402753}
|
||||
- {fileID: 1929752912}
|
||||
m_Father: {fileID: 855565253}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -314.48853, y: 123.10107}
|
||||
m_SizeDelta: {x: 628.9771, y: 246.2022}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1815066825
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1815066823}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 1442113293}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 1437402753}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 1929752913}
|
||||
m_HorizontalScrollbarVisibility: 2
|
||||
m_VerticalScrollbarVisibility: 2
|
||||
m_HorizontalScrollbarSpacing: -3
|
||||
m_VerticalScrollbarSpacing: -3
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &1815066826
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1815066823}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.21960786, g: 0.21960786, b: 0.21960786, a: 0.392}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1815066827
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1815066823}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1817420688
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -55359,6 +55787,133 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1928735334}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1929752911
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1929752912}
|
||||
- component: {fileID: 1929752915}
|
||||
- component: {fileID: 1929752914}
|
||||
- component: {fileID: 1929752913}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar Vertical
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1929752912
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1929752911}
|
||||
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:
|
||||
- {fileID: 436500462}
|
||||
m_Father: {fileID: 1815066824}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 14.8297, y: 0}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &1929752913
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1929752911}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1766662802}
|
||||
m_HandleRect: {fileID: 1766662801}
|
||||
m_Direction: 2
|
||||
m_Value: 0
|
||||
m_Size: 0.9998682
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &1929752914
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1929752911}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &1929752915
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1929752911}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1931616809
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -59840,6 +60395,7 @@ GameObject:
|
||||
- component: {fileID: 2082200187}
|
||||
- component: {fileID: 2082200186}
|
||||
- component: {fileID: 2082200185}
|
||||
- component: {fileID: 2082200190}
|
||||
m_Layer: 5
|
||||
m_Name: HUD
|
||||
m_TagString: Untagged
|
||||
@ -59942,6 +60498,7 @@ RectTransform:
|
||||
- {fileID: 269417899}
|
||||
- {fileID: 149218410}
|
||||
- {fileID: 427803070}
|
||||
- {fileID: 855565253}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -59950,6 +60507,21 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!114 &2082200190
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2082200184}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0d0b754dfadef484bbd36745abf1d796, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
messagePanelObj: {fileID: 1442113292}
|
||||
messageTextPrefab: {fileID: 7800828413105135976, guid: bdd79ceda95d4bd44a402c80049df6e8, type: 3}
|
||||
messages: []
|
||||
--- !u!1 &2093738323
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -73,8 +73,8 @@ private void Start()
|
||||
myTag = gameObject.tag;
|
||||
}
|
||||
|
||||
// ------------动作处理--------------
|
||||
// moveAgent 用于模拟Input.GetAxis移动
|
||||
#region Agent Move Control
|
||||
|
||||
public void MoveAgent(int vertical, int horizontal)
|
||||
{
|
||||
// Vector3 thisMovement;
|
||||
@ -149,8 +149,10 @@ public void MoveAgent(int vertical, int horizontal)
|
||||
// update Key Viewer
|
||||
}
|
||||
|
||||
// ------------动作处理--------------
|
||||
// cameraControl 用于控制Agent视角转动
|
||||
#endregion Agent Move Control
|
||||
|
||||
#region Camera Control
|
||||
|
||||
public void CameraControl(float Mouse_X, float Mouse_Y)
|
||||
{
|
||||
//Mouse_X = Input.GetAxis("Mouse X") * MouseSensitivity * Time.deltaTime;
|
||||
@ -187,12 +189,9 @@ public void CameraControl(float Mouse_X, float Mouse_Y)
|
||||
//且绕轴旋转的坐标轴是父节点本地坐标系的坐标轴
|
||||
}
|
||||
|
||||
// GotKill 获得击杀时用于被呼出
|
||||
public void KillRecord(Vector3 thiskillEnemyPosition)
|
||||
{
|
||||
enemyKillCount += 1;
|
||||
killEnemyPosition = thiskillEnemyPosition;
|
||||
}
|
||||
#endregion Camera Control
|
||||
|
||||
#region Reward Functions
|
||||
|
||||
// ballistic 射击弹道处理,并返回获得reward
|
||||
private float Ballistic(int shootState)
|
||||
@ -330,8 +329,6 @@ private float FacingReward()
|
||||
return thisReward;
|
||||
}
|
||||
|
||||
// ------------Reward--------------
|
||||
// rewardCalculate 计算本动作的Reward
|
||||
public float RewardCalculate(float sceneReward, float mouseX, float movement, int shootState)
|
||||
{
|
||||
float epreward = 0f;
|
||||
@ -377,6 +374,15 @@ public float RewardCalculate(float sceneReward, float mouseX, float movement, in
|
||||
return epreward;
|
||||
}
|
||||
|
||||
#endregion Reward Functions
|
||||
|
||||
// GotKill 获得击杀时用于被呼出
|
||||
public void KillRecord(Vector3 thiskillEnemyPosition)
|
||||
{
|
||||
enemyKillCount += 1;
|
||||
killEnemyPosition = thiskillEnemyPosition;
|
||||
}
|
||||
|
||||
public void UpdateLockMouse()
|
||||
{
|
||||
// lock mouse based on paramContainer lockMouse
|
||||
|
@ -1,643 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.MLAgents;
|
||||
using Unity.MLAgents.Actuators;
|
||||
using Unity.MLAgents.Sensors;
|
||||
using UnityEngine;
|
||||
|
||||
/*TODO:
|
||||
√tag 攻击排他
|
||||
√通用HP 系统
|
||||
环境tag修正?
|
||||
以tag重置环境修正
|
||||
Agent死亡时待机处理*/
|
||||
|
||||
public class AgentWithGun : Agent
|
||||
{
|
||||
public GameObject parameterContainerObj;
|
||||
public GameObject environmentObj;
|
||||
public GameObject enemyContainerObj;
|
||||
public GameObject sceneBlockContainerObj;
|
||||
public GameObject environmentUIControlObj;
|
||||
public GameObject targetControllerObj;
|
||||
public GameObject HUDObj;
|
||||
public Camera thisCam;
|
||||
|
||||
[Header("GetAxis() Simulate")]
|
||||
public float moveSpeed = 9.0f;
|
||||
|
||||
public float vX = 0f;
|
||||
public float vZ = 0f;
|
||||
public Vector3 thisMovement;
|
||||
public float acceleration = 0.1f; // 加速度
|
||||
public float mouseXSensitivity = 100;
|
||||
public float mouseYSensitivity = 200;
|
||||
public float yRotation = 0.1f;//定义一个浮点类型的量,记录‘围绕’X轴旋转的角度
|
||||
|
||||
[Header("Env")]
|
||||
public bool oneHotRayTag = true;
|
||||
|
||||
private List<float> spinRecord = new List<float>();
|
||||
private bool lockMouse;
|
||||
private float damage;
|
||||
private float fireRate;
|
||||
private int enemyNum;
|
||||
private bool lockCameraX;
|
||||
private bool lockCameraY;
|
||||
|
||||
// environment
|
||||
private int shoot = 0;
|
||||
|
||||
private float lastShootTime = 0.0f;
|
||||
private int enemyKillCount = 0;
|
||||
private Vector3 killEnemyPosition;
|
||||
private int step = 0;
|
||||
private int EP = 0;
|
||||
public bool defaultTPCamera = true;
|
||||
private bool gunReadyToggle = true;
|
||||
private string myTag = "";
|
||||
private float lastEnemyFacingDistance = 0f; // record last enemy facing minimum distance
|
||||
private float lastTargetFacingDistance = 0f; // record last target facing minimum distance
|
||||
|
||||
// scripts
|
||||
private RaySensors raySensors;
|
||||
|
||||
private CharacterController playerController;
|
||||
private EnvironmentUIControl envUICon;
|
||||
private ParameterContainer paramContainer;
|
||||
private SceneBlockContainer blockContainer;
|
||||
private EnemyContainer eneContainer;
|
||||
private TargetController targetCon;
|
||||
private HUDController hudController;
|
||||
private StartSeneData startSceneData;
|
||||
|
||||
// observation
|
||||
private float[] myObserve = new float[4];
|
||||
|
||||
private float[] rayTagResult;
|
||||
private float[] rayTagResultOnehot;
|
||||
private float[] rayDisResult;
|
||||
private float[] targetStates;
|
||||
private float remainTime;
|
||||
private float inAreaState;
|
||||
|
||||
[System.NonSerialized] public int finishedState;
|
||||
|
||||
// start scene datas 0=train 1=play
|
||||
private int gameMode;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// initialize scripts
|
||||
paramContainer = parameterContainerObj.GetComponent<ParameterContainer>();
|
||||
eneContainer = enemyContainerObj.GetComponent<EnemyContainer>();
|
||||
blockContainer = sceneBlockContainerObj.GetComponent<SceneBlockContainer>();
|
||||
envUICon = environmentUIControlObj.GetComponent<EnvironmentUIControl>();
|
||||
targetCon = targetControllerObj.GetComponent<TargetController>();
|
||||
hudController = HUDObj.GetComponent<HUDController>();
|
||||
raySensors = GetComponent<RaySensors>();
|
||||
playerController = this.transform.GetComponent<CharacterController>();
|
||||
|
||||
// initialize gamemode from PrameterContainer
|
||||
gameMode = paramContainer.gameMode;
|
||||
|
||||
// initialize Environment parameters
|
||||
lockMouse = paramContainer.lockMouse;
|
||||
damage = paramContainer.damage;
|
||||
fireRate = paramContainer.fireRate;
|
||||
enemyNum = hudController.enemyNum;
|
||||
lockCameraX = paramContainer.lockCameraX;
|
||||
lockCameraY = paramContainer.lockCameraY;
|
||||
|
||||
// initialize remainTime
|
||||
// this agent's tag
|
||||
myTag = gameObject.tag;
|
||||
}
|
||||
|
||||
// ------------动作处理--------------
|
||||
// moveAgent 用于模拟Input.GetAxis移动
|
||||
public void MoveAgent(int vertical, int horizontal)
|
||||
{
|
||||
// Vector3 thisMovement;
|
||||
|
||||
if (horizontal != 0)//当按下按键(水平方向)
|
||||
{
|
||||
if (vX < moveSpeed && vX > -moveSpeed)//当前速度小于最大速度
|
||||
{
|
||||
vX += (float)horizontal * acceleration;//增加加速度
|
||||
}
|
||||
else
|
||||
{
|
||||
//防止在一瞬间切换输入时速度仍保持不变
|
||||
if ((vX * horizontal) > 0)//输入与当前速度方向同向
|
||||
{
|
||||
vX = (float)horizontal * moveSpeed; //限制最大速度
|
||||
}
|
||||
else
|
||||
{
|
||||
vX += (float)horizontal * acceleration;//增加加速度
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Abs(vX) > 0.001)
|
||||
{
|
||||
vX -= (vX / Math.Abs(vX)) * acceleration;//减少加速度
|
||||
}
|
||||
else
|
||||
{
|
||||
vX = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (vertical != 0)//当按下按键(垂直方向)
|
||||
{
|
||||
if (vZ < moveSpeed && vZ > -moveSpeed)//当前速度小于最大速度
|
||||
{
|
||||
vZ += (float)vertical * acceleration;//增加加速度
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((vZ * vertical) > 0)//输入与当前速度方向同向
|
||||
{
|
||||
vZ = (float)vertical * moveSpeed; //限制最大速度
|
||||
}
|
||||
else
|
||||
{
|
||||
vZ += (float)vertical * acceleration;//增加加速度
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Abs(vZ) > 0.001)
|
||||
{
|
||||
vZ -= (vZ / Math.Abs(vZ)) * acceleration;//减少加速度
|
||||
}
|
||||
else
|
||||
{
|
||||
vZ = 0;
|
||||
}
|
||||
}
|
||||
thisMovement = (transform.forward * vZ + transform.right * vX);
|
||||
//PlayerController下的.Move为实现物体运动的函数
|
||||
//Move()括号内放入一个Vector3类型的量,本例中为Player_Move
|
||||
if (thisMovement.magnitude > moveSpeed)
|
||||
{
|
||||
thisMovement = thisMovement.normalized * moveSpeed;
|
||||
}
|
||||
playerController.Move(thisMovement * Time.deltaTime);
|
||||
// update Key Viewer
|
||||
}
|
||||
|
||||
// ------------动作处理--------------
|
||||
// cameraControl 用于控制Agent视角转动
|
||||
public void CameraControl(float Mouse_X, float Mouse_Y)
|
||||
{
|
||||
//Mouse_X = Input.GetAxis("Mouse X") * MouseSensitivity * Time.deltaTime;
|
||||
//Debug.Log(Input.GetAxis("Mouse X"));
|
||||
//Mouse_Y = Input.GetAxis("Mouse Y") * MouseSensitivity * Time.deltaTime;
|
||||
if (lockCameraX)
|
||||
{
|
||||
Mouse_X = 0;
|
||||
}
|
||||
if (lockCameraY)
|
||||
{
|
||||
Mouse_Y = 0;
|
||||
}
|
||||
yRotation = yRotation - Mouse_Y;
|
||||
//xRotation值为正时,屏幕下移,当xRotation值为负时,屏幕上移
|
||||
//当鼠标向上滑动,Mouse_Y值为正,xRotation-Mouse_Y的值为负,xRotation总的值为负,屏幕视角向上滑动
|
||||
//当鼠标向下滑动,Mouse_Y值为负,xRotation-Mouse_Y的值为正,xRotation总的值为正,屏幕视角向下滑动
|
||||
//简单来说就是要控制鼠标滑动的方向与屏幕移动的方向要相同
|
||||
|
||||
//limit UP DOWN between -90 -> 90
|
||||
yRotation = Mathf.Clamp(yRotation, -90f, 90f);
|
||||
|
||||
//相机左右旋转时,是以Y轴为中心旋转的,上下旋转时,是以X轴为中心旋转的
|
||||
transform.Rotate(Vector3.up * Mouse_X);
|
||||
//Vector3.up相当于Vector3(0,1,0),CameraRotation.Rotate(Vector3.up * Mouse_X)相当于使CameraRotation对象绕y轴旋转Mouse_X个单位
|
||||
//即相机左右旋转时,是以Y轴为中心旋转的,此时Mouse_X控制着值的大小
|
||||
|
||||
//相机在上下旋转移动时,相机方向不会随着移动,类似于低头和抬头,左右移动时,相机方向会随着向左向右移动,类似于向左向右看
|
||||
//所以在控制相机向左向右旋转时,要保证和父物体一起转动
|
||||
thisCam.transform.localRotation = Quaternion.Euler(yRotation, 0, 0);
|
||||
//this.transform指这个CameraRotation的位置,localRotation指的是旋转轴
|
||||
//transform.localRotation = Quaternion.Eular(x,y,z)控制旋转的时候,按照X-Y-Z轴的旋转顺规
|
||||
//即以围绕X轴旋转x度,围绕Y轴旋转y度,围绕Z轴旋转z度
|
||||
//且绕轴旋转的坐标轴是父节点本地坐标系的坐标轴
|
||||
}
|
||||
|
||||
// GotKill 获得击杀时用于被呼出
|
||||
public void KillRecord(Vector3 thiskillEnemyPosition)
|
||||
{
|
||||
enemyKillCount += 1;
|
||||
killEnemyPosition = thiskillEnemyPosition;
|
||||
}
|
||||
|
||||
// check gun is ready to shoot
|
||||
private bool GunReady()
|
||||
{
|
||||
if ((Time.time - lastShootTime) >= fireRate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ballistic 射击弹道处理,并返回获得reward
|
||||
private float Ballistic()
|
||||
{
|
||||
Vector3 point = new Vector3(thisCam.pixelWidth / 2, thisCam.pixelHeight / 2, 0);//发射位置
|
||||
Ray ray = thisCam.ScreenPointToRay(point);
|
||||
RaycastHit hit;
|
||||
// Debug.DrawRay(ray.origin, ray.direction * 100, Color.blue);
|
||||
//按下鼠标左键
|
||||
if (shoot != 0 && gunReadyToggle == true)
|
||||
{
|
||||
lastShootTime = Time.time;
|
||||
if (Physics.Raycast(ray, out hit, 100))
|
||||
{
|
||||
if (hit.collider.tag != myTag && hit.collider.tag != "Wall")
|
||||
{
|
||||
// kill enemy
|
||||
GameObject gotHitObj = hit.transform.gameObject;//获取受到Ray撞击的对象
|
||||
gotHitObj.GetComponent<States>().ReactToHit(damage, gameObject);
|
||||
shoot = 0;
|
||||
return targetCon.HitEnemyReward(gotHitObj.transform.position);
|
||||
}
|
||||
}
|
||||
if (targetCon.targetTypeInt == (int)SceneBlockContainer.Targets.Attack)
|
||||
{
|
||||
// while if attack mode
|
||||
float targetDis = Vector3.Distance(blockContainer.thisBlock.transform.position, transform.position);
|
||||
if (targetDis <= raySensors.viewDistance)
|
||||
{
|
||||
// Debug.DrawRay(new Vector3(0,0,0), viewPoint, Color.red);
|
||||
if (Vector3.Distance(ray.origin + (ray.direction * targetDis), blockContainer.thisBlock.transform.position) <= blockContainer.thisBlock.firebasesAreaDiameter / 2)
|
||||
{
|
||||
// im shooting at target but didn't hit enemy
|
||||
// Debug.DrawRay(ray.origin, viewPoint-ray.origin, Color.blue);
|
||||
return paramContainer.shootTargetAreaReward;
|
||||
}
|
||||
}
|
||||
}
|
||||
shoot = 0;
|
||||
return paramContainer.shootReward;
|
||||
}
|
||||
else if (shoot != 0 && gunReadyToggle == false)
|
||||
{
|
||||
// shoot without ready
|
||||
shoot = 0;
|
||||
return paramContainer.shootWithoutReadyReward;
|
||||
}
|
||||
else
|
||||
{
|
||||
// do not shoot
|
||||
shoot = 0;
|
||||
return paramContainer.nonReward;
|
||||
}
|
||||
}
|
||||
|
||||
private float FacingReward()
|
||||
{
|
||||
float thisReward = 0;
|
||||
bool isFacingtoEnemy = false;
|
||||
float enemyFacingDistance = 0f;
|
||||
Ray ray = thisCam.ScreenPointToRay(new Vector3(thisCam.pixelWidth / 2, thisCam.pixelHeight / 2, 0));
|
||||
if (targetCon.targetTypeInt == (int)SceneBlockContainer.Targets.Free)
|
||||
{
|
||||
//free mode
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit, 100))
|
||||
{
|
||||
// facing to an enemy
|
||||
if (hit.collider.tag != myTag && hit.collider.tag != "Wall")
|
||||
{
|
||||
thisReward = paramContainer.facingReward;
|
||||
isFacingtoEnemy = true;
|
||||
}
|
||||
}
|
||||
if (raySensors.inViewEnemies.Count > 0 && !isFacingtoEnemy)
|
||||
{
|
||||
// have enemy in view
|
||||
List<float> projectionDis = new List<float>();
|
||||
foreach (GameObject thisEnemy in raySensors.inViewEnemies)
|
||||
{
|
||||
// for each enemy in view
|
||||
Vector3 projection = Vector3.Project(thisEnemy.transform.position - transform.position, (ray.direction * 10));
|
||||
Vector3 verticalToRay = transform.position + projection - thisEnemy.transform.position;
|
||||
projectionDis.Add(verticalToRay.magnitude);
|
||||
// Debug.Log("enemy!" + verticalToRay.magnitude);
|
||||
// Debug.DrawRay(transform.position, (ray.direction * 100), Color.cyan);
|
||||
// Debug.DrawRay(transform.position, thisEnemy.transform.position - transform.position, Color.yellow);
|
||||
// Debug.DrawRay(transform.position, projection, Color.blue);
|
||||
// Debug.DrawRay(thisEnemy.transform.position, verticalToRay, Color.magenta);
|
||||
}
|
||||
enemyFacingDistance = projectionDis.Min();
|
||||
if (enemyFacingDistance <= lastEnemyFacingDistance)
|
||||
{
|
||||
// closing to enemy
|
||||
thisReward = 1 / MathF.Sqrt(paramContainer.facingInviewEnemyDisCOEF * enemyFacingDistance + 0.00001f);
|
||||
}
|
||||
else
|
||||
{
|
||||
thisReward = 0;
|
||||
}
|
||||
// enemy in view Reward
|
||||
lastEnemyFacingDistance = enemyFacingDistance;
|
||||
if (thisReward >= paramContainer.facingReward) thisReward = paramContainer.facingReward; // limit
|
||||
if (thisReward <= -paramContainer.facingReward) thisReward = -paramContainer.facingReward; // limit
|
||||
// Debug.Log("ninimum = " + thisReward);
|
||||
}
|
||||
}
|
||||
else if (targetCon.targetTypeInt == (int)SceneBlockContainer.Targets.Attack)
|
||||
{
|
||||
// attack mode
|
||||
// Target to Agent distance
|
||||
float targetDis = Vector3.Distance(blockContainer.thisBlock.transform.position, transform.position);
|
||||
// center of screen between target's distance
|
||||
float camCenterToTarget = Vector3.Distance(ray.origin + (ray.direction * targetDis), blockContainer.thisBlock.transform.position);
|
||||
if (targetDis <= raySensors.viewDistance)
|
||||
{
|
||||
// Debug.DrawRay(new Vector3(0,0,0), viewPoint, Color.red);
|
||||
// while center of screen between target's distance is lower than firebasesAreaDiameter
|
||||
// while facing to target
|
||||
if (camCenterToTarget <= blockContainer.thisBlock.firebasesAreaDiameter / 2)
|
||||
{
|
||||
// Debug.DrawRay(ray.origin, viewPoint-ray.origin, Color.blue);
|
||||
|
||||
thisReward = paramContainer.facingReward;
|
||||
}
|
||||
else
|
||||
{
|
||||
// while not facing to target
|
||||
thisReward = (lastTargetFacingDistance - camCenterToTarget) * paramContainer.facingTargetReward;
|
||||
}
|
||||
}
|
||||
// update lastTargetFacingDistance
|
||||
lastTargetFacingDistance = camCenterToTarget;
|
||||
}
|
||||
return thisReward;
|
||||
}
|
||||
|
||||
// ------------Reward--------------
|
||||
// rewardCalculate 计算本动作的Reward
|
||||
public float RewardCalculate(float sceneReward, float mouseX, float movement)
|
||||
{
|
||||
float epreward = 0f;
|
||||
// 击杀reward判断
|
||||
if (enemyKillCount > 0)
|
||||
{
|
||||
for (int i = 0; i < enemyKillCount; i++)
|
||||
{
|
||||
// get
|
||||
epreward += targetCon.KillReward(killEnemyPosition);
|
||||
}
|
||||
enemyKillCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
enemyKillCount = 0;
|
||||
}
|
||||
// 射击动作reward判断
|
||||
epreward += Ballistic() + sceneReward;
|
||||
// facing reward
|
||||
epreward += FacingReward();
|
||||
// Penalty
|
||||
// spin penalty
|
||||
spinRecord.Add(mouseX);
|
||||
if (spinRecord.Count >= paramContainer.spinRecordMax)
|
||||
{
|
||||
spinRecord.RemoveAt(0);
|
||||
}
|
||||
float spinPenaltyReward = Math.Abs(spinRecord.ToArray().Sum() * paramContainer.spinPenalty);
|
||||
if (spinPenaltyReward >= paramContainer.spinPenaltyThreshold)
|
||||
{
|
||||
epreward -= spinPenaltyReward;
|
||||
}
|
||||
else
|
||||
{
|
||||
epreward -= Math.Abs(mouseX) * paramContainer.mousePenalty;
|
||||
}
|
||||
// move penalty
|
||||
if (movement != 0)
|
||||
{
|
||||
epreward -= paramContainer.movePenalty;
|
||||
}
|
||||
return epreward;
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// env开始执行初始化
|
||||
public override void OnEpisodeBegin()
|
||||
{
|
||||
Debug.LogWarning("GameState|START TEST!");
|
||||
step = 0;
|
||||
if (lockMouse)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked; // hide and lock the mouse
|
||||
}
|
||||
paramContainer.ResetTimeBonusReward();
|
||||
//thisAgentObj.name = thisAgentObj.GetInstanceID().ToString();
|
||||
if (gameMode == 0)
|
||||
{
|
||||
// train mode
|
||||
targetCon.RollNewScene();
|
||||
}
|
||||
else
|
||||
{
|
||||
// play mode
|
||||
targetCon.PlayInitialize();
|
||||
}
|
||||
|
||||
// give default Reward to Reward value will be used.
|
||||
if (hudController.chartOn)
|
||||
{
|
||||
envUICon.InitChart();
|
||||
}
|
||||
raySensors.UpdateRayInfo(); // update raycast
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// 观察情报
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
{
|
||||
//List<float> enemyLDisList = RaySensors.enemyLDisList;// All Enemy Lside Distances
|
||||
//List<float> enemyRDisList = RaySensors.enemyRDisList;// All Enemy Rside Distances
|
||||
/**myObserve[0] = transform.localPosition.x / raySensors.viewDistance;
|
||||
myObserve[1] = transform.localPosition.y / raySensors.viewDistance;
|
||||
myObserve[2] = transform.localPosition.z / raySensors.viewDistance;
|
||||
myObserve[3] = transform.eulerAngles.y / 360f;**/
|
||||
myObserve[0] = transform.localPosition.x;
|
||||
myObserve[1] = transform.localPosition.y;
|
||||
myObserve[2] = transform.localPosition.z;
|
||||
myObserve[3] = transform.eulerAngles.y / 36f;
|
||||
rayTagResult = raySensors.rayTagResult;// 探测用RayTag结果 float[](raySensorNum,1)
|
||||
rayTagResultOnehot = raySensors.rayTagResultOneHot.ToArray(); // 探测用RayTagonehot结果 List<int>[](raySensorNum*Tags,1)
|
||||
rayDisResult = raySensors.rayDisResult; // 探测用RayDis结果 float[](raySensorNum,1)
|
||||
targetStates = targetCon.targetState; // (6) targettype, target x,y,z, firebasesAreaDiameter
|
||||
remainTime = targetCon.leftTime;
|
||||
inAreaState = targetCon.GetInAreaState();
|
||||
gunReadyToggle = GunReady();
|
||||
//float[] focusEnemyObserve = RaySensors.focusEnemyInfo;// 最近的Enemy情报 float[](3,1) MinEnemyIndex,x,z
|
||||
|
||||
//sensor.AddObservation(allEnemyNum); // 敌人数量 int
|
||||
sensor.AddObservation(targetStates);// (6) targettype, target x,y,z, firebasesAreaDiameter
|
||||
sensor.AddObservation(inAreaState); // (1)
|
||||
sensor.AddObservation(remainTime); // (1)
|
||||
sensor.AddObservation(gunReadyToggle); // (1) save gun is ready?
|
||||
sensor.AddObservation(myObserve); // (4)自机位置xyz+朝向 float[](4,1)
|
||||
if (oneHotRayTag)
|
||||
{
|
||||
sensor.AddObservation(rayTagResultOnehot); // 探测用RayTag结果 float[](raySensorNum,1)
|
||||
}
|
||||
else
|
||||
{
|
||||
sensor.AddObservation(rayTagResult);
|
||||
}
|
||||
sensor.AddObservation(rayDisResult); // 探测用RayDis结果 float[](raySensorNum,1)
|
||||
envUICon.UpdateStateText(targetStates, inAreaState, remainTime, gunReadyToggle, myObserve, rayTagResultOnehot, rayDisResult);
|
||||
/*foreach(float aaa in rayDisResult)
|
||||
{
|
||||
Debug.Log(aaa);
|
||||
}
|
||||
Debug.LogWarning("------------");*/
|
||||
//sensor.AddObservation(focusEnemyObserve); // 最近的Enemy情报 float[](3,1) MinEnemyIndex,x,z
|
||||
//sensor.AddObservation(raySensorNum); // raySensor数量 int
|
||||
//sensor.AddObservation(remainTime); // RemainTime int
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// agent 输入处理
|
||||
public override void OnActionReceived(ActionBuffers actionBuffers)
|
||||
{
|
||||
//获取输入
|
||||
int vertical = actionBuffers.DiscreteActions[0];
|
||||
int horizontal = actionBuffers.DiscreteActions[1];
|
||||
int mouseShoot = actionBuffers.DiscreteActions[2];
|
||||
float Mouse_X = actionBuffers.ContinuousActions[0];
|
||||
if (vertical == 2) vertical = -1;
|
||||
if (horizontal == 2) horizontal = -1;
|
||||
|
||||
//应用输入
|
||||
shoot = mouseShoot;
|
||||
CameraControl(Mouse_X, 0);
|
||||
MoveAgent(vertical, horizontal);
|
||||
raySensors.UpdateRayInfo(); // update raycast
|
||||
|
||||
//判断结束
|
||||
float sceneReward = 0f;
|
||||
float endReward = 0f;
|
||||
(finishedState, sceneReward, endReward) = targetCon.CheckOverAndRewards();
|
||||
float thisRoundReward = RewardCalculate(sceneReward + endReward, Mouse_X, Math.Abs(vertical) + Math.Abs(horizontal));
|
||||
if (hudController.chartOn)
|
||||
{
|
||||
envUICon.UpdateChart(thisRoundReward);
|
||||
}
|
||||
else
|
||||
{
|
||||
envUICon.RemoveChart();
|
||||
}
|
||||
//Debug.Log("reward = " + thisRoundReward);
|
||||
if (finishedState != (int)TargetController.EndType.Running)
|
||||
{
|
||||
// Win or lose Finished
|
||||
Debug.Log("Finish reward = " + thisRoundReward);
|
||||
EP += 1;
|
||||
string targetString = Enum.GetName(typeof(SceneBlockContainer.Targets), targetCon.targetTypeInt);
|
||||
switch (finishedState)
|
||||
{
|
||||
case (int)TargetController.EndType.Win:
|
||||
Debug.LogWarning("Result|" + targetString + "|Win");
|
||||
break;
|
||||
|
||||
case (int)TargetController.EndType.Lose:
|
||||
Debug.LogWarning("Result|" + targetString + "|Lose");
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.LogWarning("TypeError");
|
||||
break;
|
||||
}
|
||||
SetReward(thisRoundReward);
|
||||
EndEpisode();
|
||||
}
|
||||
else
|
||||
{
|
||||
// game not over yet
|
||||
step += 1;
|
||||
}
|
||||
SetReward(thisRoundReward);
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// 控制调试
|
||||
public override void Heuristic(in ActionBuffers actionsOut)
|
||||
{
|
||||
//-------------------BUILD
|
||||
ActionSegment<float> continuousActions = actionsOut.ContinuousActions;
|
||||
ActionSegment<int> discreteActions = actionsOut.DiscreteActions;
|
||||
|
||||
int vertical = 0;
|
||||
int horizontal = 0;
|
||||
if (Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S))
|
||||
{
|
||||
vertical = 1;
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.S) && !Input.GetKey(KeyCode.W))
|
||||
{
|
||||
vertical = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
vertical = 0;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.D) && !Input.GetKey(KeyCode.A))
|
||||
{
|
||||
horizontal = 1;
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))
|
||||
{
|
||||
horizontal = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
horizontal = 0;
|
||||
}
|
||||
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
// Debug.Log("mousebuttonhit");
|
||||
shoot = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
shoot = 0;
|
||||
}
|
||||
discreteActions[0] = vertical;
|
||||
discreteActions[1] = horizontal;
|
||||
discreteActions[2] = shoot;
|
||||
//^^^^^^^^^^^^^^^^^^^^^discrete-Control^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvcontinuous-Controlvvvvvvvvvvvvvvvvvvvvvv
|
||||
float Mouse_X = Input.GetAxis("Mouse X") * mouseXSensitivity * Time.deltaTime;
|
||||
float Mouse_Y = Input.GetAxis("Mouse Y") * mouseYSensitivity * Time.deltaTime;
|
||||
continuousActions[0] = Mouse_X;
|
||||
//continuousActions[1] = nonReward;
|
||||
//continuousActions[2] = shootReward;
|
||||
//continuousActions[3] = shootWithoutReadyReward;
|
||||
//continuousActions[4] = hitReward;
|
||||
//continuousActions[5] = winReward;
|
||||
//continuousActions[6] = loseReward;
|
||||
//continuousActions[7] = killReward;
|
||||
//continuousActions[1] = Mouse_Y;
|
||||
//continuousActions[2] = timeLimit;
|
||||
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^continuous-Control^^^^^^^^^^^^^^^^^^^^^^
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4faf6e358e53cc24582eaff8dd830f97
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.MLAgents;
|
||||
using Unity.MLAgents.Actuators;
|
||||
using Unity.MLAgents.Sensors;
|
||||
@ -16,12 +17,14 @@ public class MLAgentsCustomController : Agent
|
||||
|
||||
// script
|
||||
private AgentController agentController;
|
||||
|
||||
private ParameterContainer paramContainer;
|
||||
private TargetController targetController;
|
||||
private EnvironmentUIControl envUIController;
|
||||
private HUDController hudController;
|
||||
private TargetUIController targetUIController;
|
||||
private RaySensors raySensors;
|
||||
private MessageBoxController messageBoxController;
|
||||
|
||||
// observation
|
||||
private float[] myObserve = new float[4];
|
||||
@ -46,13 +49,13 @@ private void Start()
|
||||
envUIController = environmentUIObj.GetComponent<EnvironmentUIControl>();
|
||||
hudController = hudUIObj.GetComponent<HUDController>();
|
||||
targetUIController = hudUIObj.GetComponent<TargetUIController>();
|
||||
messageBoxController = hudUIObj.GetComponent<MessageBoxController>();
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// env开始执行初始化
|
||||
#region On episode begin function
|
||||
|
||||
public override void OnEpisodeBegin()
|
||||
{
|
||||
Debug.LogWarning("GameState|START TEST!");
|
||||
step = 0;
|
||||
agentController.UpdateLockMouse();
|
||||
paramContainer.ResetTimeBonusReward();
|
||||
@ -80,8 +83,10 @@ public override void OnEpisodeBegin()
|
||||
raySensors.UpdateRayInfo(); // update raycast
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// 观察情报
|
||||
#endregion On episode begin function
|
||||
|
||||
#region Observation sensor function
|
||||
|
||||
public override void CollectObservations(VectorSensor sensor)
|
||||
{
|
||||
//List<float> enemyLDisList = RaySensors.enemyLDisList;// All Enemy Lside Distances
|
||||
@ -129,8 +134,10 @@ public override void CollectObservations(VectorSensor sensor)
|
||||
//sensor.AddObservation(remainTime); // RemainTime int
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// agent 输入处理
|
||||
#endregion Observation sensor function
|
||||
|
||||
#region Action received function
|
||||
|
||||
public override void OnActionReceived(ActionBuffers actionBuffers)
|
||||
{
|
||||
//获取输入
|
||||
@ -170,10 +177,16 @@ public override void OnActionReceived(ActionBuffers actionBuffers)
|
||||
{
|
||||
case (int)TargetController.EndType.Win:
|
||||
Debug.LogWarning("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");
|
||||
messageBoxController.PushMessage(
|
||||
new List<string> { "Game Lose" },
|
||||
new List<string> { "red" });
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -191,8 +204,10 @@ public override void OnActionReceived(ActionBuffers actionBuffers)
|
||||
SetReward(thisRoundReward);
|
||||
}
|
||||
|
||||
// ML-AGENTS处理-------------------------------------------------------------------------------------------ML-AGENTS
|
||||
// 控制调试
|
||||
#endregion Action received function
|
||||
|
||||
#region Heuristic function
|
||||
|
||||
public override void Heuristic(in ActionBuffers actionsOut)
|
||||
{
|
||||
//-------------------BUILD
|
||||
@ -250,4 +265,6 @@ public override void Heuristic(in ActionBuffers actionsOut)
|
||||
//continuousActions[2] = timeLimit;
|
||||
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^continuous-Control^^^^^^^^^^^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
#endregion Heuristic function
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ParameterContainer : MonoBehaviour
|
||||
@ -5,9 +6,11 @@ public class ParameterContainer : MonoBehaviour
|
||||
public GameObject targetConObj;
|
||||
public GameObject blockConObj;
|
||||
public GameObject agentObj;
|
||||
public GameObject hudObj;
|
||||
private TargetController targetCon;
|
||||
private SceneBlockContainer blockCont;
|
||||
private StartSeneData startSceneData;
|
||||
private MessageBoxController messageCon;
|
||||
private float agentDistance;
|
||||
private int agentInArea;
|
||||
|
||||
@ -142,6 +145,7 @@ private void Start()
|
||||
{
|
||||
targetCon = targetConObj.GetComponent<TargetController>();
|
||||
blockCont = blockConObj.GetComponent<SceneBlockContainer>();
|
||||
messageCon = hudObj.GetComponent<MessageBoxController>();
|
||||
areaTimeBonus = areaTimeBonusPerSec * timeLimit;
|
||||
freeTimeBonus = freeTimeBonusPerSec * timeLimit;
|
||||
targetTimeBonus = targetTimeBonusPerSec * timeLimit;
|
||||
@ -149,11 +153,17 @@ private void Start()
|
||||
{
|
||||
// try get start scene data
|
||||
startSceneData = GameObject.Find("StartSceneDataTransfer").GetComponent<StartSeneData>();
|
||||
messageCon.PushMessage(
|
||||
new List<string> { "ParameterContainer:", "StartSceneDataTransfer found!" },
|
||||
new List<string> { "green", "white" });
|
||||
}
|
||||
catch
|
||||
{
|
||||
// if not found, find dummy StartSeneData
|
||||
startSceneData = GameObject.Find("StartSceneDataTransferDummy").GetComponent<StartSeneData>();
|
||||
messageCon.PushMessage(
|
||||
new List<string> { "ParameterContainer:", "StartSceneDataTransfer not found!" },
|
||||
new List<string> { "orange" });
|
||||
}
|
||||
gameMode = startSceneData.gameMode;
|
||||
attackProb = startSceneData.attackProb;
|
||||
|
@ -16,6 +16,7 @@ public class TargetController : MonoBehaviour
|
||||
|
||||
// area
|
||||
public GameObject edgeUp;
|
||||
|
||||
public GameObject edgeDown;
|
||||
public GameObject edgeLeft;
|
||||
public GameObject edgeRight;
|
||||
@ -23,6 +24,7 @@ public class TargetController : MonoBehaviour
|
||||
|
||||
//group
|
||||
public string group1Tag = "Player";
|
||||
|
||||
public string group2Tag = "Enemy";
|
||||
|
||||
public float minEnemyAreaX;
|
||||
@ -54,7 +56,6 @@ public enum EndType
|
||||
private float sceneBlockSize;
|
||||
private float lastDistance;
|
||||
public Vector3 targetPosition;
|
||||
private Vector3 targetLocalPosition;
|
||||
private bool firstRewardFlag = true;
|
||||
private bool targetEnemySpawnFinish = false;
|
||||
private SceneBlockContainer sceneBlockCon;
|
||||
@ -64,7 +65,6 @@ public enum EndType
|
||||
private CharacterController agentCharaCon;
|
||||
private WorldUIController worldUICon;
|
||||
private HUDController hudCon;
|
||||
private RaySensors raySensors;
|
||||
|
||||
// start scene datas 0=train 1=play
|
||||
private int gamemode;
|
||||
@ -79,7 +79,6 @@ private void Start()
|
||||
paramCon = parameterContainerObj.GetComponent<ParameterContainer>();
|
||||
worldUICon = worldUIObj.GetComponent<WorldUIController>();
|
||||
hudCon = HUDObj.GetComponent<HUDController>();
|
||||
raySensors = agentObj.GetComponent<RaySensors>();
|
||||
|
||||
// get parameter from ParameterContainer
|
||||
gamemode = paramCon.gameMode;
|
||||
@ -133,6 +132,8 @@ private void Update()
|
||||
}
|
||||
}
|
||||
|
||||
#region Train Mode Initialization Functions
|
||||
|
||||
public void RollNewScene()
|
||||
{
|
||||
startTime = Time.time;// Reset StartTime as now time
|
||||
@ -179,30 +180,9 @@ public void RollNewScene()
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
|
||||
// get target observation states
|
||||
private void UpdateTargetStates(Vector3? thisTargetPosition = null)
|
||||
{
|
||||
// targettype, x,y,z, firebasesAreaDiameter
|
||||
targetState[0] = targetTypeInt;
|
||||
if (thisTargetPosition != null)
|
||||
{
|
||||
targetPosition = (Vector3)thisTargetPosition;
|
||||
}
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Free || targetTypeInt == (int)SceneBlockContainer.Targets.Stay)
|
||||
{
|
||||
for (int i = 1; i < targetState.Length; i++)
|
||||
// set target position state to 0
|
||||
targetState[i] = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetState[1] = targetPosition.x;
|
||||
targetState[2] = targetPosition.y;
|
||||
targetState[3] = targetPosition.z;
|
||||
targetState[4] = sceneBlockCon.thisBlock.firebasesAreaDiameter;
|
||||
targetState[5] = sceneBlockCon.thisBlock.belongRatio;
|
||||
}
|
||||
}
|
||||
#endregion Train Mode Initialization Functions
|
||||
|
||||
#region Agent Move Method
|
||||
|
||||
// move Agent into Agent Spawn Area
|
||||
private void MoveAgentToSpwanArea()
|
||||
@ -235,6 +215,52 @@ public void MoveAgentTo(Vector3 thisPosition)
|
||||
agentCharaCon.enabled = true;
|
||||
}
|
||||
|
||||
#endregion Agent Move Method
|
||||
|
||||
#region Random SceneBlock Spawn Method
|
||||
|
||||
// initialize scene block by target type
|
||||
private void RandomSpawnSceneBlock(SceneBlockContainer.Targets thisTargetType)
|
||||
{
|
||||
int randBlockType = 0;
|
||||
switch (thisTargetType)
|
||||
{
|
||||
case SceneBlockContainer.Targets.Go:
|
||||
randBlockType = Random.Range(0, sceneBlockCon.goBlockPrefabs.Length);
|
||||
sceneBlockSize = sceneBlockCon.goBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
break;
|
||||
|
||||
case SceneBlockContainer.Targets.Attack:
|
||||
randBlockType = Random.Range(0, sceneBlockCon.attackBlockPrefabs.Length);
|
||||
sceneBlockSize = sceneBlockCon.attackBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
break;
|
||||
|
||||
case SceneBlockContainer.Targets.Defence:
|
||||
// randBlockType = Random.Range(0, blockCont.defenceBlockPrefabs.Length);
|
||||
// sceneBlockSize = blockCont.defenceBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
Debug.LogWarning("Defence Block Not Ready");
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.LogWarning("TargetController: InitializeSceneBlock: Wrong TargetType");
|
||||
break;
|
||||
}
|
||||
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);
|
||||
targetPosition = new Vector3(randX, 0, randZ);
|
||||
|
||||
// init scene block
|
||||
sceneBlockCon.DestroyBlock();
|
||||
sceneBlockCon.CreateNewBlock(thisTargetType, randBlockType, targetPosition, group1Tag, group2Tag);
|
||||
enemyCon.DestroyAllEnemys();
|
||||
enemyCon.RandomInitEnemysExcept(hudCon.enemyNum, targetPosition, sceneBlockSize);
|
||||
sceneBlockCon.thisBlock.InitBlock(environmentObj);
|
||||
}
|
||||
|
||||
#endregion Random SceneBlock Spawn Method
|
||||
|
||||
#region Reward function
|
||||
|
||||
// check over and get rewards
|
||||
// 1 = success,2 = overtime,0 = notover
|
||||
public (int, float, float) CheckOverAndRewards()
|
||||
@ -378,41 +404,6 @@ public void MoveAgentTo(Vector3 thisPosition)
|
||||
return (endTypeInt, thisReward, endReward);
|
||||
}
|
||||
|
||||
// initialize scene block by target type
|
||||
private void RandomSpawnSceneBlock(SceneBlockContainer.Targets thisTargetType)
|
||||
{
|
||||
int randBlockType = 0;
|
||||
switch (thisTargetType)
|
||||
{
|
||||
case SceneBlockContainer.Targets.Go:
|
||||
randBlockType = Random.Range(0, sceneBlockCon.goBlockPrefabs.Length);
|
||||
sceneBlockSize = sceneBlockCon.goBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
break;
|
||||
case SceneBlockContainer.Targets.Attack:
|
||||
randBlockType = Random.Range(0, sceneBlockCon.attackBlockPrefabs.Length);
|
||||
sceneBlockSize = sceneBlockCon.attackBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
break;
|
||||
case SceneBlockContainer.Targets.Defence:
|
||||
// randBlockType = Random.Range(0, blockCont.defenceBlockPrefabs.Length);
|
||||
// sceneBlockSize = blockCont.defenceBlockPrefabs[randBlockType].GetComponent<SceneBlock>().blockSize;
|
||||
Debug.LogWarning("Defence Block Not Ready");
|
||||
break;
|
||||
default:
|
||||
Debug.LogWarning("TargetController: InitializeSceneBlock: Wrong TargetType");
|
||||
break;
|
||||
}
|
||||
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);
|
||||
targetPosition = new Vector3(randX, 0, randZ);
|
||||
|
||||
// init scene block
|
||||
sceneBlockCon.DestroyBlock();
|
||||
sceneBlockCon.CreateNewBlock(thisTargetType, randBlockType, targetPosition, group1Tag, group2Tag);
|
||||
enemyCon.DestroyAllEnemys();
|
||||
enemyCon.RandomInitEnemysExcept(hudCon.enemyNum, targetPosition, sceneBlockSize);
|
||||
sceneBlockCon.thisBlock.InitBlock(environmentObj);
|
||||
}
|
||||
|
||||
// caulculate sceneReward if close to target then get great reward
|
||||
private float GetDistanceReward(float nowDistance, int inarea)
|
||||
{
|
||||
@ -501,20 +492,10 @@ public float HitEnemyReward(Vector3 enemyPosition)
|
||||
return thisHitReward;
|
||||
}
|
||||
|
||||
// get in area state
|
||||
public int GetInAreaState()
|
||||
{
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Go)
|
||||
{
|
||||
return inArea;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endregion Reward function
|
||||
|
||||
#region Play Mode Method
|
||||
|
||||
// Play Mode method
|
||||
// Initialize Play mode
|
||||
public void PlayInitialize()
|
||||
{
|
||||
@ -557,4 +538,44 @@ public void StayModeChange()
|
||||
UpdateTargetStates();
|
||||
envUICon.UpdateTargetType(targetTypeInt);
|
||||
}
|
||||
|
||||
#endregion Play Mode Method
|
||||
|
||||
// get target observation states
|
||||
private void UpdateTargetStates(Vector3? thisTargetPosition = null)
|
||||
{
|
||||
// targettype, x,y,z, firebasesAreaDiameter
|
||||
targetState[0] = targetTypeInt;
|
||||
if (thisTargetPosition != null)
|
||||
{
|
||||
targetPosition = (Vector3)thisTargetPosition;
|
||||
}
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Free || targetTypeInt == (int)SceneBlockContainer.Targets.Stay)
|
||||
{
|
||||
for (int i = 1; i < targetState.Length; i++)
|
||||
// set target position state to 0
|
||||
targetState[i] = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
targetState[1] = targetPosition.x;
|
||||
targetState[2] = targetPosition.y;
|
||||
targetState[3] = targetPosition.z;
|
||||
targetState[4] = sceneBlockCon.thisBlock.firebasesAreaDiameter;
|
||||
targetState[5] = sceneBlockCon.thisBlock.belongRatio;
|
||||
}
|
||||
}
|
||||
|
||||
// get in area state
|
||||
public int GetInAreaState()
|
||||
{
|
||||
if (targetTypeInt == (int)SceneBlockContainer.Targets.Go)
|
||||
{
|
||||
return inArea;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MouseInMap : MonoBehaviour
|
||||
@ -64,7 +65,8 @@ private void Update()
|
||||
if (IsAgentorEnemyWithinDistance(targetDistanceThreshold))
|
||||
{
|
||||
// if agent or enemy is nearby, do not create new block
|
||||
messageCon.PushMessage("Agent or Enemy is too close!");
|
||||
messageCon.PushMessage(new List<string> { "Agent or Enemy is too close!" },
|
||||
new List<string> { "#800000ff" });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -80,7 +82,8 @@ private void Update()
|
||||
if (IsAgentorEnemyWithinDistance(targetDistanceThreshold))
|
||||
{
|
||||
// if agent or enemy is nearby, do not create new block
|
||||
messageCon.PushMessage("Agent or Enemy is too close!");
|
||||
messageCon.PushMessage(new List<string> { "Agent or Enemy is too close!" },
|
||||
new List<string> { "#800000ff" });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -95,7 +98,8 @@ private void Update()
|
||||
case MouseMode.EnemySet:
|
||||
if (IsAgentorEnemyWithinDistance(enemyDistanceThreshold))
|
||||
{
|
||||
messageCon.PushMessage("Agent or Enemy is too close!");
|
||||
messageCon.PushMessage(new List<string> { "Agent or Enemy is too close!" },
|
||||
new List<string> { "#800000ff" });
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -131,7 +135,7 @@ public void ChangeMouseModeTo(MouseMode thisMouseMode)
|
||||
|
||||
case MouseMode.EnemySet:
|
||||
preSet = enemyCon.enemyPrefab;
|
||||
mousePreviewCon.ChangePreviewTo(preSet,true);
|
||||
mousePreviewCon.ChangePreviewTo(preSet, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -14,16 +14,16 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_PixelRect:
|
||||
serializedVersion: 2
|
||||
x: -209
|
||||
y: 156
|
||||
width: 1839
|
||||
height: 1021
|
||||
x: 65
|
||||
y: 43
|
||||
width: 1855
|
||||
height: 1037
|
||||
m_ShowMode: 4
|
||||
m_Title: Console
|
||||
m_Title: Project
|
||||
m_RootView: {fileID: 9}
|
||||
m_MinSize: {x: 875, y: 300}
|
||||
m_MaxSize: {x: 10000, y: 10000}
|
||||
m_Maximized: 0
|
||||
m_Maximized: 1
|
||||
--- !u!114 &2
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -40,9 +40,9 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 733
|
||||
width: 1089
|
||||
height: 238
|
||||
y: 745
|
||||
width: 1096
|
||||
height: 242
|
||||
m_MinSize: {x: 231, y: 271}
|
||||
m_MaxSize: {x: 10001, y: 10021}
|
||||
m_ActualView: {fileID: 15}
|
||||
@ -70,12 +70,12 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1089
|
||||
height: 971
|
||||
width: 1096
|
||||
height: 987
|
||||
m_MinSize: {x: 100, y: 200}
|
||||
m_MaxSize: {x: 8096, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 128
|
||||
controlID: 24
|
||||
--- !u!114 &4
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -92,11 +92,11 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 462
|
||||
width: 345
|
||||
height: 509
|
||||
m_MinSize: {x: 102, y: 121}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
y: 470
|
||||
width: 348
|
||||
height: 517
|
||||
m_MinSize: {x: 100, y: 100}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 19}
|
||||
m_Panes:
|
||||
- {fileID: 19}
|
||||
@ -119,14 +119,14 @@ MonoBehaviour:
|
||||
- {fileID: 4}
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 1089
|
||||
x: 1096
|
||||
y: 0
|
||||
width: 345
|
||||
height: 971
|
||||
width: 348
|
||||
height: 987
|
||||
m_MinSize: {x: 100, y: 200}
|
||||
m_MaxSize: {x: 8096, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 16
|
||||
controlID: 68
|
||||
--- !u!114 &6
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -144,10 +144,10 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 345
|
||||
height: 462
|
||||
m_MinSize: {x: 202, y: 221}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
width: 348
|
||||
height: 470
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 17}
|
||||
m_Panes:
|
||||
- {fileID: 17}
|
||||
@ -173,12 +173,12 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 30
|
||||
width: 1839
|
||||
height: 971
|
||||
width: 1855
|
||||
height: 987
|
||||
m_MinSize: {x: 300, y: 200}
|
||||
m_MaxSize: {x: 24288, y: 16192}
|
||||
vertical: 0
|
||||
controlID: 127
|
||||
controlID: 23
|
||||
--- !u!114 &8
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@ -194,12 +194,12 @@ MonoBehaviour:
|
||||
m_Children: []
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 1434
|
||||
x: 1444
|
||||
y: 0
|
||||
width: 405
|
||||
height: 971
|
||||
m_MinSize: {x: 276, y: 71}
|
||||
m_MaxSize: {x: 4001, y: 4021}
|
||||
width: 411
|
||||
height: 987
|
||||
m_MinSize: {x: 275, y: 50}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 16}
|
||||
m_Panes:
|
||||
- {fileID: 16}
|
||||
@ -225,8 +225,8 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1839
|
||||
height: 1021
|
||||
width: 1855
|
||||
height: 1037
|
||||
m_MinSize: {x: 875, y: 300}
|
||||
m_MaxSize: {x: 10000, y: 10000}
|
||||
m_UseTopView: 1
|
||||
@ -250,7 +250,7 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1839
|
||||
width: 1855
|
||||
height: 30
|
||||
m_MinSize: {x: 0, y: 0}
|
||||
m_MaxSize: {x: 0, y: 0}
|
||||
@ -271,8 +271,8 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 1001
|
||||
width: 1839
|
||||
y: 1017
|
||||
width: 1855
|
||||
height: 20
|
||||
m_MinSize: {x: 0, y: 0}
|
||||
m_MaxSize: {x: 0, y: 0}
|
||||
@ -293,8 +293,8 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1089
|
||||
height: 733
|
||||
width: 1096
|
||||
height: 745
|
||||
m_MinSize: {x: 201, y: 221}
|
||||
m_MaxSize: {x: 4001, y: 4021}
|
||||
m_ActualView: {fileID: 18}
|
||||
@ -323,10 +323,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 73
|
||||
y: 81
|
||||
width: 1088
|
||||
height: 712
|
||||
x: 65
|
||||
y: 73
|
||||
width: 1097
|
||||
height: 724
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -337,7 +337,7 @@ MonoBehaviour:
|
||||
m_ShowGizmos: 0
|
||||
m_TargetDisplay: 0
|
||||
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_TargetSize: {x: 1088, y: 691}
|
||||
m_TargetSize: {x: 1097, y: 703}
|
||||
m_TextureFilterMode: 0
|
||||
m_TextureHideFlags: 61
|
||||
m_RenderIMGUI: 1
|
||||
@ -352,10 +352,10 @@ MonoBehaviour:
|
||||
m_VRangeLocked: 0
|
||||
hZoomLockedByDefault: 0
|
||||
vZoomLockedByDefault: 0
|
||||
m_HBaseRangeMin: -544
|
||||
m_HBaseRangeMax: 544
|
||||
m_VBaseRangeMin: -345.5
|
||||
m_VBaseRangeMax: 345.5
|
||||
m_HBaseRangeMin: -548.5
|
||||
m_HBaseRangeMax: 548.5
|
||||
m_VBaseRangeMin: -351.5
|
||||
m_VBaseRangeMax: 351.5
|
||||
m_HAllowExceedBaseRangeMin: 1
|
||||
m_HAllowExceedBaseRangeMax: 1
|
||||
m_VAllowExceedBaseRangeMin: 1
|
||||
@ -373,23 +373,23 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 21
|
||||
width: 1088
|
||||
height: 691
|
||||
width: 1097
|
||||
height: 703
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Translation: {x: 544, y: 345.5}
|
||||
m_Translation: {x: 548.5, y: 351.5}
|
||||
m_MarginLeft: 0
|
||||
m_MarginRight: 0
|
||||
m_MarginTop: 0
|
||||
m_MarginBottom: 0
|
||||
m_LastShownAreaInsideMargins:
|
||||
serializedVersion: 2
|
||||
x: -544
|
||||
y: -345.5
|
||||
width: 1088
|
||||
height: 691
|
||||
x: -548.5
|
||||
y: -351.5
|
||||
width: 1097
|
||||
height: 703
|
||||
m_MinimalGUI: 1
|
||||
m_defaultScale: 1
|
||||
m_LastWindowPixelSize: {x: 1088, y: 712}
|
||||
m_LastWindowPixelSize: {x: 1097, y: 724}
|
||||
m_ClearInEditMode: 1
|
||||
m_NoCameraWarning: 1
|
||||
m_LowResolutionForAspectRatios: 01000000000000000000
|
||||
@ -443,10 +443,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 752
|
||||
width: 1088
|
||||
height: 217
|
||||
x: 65
|
||||
y: 818
|
||||
width: 1095
|
||||
height: 221
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -464,7 +464,7 @@ MonoBehaviour:
|
||||
m_SkipHidden: 0
|
||||
m_SearchArea: 1
|
||||
m_Folders:
|
||||
- Assets/Prefeb
|
||||
- Assets/Script/InGame
|
||||
m_Globs: []
|
||||
m_OriginalText:
|
||||
m_ViewMode: 1
|
||||
@ -476,10 +476,10 @@ MonoBehaviour:
|
||||
m_LockTracker:
|
||||
m_IsLocked: 0
|
||||
m_FolderTreeState:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs: 03ca9a3b
|
||||
m_LastClickedID: 1000000003
|
||||
m_ExpandedIDs: 0000000046670000486700004a6700004c6700004e67000000ca9a3b
|
||||
scrollPos: {x: 0, y: 167}
|
||||
m_SelectedIDs: 747d0000
|
||||
m_LastClickedID: 32116
|
||||
m_ExpandedIDs: 0000000046670000486700004a6700004c6700004e6700008e67000000ca9a3b
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -534,22 +534,22 @@ MonoBehaviour:
|
||||
m_ListAreaState:
|
||||
m_SelectedInstanceIDs:
|
||||
m_LastClickedInstanceID: 0
|
||||
m_HadKeyboardFocusLastEvent: 0
|
||||
m_HadKeyboardFocusLastEvent: 1
|
||||
m_ExpandedInstanceIDs: c62300008a5c000000000000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
m_OriginalName:
|
||||
m_Name: InGame
|
||||
m_OriginalName: InGame
|
||||
m_EditFieldRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 0
|
||||
height: 0
|
||||
m_UserData: 0
|
||||
m_UserData: 32116
|
||||
m_IsWaitingForDelay: 0
|
||||
m_IsRenaming: 0
|
||||
m_OriginalEventType: 11
|
||||
m_OriginalEventType: 0
|
||||
m_IsRenamingFilename: 1
|
||||
m_ClientGUIView: {fileID: 2}
|
||||
m_CreateAssetUtility:
|
||||
@ -583,10 +583,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 1435
|
||||
y: 19
|
||||
width: 404
|
||||
height: 950
|
||||
x: 1509
|
||||
y: 73
|
||||
width: 410
|
||||
height: 966
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -624,10 +624,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 1
|
||||
y: 19
|
||||
width: 343
|
||||
height: 441
|
||||
x: 1161
|
||||
y: 73
|
||||
width: 346
|
||||
height: 449
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -637,7 +637,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: 9ee8fffff0e8ffff44eaffff94eaffffaeeaffff32fbffff
|
||||
m_ExpandedIDs: a6efffff44f0ffffaaf0ffff5af4ffffe0f4ffff72f5ffff14f6ffffe6f8ffffeaf8ffffeef8ffff90f9ffff32fbfffff05e0000ca7c000072ab0000b6ae00000aaf0000ecb1000040b20000c4b80000a6c7000072ce00000c040100
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@ -681,10 +681,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: -209
|
||||
y: 186
|
||||
width: 1088
|
||||
height: 712
|
||||
x: 65
|
||||
y: 73
|
||||
width: 1095
|
||||
height: 724
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@ -914,14 +914,14 @@ MonoBehaviour:
|
||||
m_OverrideSceneCullingMask: 6917529027641081856
|
||||
m_SceneIsLit: 1
|
||||
m_SceneLighting: 1
|
||||
m_2DMode: 1
|
||||
m_2DMode: 0
|
||||
m_isRotationLocked: 0
|
||||
m_PlayAudio: 0
|
||||
m_AudioPlay: 0
|
||||
m_Position:
|
||||
m_Target: {x: 609.64667, y: 251.45477, z: 0.45881873}
|
||||
m_Target: {x: -32.177223, y: 27.41194, z: -12.366082}
|
||||
speed: 2
|
||||
m_Value: {x: 609.64667, y: 251.45477, z: 0.45881873}
|
||||
m_Value: {x: -32.177223, y: 27.41194, z: -12.366082}
|
||||
m_RenderMode: 0
|
||||
m_CameraMode:
|
||||
drawMode: 0
|
||||
@ -950,17 +950,17 @@ MonoBehaviour:
|
||||
m_Size: {x: 0, y: 0}
|
||||
yGrid:
|
||||
m_Fade:
|
||||
m_Target: 0
|
||||
m_Target: 1
|
||||
speed: 2
|
||||
m_Value: 0
|
||||
m_Value: 1
|
||||
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
|
||||
m_Pivot: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 1, y: 1}
|
||||
zGrid:
|
||||
m_Fade:
|
||||
m_Target: 1
|
||||
m_Target: 0
|
||||
speed: 2
|
||||
m_Value: 1
|
||||
m_Value: 0
|
||||
m_Color: {r: 0.5, g: 0.5, b: 0.5, a: 0.4}
|
||||
m_Pivot: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 1, y: 1}
|
||||
@ -968,17 +968,17 @@ MonoBehaviour:
|
||||
m_GridAxis: 1
|
||||
m_gridOpacity: 0.5
|
||||
m_Rotation:
|
||||
m_Target: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_Target: {x: -0.21652842, y: -0.21412164, z: 0.048739098, w: -0.95125794}
|
||||
speed: 2
|
||||
m_Value: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_Value: {x: -0.21652845, y: -0.21412167, z: 0.048739105, w: -0.95125806}
|
||||
m_Size:
|
||||
m_Target: 475.65506
|
||||
m_Target: 10
|
||||
speed: 2
|
||||
m_Value: 475.65506
|
||||
m_Value: 10
|
||||
m_Ortho:
|
||||
m_Target: 1
|
||||
m_Target: 0
|
||||
speed: 2
|
||||
m_Value: 1
|
||||
m_Value: 0
|
||||
m_CameraSettings:
|
||||
m_Speed: 1.0005
|
||||
m_SpeedNormalized: 0.5
|
||||
@ -992,7 +992,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.19993632, y: -0.012642198, z: 0.0025799773, w: -0.97972375}
|
||||
m_LastSceneViewOrtho: 0
|
||||
m_ReplacementShader: {fileID: 0}
|
||||
m_ReplacementString:
|
||||
@ -1019,10 +1019,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 1
|
||||
y: 481
|
||||
width: 343
|
||||
height: 488
|
||||
x: 1161
|
||||
y: 543
|
||||
width: 346
|
||||
height: 496
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
|
Loading…
Reference in New Issue
Block a user