浏览代码

update UI and input actions

/hh-develop-fps_game_project
HH 4 年前
当前提交
9e0a78f7
共有 7 个文件被更改,包括 1303 次插入221 次删除
  1. 4
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSAgentInput.cs
  2. 264
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.cs
  3. 80
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions
  4. 335
      Project/Assets/ML-Agents/Examples/FPS_Game/Prefabs/FPSAgent.prefab
  5. 821
      Project/Assets/ML-Agents/Examples/FPS_Game/Scenes/FPS_Game.unity
  6. 3
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/GameController.cs
  7. 17
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/UI/UIShowControls.cs

4
Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSAgentInput.cs


{
public bool DisableInput = false;
private FPSPlayerInputActions inputActions;
private FPSPlayerInputActions.PlayerActionMapActions actionMap;
private FPSPlayerInputActions.PlayerActions actionMap;
private Gamepad gamepad;
public Vector2 moveInput;

void Awake()
{
inputActions = new FPSPlayerInputActions();
actionMap = inputActions.PlayerActionMap;
actionMap = inputActions.Player;
}
void OnEnable()
{

264
Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.cs


""name"": ""FPSPlayerInputActions"",
""maps"": [
{
""name"": ""Player Action Map"",
""name"": ""Player"",
""id"": ""bb797917-97ca-47e1-b3c9-0572380e9376"",
""actions"": [
{

""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""DashLeft"",
""type"": ""Button"",
""id"": ""1d14cda7-c4b3-4bb4-9ebb-f197aa5ed183"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""DashRight"",
""type"": ""Button"",
""id"": ""96db7975-8803-410a-863b-5f25b31019f4"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},

},
{
""name"": """",
""id"": ""14009289-6acb-4978-8838-01648248f103"",
""path"": ""<Gamepad>/leftShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""DashLeft"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""28ddf0bd-ea22-4069-ba60-ca41d4742bf9"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",

},
{
""name"": """",
""id"": ""4df83c50-5bb2-497d-a713-237e1c5dc25a"",
""path"": ""<Gamepad>/rightShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""DashRight"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""0c0d917f-0af9-4575-b970-f441fd97db20"",
""path"": ""<Gamepad>/rightStick"",
""interactions"": """",

""name"": """",
""id"": ""319796b1-6071-46f0-81dc-58b6bdb7d86a"",
""path"": ""<Gamepad>/leftTrigger"",
""interactions"": ""Press(pressPoint=0.75)"",
""interactions"": ""Press(pressPoint=0.5)"",
""processors"": """",
""groups"": """",
""action"": ""Dash"",

""isPartOfComposite"": false
}
]
},
{
""name"": ""UI"",
""id"": ""ab1a83a2-e1a9-44f3-8688-7a60542bcf25"",
""actions"": [
{
""name"": ""Controls"",
""type"": ""Button"",
""id"": ""bd885a35-fff9-4afb-a855-24fb9f6006c7"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
{
""name"": """",
""id"": ""b1df5ed6-1b89-4092-8140-92b0835f0a58"",
""path"": ""<Keyboard>/c"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Controls"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""8f5dc820-dac4-4667-92d5-e1f46b8e3365"",
""path"": ""<Gamepad>/select"",
""interactions"": ""Press"",
""processors"": """",
""groups"": """",
""action"": ""Controls"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
// Player Action Map
m_PlayerActionMap = asset.FindActionMap("Player Action Map", throwIfNotFound: true);
m_PlayerActionMap_Walk = m_PlayerActionMap.FindAction("Walk", throwIfNotFound: true);
m_PlayerActionMap_DashLeft = m_PlayerActionMap.FindAction("DashLeft", throwIfNotFound: true);
m_PlayerActionMap_DashRight = m_PlayerActionMap.FindAction("DashRight", throwIfNotFound: true);
m_PlayerActionMap_Jump = m_PlayerActionMap.FindAction("Jump", throwIfNotFound: true);
m_PlayerActionMap_Shoot = m_PlayerActionMap.FindAction("Shoot", throwIfNotFound: true);
m_PlayerActionMap_Shield = m_PlayerActionMap.FindAction("Shield", throwIfNotFound: true);
m_PlayerActionMap_RotateBody = m_PlayerActionMap.FindAction("RotateBody", throwIfNotFound: true);
m_PlayerActionMap_Dash = m_PlayerActionMap.FindAction("Dash", throwIfNotFound: true);
m_PlayerActionMap_Rotate = m_PlayerActionMap.FindAction("Rotate", throwIfNotFound: true);
m_PlayerActionMap_Restart = m_PlayerActionMap.FindAction("Restart", throwIfNotFound: true);
// Player
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
m_Player_Walk = m_Player.FindAction("Walk", throwIfNotFound: true);
m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true);
m_Player_Shoot = m_Player.FindAction("Shoot", throwIfNotFound: true);
m_Player_Shield = m_Player.FindAction("Shield", throwIfNotFound: true);
m_Player_RotateBody = m_Player.FindAction("RotateBody", throwIfNotFound: true);
m_Player_Dash = m_Player.FindAction("Dash", throwIfNotFound: true);
m_Player_Rotate = m_Player.FindAction("Rotate", throwIfNotFound: true);
m_Player_Restart = m_Player.FindAction("Restart", throwIfNotFound: true);
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Controls = m_UI.FindAction("Controls", throwIfNotFound: true);
}
public void Dispose()

asset.Disable();
}
// Player Action Map
private readonly InputActionMap m_PlayerActionMap;
private IPlayerActionMapActions m_PlayerActionMapActionsCallbackInterface;
private readonly InputAction m_PlayerActionMap_Walk;
private readonly InputAction m_PlayerActionMap_DashLeft;
private readonly InputAction m_PlayerActionMap_DashRight;
private readonly InputAction m_PlayerActionMap_Jump;
private readonly InputAction m_PlayerActionMap_Shoot;
private readonly InputAction m_PlayerActionMap_Shield;
private readonly InputAction m_PlayerActionMap_RotateBody;
private readonly InputAction m_PlayerActionMap_Dash;
private readonly InputAction m_PlayerActionMap_Rotate;
private readonly InputAction m_PlayerActionMap_Restart;
public struct PlayerActionMapActions
// Player
private readonly InputActionMap m_Player;
private IPlayerActions m_PlayerActionsCallbackInterface;
private readonly InputAction m_Player_Walk;
private readonly InputAction m_Player_Jump;
private readonly InputAction m_Player_Shoot;
private readonly InputAction m_Player_Shield;
private readonly InputAction m_Player_RotateBody;
private readonly InputAction m_Player_Dash;
private readonly InputAction m_Player_Rotate;
private readonly InputAction m_Player_Restart;
public struct PlayerActions
public PlayerActionMapActions(@FPSPlayerInputActions wrapper) { m_Wrapper = wrapper; }
public InputAction @Walk => m_Wrapper.m_PlayerActionMap_Walk;
public InputAction @DashLeft => m_Wrapper.m_PlayerActionMap_DashLeft;
public InputAction @DashRight => m_Wrapper.m_PlayerActionMap_DashRight;
public InputAction @Jump => m_Wrapper.m_PlayerActionMap_Jump;
public InputAction @Shoot => m_Wrapper.m_PlayerActionMap_Shoot;
public InputAction @Shield => m_Wrapper.m_PlayerActionMap_Shield;
public InputAction @RotateBody => m_Wrapper.m_PlayerActionMap_RotateBody;
public InputAction @Dash => m_Wrapper.m_PlayerActionMap_Dash;
public InputAction @Rotate => m_Wrapper.m_PlayerActionMap_Rotate;
public InputAction @Restart => m_Wrapper.m_PlayerActionMap_Restart;
public InputActionMap Get() { return m_Wrapper.m_PlayerActionMap; }
public PlayerActions(@FPSPlayerInputActions wrapper) { m_Wrapper = wrapper; }
public InputAction @Walk => m_Wrapper.m_Player_Walk;
public InputAction @Jump => m_Wrapper.m_Player_Jump;
public InputAction @Shoot => m_Wrapper.m_Player_Shoot;
public InputAction @Shield => m_Wrapper.m_Player_Shield;
public InputAction @RotateBody => m_Wrapper.m_Player_RotateBody;
public InputAction @Dash => m_Wrapper.m_Player_Dash;
public InputAction @Rotate => m_Wrapper.m_Player_Rotate;
public InputAction @Restart => m_Wrapper.m_Player_Restart;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public static implicit operator InputActionMap(PlayerActionMapActions set) { return set.Get(); }
public void SetCallbacks(IPlayerActionMapActions instance)
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
public void SetCallbacks(IPlayerActions instance)
if (m_Wrapper.m_PlayerActionMapActionsCallbackInterface != null)
if (m_Wrapper.m_PlayerActionsCallbackInterface != null)
@Walk.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnWalk;
@Walk.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnWalk;
@Walk.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnWalk;
@DashLeft.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDashLeft;
@DashLeft.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDashLeft;
@DashLeft.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDashLeft;
@DashRight.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDashRight;
@DashRight.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDashRight;
@DashRight.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDashRight;
@Jump.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnJump;
@Jump.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnJump;
@Jump.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnJump;
@Shoot.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnShoot;
@Shoot.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnShoot;
@Shoot.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnShoot;
@Shield.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnShield;
@Shield.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnShield;
@Shield.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnShield;
@RotateBody.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRotateBody;
@RotateBody.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRotateBody;
@RotateBody.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRotateBody;
@Dash.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDash;
@Dash.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDash;
@Dash.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnDash;
@Rotate.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRotate;
@Rotate.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRotate;
@Rotate.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRotate;
@Restart.started -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRestart;
@Restart.performed -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRestart;
@Restart.canceled -= m_Wrapper.m_PlayerActionMapActionsCallbackInterface.OnRestart;
@Walk.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWalk;
@Walk.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWalk;
@Walk.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnWalk;
@Jump.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnJump;
@Jump.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnJump;
@Jump.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnJump;
@Shoot.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShoot;
@Shoot.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShoot;
@Shoot.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShoot;
@Shield.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShield;
@Shield.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShield;
@Shield.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnShield;
@RotateBody.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateBody;
@RotateBody.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateBody;
@RotateBody.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateBody;
@Dash.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Dash.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Dash.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Rotate.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Rotate.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Rotate.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Restart.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRestart;
@Restart.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRestart;
@Restart.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRestart;
m_Wrapper.m_PlayerActionMapActionsCallbackInterface = instance;
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
@DashLeft.started += instance.OnDashLeft;
@DashLeft.performed += instance.OnDashLeft;
@DashLeft.canceled += instance.OnDashLeft;
@DashRight.started += instance.OnDashRight;
@DashRight.performed += instance.OnDashRight;
@DashRight.canceled += instance.OnDashRight;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;

}
}
}
public PlayerActionMapActions @PlayerActionMap => new PlayerActionMapActions(this);
public interface IPlayerActionMapActions
public PlayerActions @Player => new PlayerActions(this);
// UI
private readonly InputActionMap m_UI;
private IUIActions m_UIActionsCallbackInterface;
private readonly InputAction m_UI_Controls;
public struct UIActions
{
private @FPSPlayerInputActions m_Wrapper;
public UIActions(@FPSPlayerInputActions wrapper) { m_Wrapper = wrapper; }
public InputAction @Controls => m_Wrapper.m_UI_Controls;
public InputActionMap Get() { return m_Wrapper.m_UI; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(UIActions set) { return set.Get(); }
public void SetCallbacks(IUIActions instance)
{
if (m_Wrapper.m_UIActionsCallbackInterface != null)
{
@Controls.started -= m_Wrapper.m_UIActionsCallbackInterface.OnControls;
@Controls.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnControls;
@Controls.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnControls;
}
m_Wrapper.m_UIActionsCallbackInterface = instance;
if (instance != null)
{
@Controls.started += instance.OnControls;
@Controls.performed += instance.OnControls;
@Controls.canceled += instance.OnControls;
}
}
}
public UIActions @UI => new UIActions(this);
public interface IPlayerActions
void OnDashLeft(InputAction.CallbackContext context);
void OnDashRight(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
void OnShoot(InputAction.CallbackContext context);
void OnShield(InputAction.CallbackContext context);

void OnRestart(InputAction.CallbackContext context);
}
public interface IUIActions
{
void OnControls(InputAction.CallbackContext context);
}
}

80
Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions


"name": "FPSPlayerInputActions",
"maps": [
{
"name": "Player Action Map",
"name": "Player",
"id": "bb797917-97ca-47e1-b3c9-0572380e9376",
"actions": [
{

"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "DashLeft",
"type": "Button",
"id": "1d14cda7-c4b3-4bb4-9ebb-f197aa5ed183",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "DashRight",
"type": "Button",
"id": "96db7975-8803-410a-863b-5f25b31019f4",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},

},
{
"name": "",
"id": "14009289-6acb-4978-8838-01648248f103",
"path": "<Gamepad>/leftShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "DashLeft",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "28ddf0bd-ea22-4069-ba60-ca41d4742bf9",
"path": "<Gamepad>/buttonSouth",
"interactions": "",

"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "4df83c50-5bb2-497d-a713-237e1c5dc25a",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "DashRight",
"isComposite": false,
"isPartOfComposite": false
},

"name": "",
"id": "319796b1-6071-46f0-81dc-58b6bdb7d86a",
"path": "<Gamepad>/leftTrigger",
"interactions": "Press(pressPoint=0.75)",
"interactions": "Press(pressPoint=0.5)",
"processors": "",
"groups": "",
"action": "Dash",

"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
}
]
},
{
"name": "UI",
"id": "ab1a83a2-e1a9-44f3-8688-7a60542bcf25",
"actions": [
{
"name": "Controls",
"type": "Button",
"id": "bd885a35-fff9-4afb-a855-24fb9f6006c7",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "",
"id": "b1df5ed6-1b89-4092-8140-92b0835f0a58",
"path": "<Keyboard>/c",
"interactions": "",
"processors": "",
"groups": "",
"action": "Controls",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "8f5dc820-dac4-4667-92d5-e1f46b8e3365",
"path": "<Gamepad>/select",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Controls",
"isComposite": false,
"isPartOfComposite": false
}

335
Project/Assets/ML-Agents/Examples/FPS_Game/Prefabs/FPSAgent.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &982403917
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 982403919}
- component: {fileID: 982403918}
m_Layer: 10
m_Name: Point Light (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &982403919
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 982403917}
m_LocalRotation: {x: -0, y: 0.026176922, z: -0, w: 0.99965733}
m_LocalPosition: {x: 0, y: 0, z: 1.0326595}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2747490485406847267}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &982403918
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 982403917}
m_Enabled: 1
serializedVersion: 10
m_Type: 2
m_Shape: 0
m_Color: {r: 1, g: 0.68598413, b: 0, a: 1}
m_Intensity: 8
m_Range: 3
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &1083220194
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1083220195}
- component: {fileID: 1083220196}
m_Layer: 10
m_Name: Point Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1083220195
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1083220194}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2747490485226133339}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &1083220196
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1083220194}
m_Enabled: 1
serializedVersion: 10
m_Type: 2
m_Shape: 0
m_Color: {r: 1, g: 0.68598413, b: 0, a: 1}
m_Intensity: 8
m_Range: 3
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &1828481691
GameObject:
m_ObjectHideFlags: 0

- {fileID: 2747490486292531290}
- {fileID: 2747490484912921237}
- {fileID: 2747490485103127816}
- {fileID: 1083220195}
m_Father: {fileID: 7796409946673122438}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 1.5, z: 0}

- {fileID: 2747490486507185952}
- {fileID: 2747490485186217365}
- {fileID: 2747490484821474612}
- {fileID: 982403919}
m_Father: {fileID: 7796409946673122438}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: -1.5, z: 0}

m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!108 &2422043545997271284
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6903311150269024995}
m_Enabled: 1
serializedVersion: 10
m_Type: 2
m_Shape: 0
m_Color: {r: 1, g: 0.68598413, b: 0, a: 1}
m_Intensity: 8
m_Range: 3
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!108 &9104824145165666882
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7541092914124230072}
m_Enabled: 1
serializedVersion: 10
m_Type: 2
m_Shape: 0
m_Color: {r: 1, g: 0.68598413, b: 0, a: 1}
m_Intensity: 8
m_Range: 3
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &7796409946673122439
GameObject:
m_ObjectHideFlags: 0

m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &7796409947774005653
Transform:
m_ObjectHideFlags: 0

m_ActionName: Player Action Map/Walk[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d,/DualShock4GamepadHID/leftStick]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 1d14cda7-c4b3-4bb4-9ebb-f197aa5ed183
m_ActionName: Player Action Map/DashLeft[/DualShock4GamepadHID/leftShoulder]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 96db7975-8803-410a-863b-5f25b31019f4
m_ActionName: Player Action Map/DashRight[/DualShock4GamepadHID/rightShoulder]
- m_PersistentCalls:
m_Calls: []
m_ActionId: d2faa0a0-e027-4a5d-a155-870bb0ceaf7c
m_ActionName: Player Action Map/Jump[/DualShock4GamepadHID/buttonSouth,/Keyboard/j]
- m_PersistentCalls:

m_Calls: []
m_ActionId: 82551a02-e3e9-4ef0-92d8-21d784984a6e
m_ActionName: Player Action Map/Restart[/Keyboard/r]
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_MethodName: ToggleControlsUI
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: bd885a35-fff9-4afb-a855-24fb9f6006c7
m_ActionName: UI/Controls[/Keyboard/c,/XboxOneGampadMacOSWireless/start]
m_DefaultActionMap: Player Action Map
m_DefaultActionMap: Player
m_SplitScreenIndex: -1
m_Camera: {fileID: 1828481695}
--- !u!1 &7796409948114465862

821
Project/Assets/ML-Agents/Examples/FPS_Game/Scenes/FPS_Game.unity
文件差异内容过多而无法显示
查看文件

3
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/GameController.cs


using UnityEngine.SceneManagement;
public class GameController : MonoBehaviour
{
//NOT IMPLEMENTED YET;
[Header("GRAPHICS")] public bool TurnOffFancyGraphics; //turns off expensive graphics/particle effects
[Header("GLOBAL SETTINGS")]
public List<Rigidbody> AllRBsList = new List<Rigidbody>();

17
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/UI/UIShowControls.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
private FPSPlayerInputActions inputActions;
inputActions = new FPSPlayerInputActions();
void OnEnable()
{
inputActions.Enable();
}
private void OnDisable()
{
inputActions.Disable();
}
// Update is called once per frame
// // Update is called once per frame
if (Input.GetKeyDown(KeyCode.C))
if (inputActions.UI.Controls.triggered)
// if (Input.GetKeyDown(KeyCode.C))
{
ToggleControlsUI();
}
正在加载...
取消
保存