浏览代码

refactor & cleanup

/develop/dodgeball-tests
HH 4 年前
当前提交
f93d5041
共有 19 个文件被更改,包括 2308 次插入591 次删除
  1. 7
      Project/Assets/InputSystem.inputsettings.asset
  2. 89
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions.cs
  3. 79
      Project/Assets/ML-Agents/Examples/Dodgeball/Scenes/Dodgeball.unity
  4. 160
      Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/AgentCubeMovement.cs
  5. 6
      Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/DodgeBallAgent.cs
  6. 23
      Project/Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.cs
  7. 2
      Project/Packages/manifest.json
  8. 15
      Project/Packages/packages-lock.json
  9. 104
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallAgentInput.cs
  10. 11
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallAgentInput.cs.meta
  11. 597
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.cs
  12. 11
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.cs.meta
  13. 369
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.inputactions
  14. 597
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.cs
  15. 11
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.cs.meta
  16. 369
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.inputactions
  17. 14
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.inputactions.meta
  18. 435
      Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions.inputactions
  19. 0
      /Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.inputactions.meta

7
Project/Assets/InputSystem.inputsettings.asset


m_Name: InputSystem.inputsettings
m_EditorClassIdentifier:
m_SupportedDevices: []
m_UpdateMode: 1
m_UpdateMode: 2
m_ButtonReleaseThreshold: 0.75
m_iOSSettings:
m_MotionUsage:
m_Enabled: 0
m_Description:

89
Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions.cs


// GENERATED AUTOMATICALLY FROM 'Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions'
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.1.0
// from Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;

public class @FPSPlayerInputActions : IInputActionCollection, IDisposable
public partial class @FPSPlayerInputActions : IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @FPSPlayerInputActions()

""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""2D Vector"",
""id"": ""d57815af-cec9-4306-87c4-568f60807b45"",
""path"": ""2DVector"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""b6d18645-6807-4991-b13d-6e1addc4e093"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""be675877-3d2f-4642-9224-2c1fe51b714f"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""277acb78-4db0-4c29-aa86-7777017df8d6"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""f92a1f57-10ef-4a5e-adcf-d8fdfa581ed6"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""bf1e5311-a90f-41fa-a9ed-c1359df17f24"",
""path"": """",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},

public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// Player

79
Project/Assets/ML-Agents/Examples/Dodgeball/Scenes/Dodgeball.unity


m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 884017384}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &886896009 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6960991000376283098, guid: 1c6bcdaf8b76745d8918fc47c464885e,
type: 3}
m_PrefabInstance: {fileID: 8366924174629554752}
m_PrefabAsset: {fileID: 0}
--- !u!114 &886896010
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 886896009}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f3d133f7ef3e34484b28a9e1605e48ab, type: 3}
m_Name:
m_EditorClassIdentifier:
DisableInput: 0
moveInput: {x: 0, y: 0}
shootInput: 0
jumpInput: 0
dashInput: 0
rotateInput: {x: 0, y: 0}
shieldInput: 0
Cam: {fileID: 8697938321410268831}
shootPressed: 0
--- !u!1 &901937412
GameObject:
m_ObjectHideFlags: 0

m_BrainParameters:
VectorObservationSize: 0
NumStackedVectorObservations: 1
VectorActionSize: 07000000
m_ActionSpec:
m_NumContinuousActions: 0
BranchSizes:
VectorActionSize:
VectorActionSpaceType: 1
VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 0}
m_InferenceDevice: 0
m_BehaviorType: 0

ThrowController: {fileID: 88758117}
AgentHealth: {fileID: 1898276579}
AgentShield: {fileID: 1898276580}
input: {fileID: 1898276577}
input: {fileID: 0}
currentNumberOfBalls: 0
currentlyHeldBalls: []
UseVectorObs: 0

m_BrainParameters:
VectorObservationSize: 0
NumStackedVectorObservations: 1
VectorActionSize: 07000000
m_ActionSpec:
m_NumContinuousActions: 0
BranchSizes:
VectorActionSize:
VectorActionSpaceType: 1
VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 0}
m_InferenceDevice: 0
m_BehaviorType: 0

type: 3}
m_PrefabInstance: {fileID: 8366924174629554752}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_GameObject: {fileID: 886896009}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b99d81144ad24d58ae2783dbdfa24a8, type: 3}

m_BrainParameters:
VectorObservationSize: 0
NumStackedVectorObservations: 1
VectorActionSize: 07000000
m_ActionSpec:
m_NumContinuousActions: 0
BranchSizes:
VectorActionSize:
VectorActionSpaceType: 1
VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 0}
m_InferenceDevice: 0
m_BehaviorType: 0

m_BrainParameters:
VectorObservationSize: 32
NumStackedVectorObservations: 1
VectorActionSize: 14000000
m_ActionSpec:
m_NumContinuousActions: 0
BranchSizes:
VectorActionSize:
VectorActionSpaceType: 1
VectorActionSpaceType: 0
hasUpgradedBrainParametersWithActionSpec: 1
m_Model: {fileID: 11400000, guid: 53b79c6f40aeb46e693e7c1822ff1047, type: 3}
m_InferenceDevice: 0
m_BehaviorType: 0

propertyPath: m_BrainParameters.VectorActionSize.Array.data[0]
value: 5
objectReference: {fileID: 0}
- target: {fileID: 6960991000376283046, guid: 1c6bcdaf8b76745d8918fc47c464885e,
type: 3}
propertyPath: m_InferenceDevice
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6960991000376283046, guid: 1c6bcdaf8b76745d8918fc47c464885e,
type: 3}
propertyPath: m_BehaviorType
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6960991000376283092, guid: 1c6bcdaf8b76745d8918fc47c464885e,
type: 3}
propertyPath: cam

propertyPath: UseVectorObs
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6960991000376283102, guid: 1c6bcdaf8b76745d8918fc47c464885e,
type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8366924173548761677, guid: 1c6bcdaf8b76745d8918fc47c464885e,
type: 3}
propertyPath: m_LocalPosition.z

objectReference: {fileID: 327417535}
m_RemovedComponents:
- {fileID: 3559664885741895587, guid: 1c6bcdaf8b76745d8918fc47c464885e, type: 3}
- {fileID: 6960991000376283100, guid: 1c6bcdaf8b76745d8918fc47c464885e, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 1c6bcdaf8b76745d8918fc47c464885e, type: 3}
--- !u!33 &8600386897362527026
MeshFilter:

160
Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/AgentCubeMovement.cs


// lookDir += Input.GetKey(KeyCode.D) ? Vector3.right : Vector3.zero;
// lookDir += Input.GetKey(KeyCode.A) ? Vector3.left : Vector3.zero;
//BODY ROTATION
lookDir = Input.GetAxisRaw("Horizontal");
//FORWARD MOVEMENT
inputV = Input.GetAxisRaw("Vertical");
// //BODY ROTATION
// lookDir = Input.GetAxisRaw("Horizontal");
//LATERAL MOVEMENT
inputH = 0;
// inputH += Input.GetKey(KeyCode.Q) ? -1 : 0;
// inputH += Input.GetKey(KeyCode.E) ? 1 : 0;
inputH += Input.GetKeyDown(KeyCode.Q) ? -1 : 0;
inputH += Input.GetKeyDown(KeyCode.E) ? 1 : 0;
// //FORWARD MOVEMENT
// inputV = Input.GetAxisRaw("Vertical");
// inputH = Input.GetAxisRaw("Horizontal");
//
// //LATERAL MOVEMENT
// inputH = 0;
// // inputH += Input.GetKey(KeyCode.Q) ? -1 : 0;
// // inputH += Input.GetKey(KeyCode.E) ? 1 : 0;
// inputH += Input.GetKeyDown(KeyCode.Q) ? -1 : 0;
// inputH += Input.GetKeyDown(KeyCode.E) ? 1 : 0;
// moveDir = transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));
// lookDir = Input.GetKey(KeyCode.A)?
// var moveLateral = Vector3.zero;

// rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationX = ClampAngle(rotationX, minimumX, maximumX);
rotationY = ClampAngle(rotationY, minimumY, maximumY);
Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, -Vector3.right);
transform.localRotation = originalRotation * xQuaternion * yQuaternion;
print("look");
}
public bool applyStandingForce = false;

{
if (axes == RotationAxes.MouseXAndY)
{
Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, -Vector3.right);

Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
transform.localRotation = originalRotation * xQuaternion;
}
else
{
// rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
// rotationY = ClampAngle(rotationY, minimumY, maximumY);
Quaternion yQuaternion = Quaternion.AngleAxis(-rotationY, Vector3.right);
transform.localRotation = originalRotation * yQuaternion;
}
// else
// {
// // rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
// // rotationY = ClampAngle(rotationY, minimumY, maximumY);
//
// Quaternion yQuaternion = Quaternion.AngleAxis(-rotationY, Vector3.right);
// transform.localRotation = originalRotation * yQuaternion;
// }
}

// }
//
// }
if (lookDir != 0)
{
if (!spinAttack)
{
//// var rot = rb.rotation * Quaternion.Euler(0, lookDir * agentRotationSpeed * Time.fixedDeltaTime, 0);
// var walkingBackwardsCoeff = 1;
// if (invertRotationIfWalkingBackwards && inputV < 0)
// {
// walkingBackwardsCoeff = -1;
// }
//
//// var rot = rb.rotation * Quaternion.Euler(0, lookDir * agentRotationSpeed * walkingBackwardsCoeff * Time.fixedDeltaTime, 0);
//// rb.MoveRotation(rot);
//// var rot = rb.rotation * Quaternion.Euler(0, lookDir * agentRotationSpeed * walkingBackwardsCoeff * Time.fixedDeltaTime, 0);
// rb.MoveRotation( Quaternion.Euler(0, lookDir * agentRotationSpeed * walkingBackwardsCoeff * Time.fixedDeltaTime, 0));
RotateBody(lookDir, inputV);
// print("rotating");
// rb.rotation *= Quaternion.AngleAxis(); rb.rotation * Quaternion. (rb.rotation, rot, agentRotationSpeed * Time.fixedDeltaTime);
}
//////GET INPUT
}
if (inputH != 0)
{
//FORWARD MOVEMENT
inputV = Input.GetAxisRaw("Vertical");
inputH = Input.GetAxisRaw("Horizontal");
Strafe(transform.right * inputH);
}
// //LATERAL MOVEMENT
// inputH = 0;
// // inputH += Input.GetKey(KeyCode.Q) ? -1 : 0;
// // inputH += Input.GetKey(KeyCode.E) ? 1 : 0;
// inputH += Input.GetKeyDown(KeyCode.Q) ? -1 : 0;
// inputH += Input.GetKeyDown(KeyCode.E) ? 1 : 0;
var moveDir = transform.TransformDirection(new Vector3(inputH, 0, inputV));
if (inputV != 0)
{
// if (lookDir != 0)
// {
// if (!spinAttack)
// {
// //// var rot = rb.rotation * Quaternion.Euler(0, lookDir * agentRotationSpeed * Time.fixedDeltaTime, 0);
// // var walkingBackwardsCoeff = 1;
// // if (invertRotationIfWalkingBackwards && inputV < 0)
// // {
// // walkingBackwardsCoeff = -1;
// // }
// //
// //// var rot = rb.rotation * Quaternion.Euler(0, lookDir * agentRotationSpeed * walkingBackwardsCoeff * Time.fixedDeltaTime, 0);
// //// rb.MoveRotation(rot);
// //// var rot = rb.rotation * Quaternion.Euler(0, lookDir * agentRotationSpeed * walkingBackwardsCoeff * Time.fixedDeltaTime, 0);
// // rb.MoveRotation( Quaternion.Euler(0, lookDir * agentRotationSpeed * walkingBackwardsCoeff * Time.fixedDeltaTime, 0));
//
// RotateBody(lookDir, inputV);
// // print("rotating");
//
// // rb.rotation *= Quaternion.AngleAxis(); rb.rotation * Quaternion. (rb.rotation, rot, agentRotationSpeed * Time.fixedDeltaTime);
// }
//
// }
// moveDir = transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));
// var dir = cam.transform.TransformDirection(new Vector3(inputH, 0, inputV));
// var dir = cam.transform.TransformDirection(new Vector3(0, 0, inputV));
var dir = transform.forward * inputV;
// dir.y = 0;
//HANDLE WALKING
RunOnGround(rb, dir.normalized);
// if (AnimateBodyMesh)
// {
// bodyMesh.localPosition = Vector3.zero +
// Vector3.up * walkingAnimScale * walkingBounceCurve.Evaluate(
// m_animateBodyMeshCurveTimer);
// m_animateBodyMeshCurveTimer += Time.fixedDeltaTime;
// }
// print("running");
RunOnGround(moveDir);
else
{
RunInAir(rb, dir.normalized);
}
}
// else
// {
// RunInAir(dir.normalized);
// }
// if (inputV != 0)
// {
//
// // var dir = cam.transform.TransformDirection(new Vector3(inputH, 0, inputV));
// // var dir = cam.transform.TransformDirection(new Vector3(0, 0, inputV));
// var dir = transform.forward * inputV;
// // dir.y = 0;
// //HANDLE WALKING
// if (groundCheck.isGrounded)
// {
// RunOnGround(rb, dir.normalized);
// // if (AnimateBodyMesh)
// // {
// // bodyMesh.localPosition = Vector3.zero +
// // Vector3.up * walkingAnimScale * walkingBounceCurve.Evaluate(
// // m_animateBodyMeshCurveTimer);
// // m_animateBodyMeshCurveTimer += Time.fixedDeltaTime;
// // }
// // print("running");
// }
// else
// {
// RunInAir(rb, dir.normalized);
// }
// }
// else //is idle
// {
//

// private float agentVel;
public void RunOnGround(Vector3 dir)
{
print(dir);
if (dir == Vector3.zero)
{
if (AnimateBodyMesh)

}
public void RunOnGround(Rigidbody rb, Vector3 dir)
{
print(dir);
if (dir == Vector3.zero)
{
if (AnimateBodyMesh)

6
Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/DodgeBallAgent.cs


[Header("SHIELD")] public ShieldController AgentShield;
[Header("INPUT")]
public FPSAgentInput input;
public DodgeBallAgentInput input;
[Header("INVENTORY")]
public int currentNumberOfBalls;

// m_Cam = Camera.main;
m_AgentRb = GetComponent<Rigidbody>();
input = GetComponent<FPSAgentInput>();
input = GetComponent<DodgeBallAgentInput>();
m_GameController = FindObjectOfType<DodgeBallGameController>();
m_StartingPos = transform.position;
m_StartingRot = transform.rotation;

m_ThrowInput = act[3];
m_DashInput = act[4];
// print($"{m_InputV} {m_InputH}");
//HANDLE ROTATION
m_CubeMovement.Look(m_Rotate);

contActionsOut[1] = input.moveInput.x;
// contActionsOut[2] = input.rotateInput.x; //rotate
contActionsOut[2] = input.rotateInput.x; //rotate
print(input.rotateInput.x);
// contActionsOut[3] = input.shootInput ? 1 : 0; //shoot
contActionsOut[3] = input.shootPressed ? 1 : 0; //shoot
// contActionsOut[3] = input.CheckIfInputSinceLastFrame(ref input.shootInput) ? 1 : 0; //jump

23
Project/Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.cs


// GENERATED AUTOMATICALLY FROM 'Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.inputactions'
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.1.0
// from Assets/Samples/Input System/1.0.1/Simple Demo/SimpleControls.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;

public class @SimpleControls : IInputActionCollection, IDisposable
public partial class @SimpleControls : IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @SimpleControls()

public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// gameplay

2
Project/Packages/manifest.json


"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "3.0.4",
"com.unity.ide.vscode": "1.2.3",
"com.unity.inputsystem": "1.0.2",
"com.unity.inputsystem": "1.1.0-preview.3",
"com.unity.ml-agents": "file:../../com.unity.ml-agents",
"com.unity.ml-agents.extensions": "file:../../com.unity.ml-agents.extensions",
"com.unity.multiplayer-hlapi": "1.0.6",

15
Project/Packages/packages-lock.json


"url": "https://packages.unity.com"
},
"com.unity.barracuda": {
"version": "1.1.2-preview",
"version": "1.3.1-preview",
"com.unity.burst": "1.3.4"
"com.unity.burst": "1.3.4",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0"
},
"url": "https://packages.unity.com"
},

"url": "https://packages.unity.com"
},
"com.unity.inputsystem": {
"version": "1.0.2",
"version": "1.1.0-preview.3",
"depth": 0,
"source": "registry",
"dependencies": {},

"depth": 0,
"source": "local",
"dependencies": {
"com.unity.barracuda": "1.1.2-preview",
"com.unity.barracuda": "1.3.1-preview",
"com.unity.modules.physics2d": "1.0.0"
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0"
}
},
"com.unity.ml-agents.extensions": {

"dependencies": {
"com.unity.ml-agents": "1.5.0-preview"
"com.unity.ml-agents": "1.8.0-preview"
}
},
"com.unity.multiplayer-hlapi": {

104
Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallAgentInput.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
//[ExecuteAlways]
public class DodgeBallAgentInput : MonoBehaviour
{
public bool DisableInput = false;
private DodgeBallInputActions inputActions;
private DodgeBallInputActions.PlayerActions actionMap;
private Gamepad gamepad;
public Vector2 moveInput;
public bool shootInput;
public bool jumpInput;
public bool dashInput;
public Vector2 rotateInput;
public bool shieldInput;
// public Vector2 rotateVector2;
public Camera Cam;
// Start is called before the first frame update
void Awake()
{
inputActions = new DodgeBallInputActions();
actionMap = inputActions.Player;
Cursor.lockState = CursorLockMode.Locked;
}
void OnEnable()
{
gamepad = Gamepad.current;
inputActions.Enable();
}
private void OnDisable()
{
inputActions.Disable();
}
public bool CheckIfInputSinceLastFrame(ref bool input)
{
if (input)
{
input = false;
return true;
}
return false;
}
// public bool JumpCheck(ref bool input)
// {
// if (jumped)
// {
// jumped = false;
// return true;
// }
// return false;
// }
void Update()
{
if (inputActions.UI.Restart.triggered)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
public bool shootPressed;
// Update is called once per frame
void FixedUpdate()
{
// Vector2 move = gamepad.leftStick.ReadValue();
if (DisableInput)
{
return;
}
moveInput = actionMap.Walk.ReadValue<Vector2>();
shootInput = actionMap.Shoot.ReadValue<float>() > 0;
// shootPressed = actionMap.Shoot.triggered;
shootPressed = actionMap.Shoot.phase == InputActionPhase.Started;
// shootInput = gamepad.rightTrigger.isPressed;
shieldInput = actionMap.Shield.ReadValue<float>() > 0;
// rotateInput = actionMap.RotateBody.ReadValue<Vector2>();
// rotateInput = actionMap.Rotate.ReadValue<float>() * .1f;
// rotateInput = actionMap.Rotate.ReadValue<float>();
// rotateVector2 = actionMap.Rotate.ReadValue<Vector2>();
rotateInput = actionMap.Rotate.ReadValue<Vector2>();
// rotateInput = rotateVector2.x;
// rotateInput = actionMap.RotateBody.ReadValue<Vector2>();
// jumpInput = actionMap.Jump.ReadValue<float>() > 0;
// jumpInput = actionMap.Jump.triggered;
if (actionMap.Dash.triggered)
{
dashInput = true;
}
if (actionMap.Jump.triggered)
{
jumpInput = true;
}
}
}

11
Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallAgentInput.cs.meta


fileFormatVersion: 2
guid: f3d133f7ef3e34484b28a9e1605e48ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

597
Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.cs


//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.1.0
// from Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @DodgeBallInputActions : IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @DodgeBallInputActions()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""DodgeBallInputActions"",
""maps"": [
{
""name"": ""Player"",
""id"": ""bb797917-97ca-47e1-b3c9-0572380e9376"",
""actions"": [
{
""name"": ""Walk"",
""type"": ""Value"",
""id"": ""2f9ecc77-85d9-4189-8faf-18dcf905d2d4"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Jump"",
""type"": ""Button"",
""id"": ""d2faa0a0-e027-4a5d-a155-870bb0ceaf7c"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Shoot"",
""type"": ""Button"",
""id"": ""cbcb2a57-a474-46a7-b133-cf144f6de321"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Shield"",
""type"": ""Button"",
""id"": ""ec97db61-8659-49c6-afaa-20b82a98e72b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Dash"",
""type"": ""Button"",
""id"": ""49d5245a-a350-4f94-b4c8-cf578d61000b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""RotateOld"",
""type"": ""Value"",
""id"": ""b309ca48-95aa-4032-bd7d-46dcaeb138d0"",
""expectedControlType"": ""Axis"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Rotate"",
""type"": ""Value"",
""id"": ""7172bb7c-a5ae-46b9-af48-2f521eb69773"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
{
""name"": ""2D Vector"",
""id"": ""f7a4010c-91c6-422f-91e7-4b14cbdb214a"",
""path"": ""2DVector(mode=2)"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""0067bacb-5284-4358-8fbf-cbbd17bd4884"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""5e100fc2-94e3-4f73-8020-b6cbeed41b97"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""5eb9d69e-8df8-443c-93f4-447eeb52b75f"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""3b4de59c-d93c-4072-b11e-711ea8534593"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""6fdb596c-c0bb-4f37-b409-c235e9612acf"",
""path"": ""<Gamepad>/leftStick"",
""interactions"": """",
""processors"": ""StickDeadzone"",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""28ddf0bd-ea22-4069-ba60-ca41d4742bf9"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""6f4a5988-5e01-4c66-a3ab-f4b5e47bd21f"",
""path"": ""<Keyboard>/j"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""fe641861-0da7-43ba-8bd6-e95a17232a77"",
""path"": ""<Gamepad>/rightTrigger"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2ae82452-d746-4a28-86f4-43c469c78eff"",
""path"": ""<Keyboard>/k"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f3b10de9-a5c7-4952-b617-d46c6132d174"",
""path"": ""<Mouse>/leftButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2b94ae52-9bb0-478e-8e4c-bf6c747a5c7d"",
""path"": ""<Gamepad>/rightShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shield"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""75b3d327-54da-4b56-a39e-052b1c173b56"",
""path"": ""<Keyboard>/i"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shield"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""319796b1-6071-46f0-81dc-58b6bdb7d86a"",
""path"": ""<Gamepad>/leftTrigger"",
""interactions"": ""Press(pressPoint=0.5)"",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ae8dc5a5-930d-412e-a196-627e63bfcd0c"",
""path"": ""<Keyboard>/l"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""3eaa9db8-9821-49ea-b640-0434a871fb19"",
""path"": ""<Mouse>/rightButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ac165f0a-fa27-4311-b148-2689537b942b"",
""path"": ""<Pointer>/delta/x"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""1D Axis"",
""id"": ""a788bd05-d81e-47f4-a14c-5cb071e21c96"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""9844ff0b-6a74-43bb-a969-9f59c74212b9"",
""path"": ""<Gamepad>/rightStick/left"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""b81e038b-8786-4bbe-bb1d-aba1d54112d1"",
""path"": ""<Gamepad>/rightStick/right"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""4e9015a8-9ef1-4f5b-8776-ed1f246ce741"",
""path"": ""<Pointer>/delta"",
""interactions"": """",
""processors"": ""ScaleVector2(x=2,y=2)"",
""groups"": """",
""action"": ""Rotate"",
""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"": """"
},
{
""name"": ""Restart"",
""type"": ""Button"",
""id"": ""e94117bb-34b9-400e-98a4-5bcdc0e1ef18"",
""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
},
{
""name"": """",
""id"": ""3558b9e6-24b3-420a-95a3-0bfd03222ba6"",
""path"": ""<Keyboard>/r"",
""interactions"": ""Press"",
""processors"": """",
""groups"": """",
""action"": ""Restart"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""b3ee58f5-8a7d-40c9-abc6-6694d289683d"",
""path"": ""<Gamepad>/buttonNorth"",
""interactions"": ""Press"",
""processors"": """",
""groups"": """",
""action"": ""Restart"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// 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_Dash = m_Player.FindAction("Dash", throwIfNotFound: true);
m_Player_RotateOld = m_Player.FindAction("RotateOld", throwIfNotFound: true);
m_Player_Rotate = m_Player.FindAction("Rotate", throwIfNotFound: true);
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Controls = m_UI.FindAction("Controls", throwIfNotFound: true);
m_UI_Restart = m_UI.FindAction("Restart", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// 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_Dash;
private readonly InputAction m_Player_RotateOld;
private readonly InputAction m_Player_Rotate;
public struct PlayerActions
{
private @DodgeBallInputActions m_Wrapper;
public PlayerActions(@DodgeBallInputActions 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 @Dash => m_Wrapper.m_Player_Dash;
public InputAction @RotateOld => m_Wrapper.m_Player_RotateOld;
public InputAction @Rotate => m_Wrapper.m_Player_Rotate;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
public void SetCallbacks(IPlayerActions instance)
{
if (m_Wrapper.m_PlayerActionsCallbackInterface != null)
{
@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;
@Dash.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Dash.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Dash.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@RotateOld.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateOld;
@RotateOld.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateOld;
@RotateOld.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateOld;
@Rotate.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Rotate.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Rotate.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
}
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
if (instance != null)
{
@Walk.started += instance.OnWalk;
@Walk.performed += instance.OnWalk;
@Walk.canceled += instance.OnWalk;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
@Shoot.started += instance.OnShoot;
@Shoot.performed += instance.OnShoot;
@Shoot.canceled += instance.OnShoot;
@Shield.started += instance.OnShield;
@Shield.performed += instance.OnShield;
@Shield.canceled += instance.OnShield;
@Dash.started += instance.OnDash;
@Dash.performed += instance.OnDash;
@Dash.canceled += instance.OnDash;
@RotateOld.started += instance.OnRotateOld;
@RotateOld.performed += instance.OnRotateOld;
@RotateOld.canceled += instance.OnRotateOld;
@Rotate.started += instance.OnRotate;
@Rotate.performed += instance.OnRotate;
@Rotate.canceled += instance.OnRotate;
}
}
}
public PlayerActions @Player => new PlayerActions(this);
// UI
private readonly InputActionMap m_UI;
private IUIActions m_UIActionsCallbackInterface;
private readonly InputAction m_UI_Controls;
private readonly InputAction m_UI_Restart;
public struct UIActions
{
private @DodgeBallInputActions m_Wrapper;
public UIActions(@DodgeBallInputActions wrapper) { m_Wrapper = wrapper; }
public InputAction @Controls => m_Wrapper.m_UI_Controls;
public InputAction @Restart => m_Wrapper.m_UI_Restart;
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;
@Restart.started -= m_Wrapper.m_UIActionsCallbackInterface.OnRestart;
@Restart.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnRestart;
@Restart.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnRestart;
}
m_Wrapper.m_UIActionsCallbackInterface = instance;
if (instance != null)
{
@Controls.started += instance.OnControls;
@Controls.performed += instance.OnControls;
@Controls.canceled += instance.OnControls;
@Restart.started += instance.OnRestart;
@Restart.performed += instance.OnRestart;
@Restart.canceled += instance.OnRestart;
}
}
}
public UIActions @UI => new UIActions(this);
public interface IPlayerActions
{
void OnWalk(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
void OnShoot(InputAction.CallbackContext context);
void OnShield(InputAction.CallbackContext context);
void OnDash(InputAction.CallbackContext context);
void OnRotateOld(InputAction.CallbackContext context);
void OnRotate(InputAction.CallbackContext context);
}
public interface IUIActions
{
void OnControls(InputAction.CallbackContext context);
void OnRestart(InputAction.CallbackContext context);
}
}

11
Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.cs.meta


fileFormatVersion: 2
guid: 4acdb3c0ab26d43d597fddbefe15a246
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

369
Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.inputactions


{
"name": "FPSPlayerInputActions",
"maps": [
{
"name": "Player",
"id": "bb797917-97ca-47e1-b3c9-0572380e9376",
"actions": [
{
"name": "Walk",
"type": "Value",
"id": "2f9ecc77-85d9-4189-8faf-18dcf905d2d4",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "Jump",
"type": "Button",
"id": "d2faa0a0-e027-4a5d-a155-870bb0ceaf7c",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Shoot",
"type": "Button",
"id": "cbcb2a57-a474-46a7-b133-cf144f6de321",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Shield",
"type": "Button",
"id": "ec97db61-8659-49c6-afaa-20b82a98e72b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Dash",
"type": "Button",
"id": "49d5245a-a350-4f94-b4c8-cf578d61000b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "RotateOld",
"type": "Value",
"id": "b309ca48-95aa-4032-bd7d-46dcaeb138d0",
"expectedControlType": "Axis",
"processors": "",
"interactions": ""
},
{
"name": "Rotate",
"type": "Value",
"id": "7172bb7c-a5ae-46b9-af48-2f521eb69773",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "2D Vector",
"id": "f7a4010c-91c6-422f-91e7-4b14cbdb214a",
"path": "2DVector(mode=2)",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "0067bacb-5284-4358-8fbf-cbbd17bd4884",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "5e100fc2-94e3-4f73-8020-b6cbeed41b97",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "5eb9d69e-8df8-443c-93f4-447eeb52b75f",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "3b4de59c-d93c-4072-b11e-711ea8534593",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "6fdb596c-c0bb-4f37-b409-c235e9612acf",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "StickDeadzone",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "28ddf0bd-ea22-4069-ba60-ca41d4742bf9",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6f4a5988-5e01-4c66-a3ab-f4b5e47bd21f",
"path": "<Keyboard>/j",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "fe641861-0da7-43ba-8bd6-e95a17232a77",
"path": "<Gamepad>/rightTrigger",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2ae82452-d746-4a28-86f4-43c469c78eff",
"path": "<Keyboard>/k",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f3b10de9-a5c7-4952-b617-d46c6132d174",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2b94ae52-9bb0-478e-8e4c-bf6c747a5c7d",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "75b3d327-54da-4b56-a39e-052b1c173b56",
"path": "<Keyboard>/i",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "319796b1-6071-46f0-81dc-58b6bdb7d86a",
"path": "<Gamepad>/leftTrigger",
"interactions": "Press(pressPoint=0.5)",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ae8dc5a5-930d-412e-a196-627e63bfcd0c",
"path": "<Keyboard>/l",
"interactions": "",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3eaa9db8-9821-49ea-b640-0434a871fb19",
"path": "<Mouse>/rightButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ac165f0a-fa27-4311-b148-2689537b942b",
"path": "<Pointer>/delta/x",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "1D Axis",
"id": "a788bd05-d81e-47f4-a14c-5cb071e21c96",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "9844ff0b-6a74-43bb-a969-9f59c74212b9",
"path": "<Gamepad>/rightStick/left",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "b81e038b-8786-4bbe-bb1d-aba1d54112d1",
"path": "<Gamepad>/rightStick/right",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "4e9015a8-9ef1-4f5b-8776-ed1f246ce741",
"path": "<Pointer>/delta",
"interactions": "",
"processors": "ScaleVector2(x=2,y=2)",
"groups": "",
"action": "Rotate",
"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": ""
},
{
"name": "Restart",
"type": "Button",
"id": "e94117bb-34b9-400e-98a4-5bcdc0e1ef18",
"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
},
{
"name": "",
"id": "3558b9e6-24b3-420a-95a3-0bfd03222ba6",
"path": "<Keyboard>/r",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "b3ee58f5-8a7d-40c9-abc6-6694d289683d",
"path": "<Gamepad>/buttonNorth",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
}

597
Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.cs


//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.1.0
// from Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @FPSPlayerInputActions1 : IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @FPSPlayerInputActions1()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""FPSPlayerInputActions 1"",
""maps"": [
{
""name"": ""Player"",
""id"": ""bb797917-97ca-47e1-b3c9-0572380e9376"",
""actions"": [
{
""name"": ""Walk"",
""type"": ""Value"",
""id"": ""2f9ecc77-85d9-4189-8faf-18dcf905d2d4"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Jump"",
""type"": ""Button"",
""id"": ""d2faa0a0-e027-4a5d-a155-870bb0ceaf7c"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Shoot"",
""type"": ""Button"",
""id"": ""cbcb2a57-a474-46a7-b133-cf144f6de321"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Shield"",
""type"": ""Button"",
""id"": ""ec97db61-8659-49c6-afaa-20b82a98e72b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Dash"",
""type"": ""Button"",
""id"": ""49d5245a-a350-4f94-b4c8-cf578d61000b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""RotateOld"",
""type"": ""Value"",
""id"": ""b309ca48-95aa-4032-bd7d-46dcaeb138d0"",
""expectedControlType"": ""Axis"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Rotate"",
""type"": ""Value"",
""id"": ""7172bb7c-a5ae-46b9-af48-2f521eb69773"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
{
""name"": ""2D Vector"",
""id"": ""f7a4010c-91c6-422f-91e7-4b14cbdb214a"",
""path"": ""2DVector(mode=2)"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""0067bacb-5284-4358-8fbf-cbbd17bd4884"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""5e100fc2-94e3-4f73-8020-b6cbeed41b97"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""5eb9d69e-8df8-443c-93f4-447eeb52b75f"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""3b4de59c-d93c-4072-b11e-711ea8534593"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""6fdb596c-c0bb-4f37-b409-c235e9612acf"",
""path"": ""<Gamepad>/leftStick"",
""interactions"": """",
""processors"": ""StickDeadzone"",
""groups"": """",
""action"": ""Walk"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""28ddf0bd-ea22-4069-ba60-ca41d4742bf9"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""6f4a5988-5e01-4c66-a3ab-f4b5e47bd21f"",
""path"": ""<Keyboard>/j"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""fe641861-0da7-43ba-8bd6-e95a17232a77"",
""path"": ""<Gamepad>/rightTrigger"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2ae82452-d746-4a28-86f4-43c469c78eff"",
""path"": ""<Keyboard>/k"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f3b10de9-a5c7-4952-b617-d46c6132d174"",
""path"": ""<Mouse>/leftButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2b94ae52-9bb0-478e-8e4c-bf6c747a5c7d"",
""path"": ""<Gamepad>/rightShoulder"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shield"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""75b3d327-54da-4b56-a39e-052b1c173b56"",
""path"": ""<Keyboard>/i"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shield"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""319796b1-6071-46f0-81dc-58b6bdb7d86a"",
""path"": ""<Gamepad>/leftTrigger"",
""interactions"": ""Press(pressPoint=0.5)"",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ae8dc5a5-930d-412e-a196-627e63bfcd0c"",
""path"": ""<Keyboard>/l"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""3eaa9db8-9821-49ea-b640-0434a871fb19"",
""path"": ""<Mouse>/rightButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ac165f0a-fa27-4311-b148-2689537b942b"",
""path"": ""<Pointer>/delta/x"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": ""1D Axis"",
""id"": ""a788bd05-d81e-47f4-a14c-5cb071e21c96"",
""path"": ""1DAxis"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""9844ff0b-6a74-43bb-a969-9f59c74212b9"",
""path"": ""<Gamepad>/rightStick/left"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""b81e038b-8786-4bbe-bb1d-aba1d54112d1"",
""path"": ""<Gamepad>/rightStick/right"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""RotateOld"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""4e9015a8-9ef1-4f5b-8776-ed1f246ce741"",
""path"": ""<Pointer>/delta"",
""interactions"": """",
""processors"": ""ScaleVector2(x=2,y=2)"",
""groups"": """",
""action"": ""Rotate"",
""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"": """"
},
{
""name"": ""Restart"",
""type"": ""Button"",
""id"": ""e94117bb-34b9-400e-98a4-5bcdc0e1ef18"",
""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
},
{
""name"": """",
""id"": ""3558b9e6-24b3-420a-95a3-0bfd03222ba6"",
""path"": ""<Keyboard>/r"",
""interactions"": ""Press"",
""processors"": """",
""groups"": """",
""action"": ""Restart"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""b3ee58f5-8a7d-40c9-abc6-6694d289683d"",
""path"": ""<Gamepad>/buttonNorth"",
""interactions"": ""Press"",
""processors"": """",
""groups"": """",
""action"": ""Restart"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// 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_Dash = m_Player.FindAction("Dash", throwIfNotFound: true);
m_Player_RotateOld = m_Player.FindAction("RotateOld", throwIfNotFound: true);
m_Player_Rotate = m_Player.FindAction("Rotate", throwIfNotFound: true);
// UI
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
m_UI_Controls = m_UI.FindAction("Controls", throwIfNotFound: true);
m_UI_Restart = m_UI.FindAction("Restart", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// 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_Dash;
private readonly InputAction m_Player_RotateOld;
private readonly InputAction m_Player_Rotate;
public struct PlayerActions
{
private @FPSPlayerInputActions1 m_Wrapper;
public PlayerActions(@FPSPlayerInputActions1 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 @Dash => m_Wrapper.m_Player_Dash;
public InputAction @RotateOld => m_Wrapper.m_Player_RotateOld;
public InputAction @Rotate => m_Wrapper.m_Player_Rotate;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(PlayerActions set) { return set.Get(); }
public void SetCallbacks(IPlayerActions instance)
{
if (m_Wrapper.m_PlayerActionsCallbackInterface != null)
{
@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;
@Dash.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Dash.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@Dash.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnDash;
@RotateOld.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateOld;
@RotateOld.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateOld;
@RotateOld.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotateOld;
@Rotate.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Rotate.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
@Rotate.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRotate;
}
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
if (instance != null)
{
@Walk.started += instance.OnWalk;
@Walk.performed += instance.OnWalk;
@Walk.canceled += instance.OnWalk;
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
@Shoot.started += instance.OnShoot;
@Shoot.performed += instance.OnShoot;
@Shoot.canceled += instance.OnShoot;
@Shield.started += instance.OnShield;
@Shield.performed += instance.OnShield;
@Shield.canceled += instance.OnShield;
@Dash.started += instance.OnDash;
@Dash.performed += instance.OnDash;
@Dash.canceled += instance.OnDash;
@RotateOld.started += instance.OnRotateOld;
@RotateOld.performed += instance.OnRotateOld;
@RotateOld.canceled += instance.OnRotateOld;
@Rotate.started += instance.OnRotate;
@Rotate.performed += instance.OnRotate;
@Rotate.canceled += instance.OnRotate;
}
}
}
public PlayerActions @Player => new PlayerActions(this);
// UI
private readonly InputActionMap m_UI;
private IUIActions m_UIActionsCallbackInterface;
private readonly InputAction m_UI_Controls;
private readonly InputAction m_UI_Restart;
public struct UIActions
{
private @FPSPlayerInputActions1 m_Wrapper;
public UIActions(@FPSPlayerInputActions1 wrapper) { m_Wrapper = wrapper; }
public InputAction @Controls => m_Wrapper.m_UI_Controls;
public InputAction @Restart => m_Wrapper.m_UI_Restart;
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;
@Restart.started -= m_Wrapper.m_UIActionsCallbackInterface.OnRestart;
@Restart.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnRestart;
@Restart.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnRestart;
}
m_Wrapper.m_UIActionsCallbackInterface = instance;
if (instance != null)
{
@Controls.started += instance.OnControls;
@Controls.performed += instance.OnControls;
@Controls.canceled += instance.OnControls;
@Restart.started += instance.OnRestart;
@Restart.performed += instance.OnRestart;
@Restart.canceled += instance.OnRestart;
}
}
}
public UIActions @UI => new UIActions(this);
public interface IPlayerActions
{
void OnWalk(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
void OnShoot(InputAction.CallbackContext context);
void OnShield(InputAction.CallbackContext context);
void OnDash(InputAction.CallbackContext context);
void OnRotateOld(InputAction.CallbackContext context);
void OnRotate(InputAction.CallbackContext context);
}
public interface IUIActions
{
void OnControls(InputAction.CallbackContext context);
void OnRestart(InputAction.CallbackContext context);
}
}

11
Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.cs.meta


fileFormatVersion: 2
guid: cb999e38800944006b247a0ac3907685
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

369
Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.inputactions


{
"name": "FPSPlayerInputActions",
"maps": [
{
"name": "Player",
"id": "bb797917-97ca-47e1-b3c9-0572380e9376",
"actions": [
{
"name": "Walk",
"type": "Value",
"id": "2f9ecc77-85d9-4189-8faf-18dcf905d2d4",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "Jump",
"type": "Button",
"id": "d2faa0a0-e027-4a5d-a155-870bb0ceaf7c",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Shoot",
"type": "Button",
"id": "cbcb2a57-a474-46a7-b133-cf144f6de321",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Shield",
"type": "Button",
"id": "ec97db61-8659-49c6-afaa-20b82a98e72b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Dash",
"type": "Button",
"id": "49d5245a-a350-4f94-b4c8-cf578d61000b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "RotateOld",
"type": "Value",
"id": "b309ca48-95aa-4032-bd7d-46dcaeb138d0",
"expectedControlType": "Axis",
"processors": "",
"interactions": ""
},
{
"name": "Rotate",
"type": "Value",
"id": "7172bb7c-a5ae-46b9-af48-2f521eb69773",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "2D Vector",
"id": "f7a4010c-91c6-422f-91e7-4b14cbdb214a",
"path": "2DVector(mode=2)",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "0067bacb-5284-4358-8fbf-cbbd17bd4884",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "5e100fc2-94e3-4f73-8020-b6cbeed41b97",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "5eb9d69e-8df8-443c-93f4-447eeb52b75f",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "3b4de59c-d93c-4072-b11e-711ea8534593",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "6fdb596c-c0bb-4f37-b409-c235e9612acf",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "StickDeadzone",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "28ddf0bd-ea22-4069-ba60-ca41d4742bf9",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6f4a5988-5e01-4c66-a3ab-f4b5e47bd21f",
"path": "<Keyboard>/j",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "fe641861-0da7-43ba-8bd6-e95a17232a77",
"path": "<Gamepad>/rightTrigger",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2ae82452-d746-4a28-86f4-43c469c78eff",
"path": "<Keyboard>/k",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f3b10de9-a5c7-4952-b617-d46c6132d174",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2b94ae52-9bb0-478e-8e4c-bf6c747a5c7d",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "75b3d327-54da-4b56-a39e-052b1c173b56",
"path": "<Keyboard>/i",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "319796b1-6071-46f0-81dc-58b6bdb7d86a",
"path": "<Gamepad>/leftTrigger",
"interactions": "Press(pressPoint=0.5)",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ae8dc5a5-930d-412e-a196-627e63bfcd0c",
"path": "<Keyboard>/l",
"interactions": "",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3eaa9db8-9821-49ea-b640-0434a871fb19",
"path": "<Mouse>/rightButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ac165f0a-fa27-4311-b148-2689537b942b",
"path": "<Pointer>/delta/x",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "1D Axis",
"id": "a788bd05-d81e-47f4-a14c-5cb071e21c96",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "9844ff0b-6a74-43bb-a969-9f59c74212b9",
"path": "<Gamepad>/rightStick/left",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "b81e038b-8786-4bbe-bb1d-aba1d54112d1",
"path": "<Gamepad>/rightStick/right",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "4e9015a8-9ef1-4f5b-8776-ed1f246ce741",
"path": "<Pointer>/delta",
"interactions": "",
"processors": "ScaleVector2(x=2,y=2)",
"groups": "",
"action": "Rotate",
"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": ""
},
{
"name": "Restart",
"type": "Button",
"id": "e94117bb-34b9-400e-98a4-5bcdc0e1ef18",
"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
},
{
"name": "",
"id": "3558b9e6-24b3-420a-95a3-0bfd03222ba6",
"path": "<Keyboard>/r",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "b3ee58f5-8a7d-40c9-abc6-6694d289683d",
"path": "<Gamepad>/buttonNorth",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
}

14
Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions 1.inputactions.meta


fileFormatVersion: 2
guid: db5f4d6de271f472a8175e30e8b62b60
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:

435
Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions.inputactions


{
"name": "FPSPlayerInputActions",
"maps": [
{
"name": "Player",
"id": "bb797917-97ca-47e1-b3c9-0572380e9376",
"actions": [
{
"name": "Walk",
"type": "Value",
"id": "2f9ecc77-85d9-4189-8faf-18dcf905d2d4",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "Jump",
"type": "Button",
"id": "d2faa0a0-e027-4a5d-a155-870bb0ceaf7c",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Shoot",
"type": "Button",
"id": "cbcb2a57-a474-46a7-b133-cf144f6de321",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Shield",
"type": "Button",
"id": "ec97db61-8659-49c6-afaa-20b82a98e72b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "Dash",
"type": "Button",
"id": "49d5245a-a350-4f94-b4c8-cf578d61000b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
},
{
"name": "RotateOld",
"type": "Value",
"id": "b309ca48-95aa-4032-bd7d-46dcaeb138d0",
"expectedControlType": "Axis",
"processors": "",
"interactions": ""
},
{
"name": "Rotate",
"type": "Value",
"id": "7172bb7c-a5ae-46b9-af48-2f521eb69773",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "2D Vector",
"id": "f7a4010c-91c6-422f-91e7-4b14cbdb214a",
"path": "2DVector(mode=2)",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "0067bacb-5284-4358-8fbf-cbbd17bd4884",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "5e100fc2-94e3-4f73-8020-b6cbeed41b97",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "5eb9d69e-8df8-443c-93f4-447eeb52b75f",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "3b4de59c-d93c-4072-b11e-711ea8534593",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "6fdb596c-c0bb-4f37-b409-c235e9612acf",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "StickDeadzone",
"groups": "",
"action": "Walk",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "28ddf0bd-ea22-4069-ba60-ca41d4742bf9",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6f4a5988-5e01-4c66-a3ab-f4b5e47bd21f",
"path": "<Keyboard>/j",
"interactions": "",
"processors": "",
"groups": "",
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "fe641861-0da7-43ba-8bd6-e95a17232a77",
"path": "<Gamepad>/rightTrigger",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2ae82452-d746-4a28-86f4-43c469c78eff",
"path": "<Keyboard>/k",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f3b10de9-a5c7-4952-b617-d46c6132d174",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shoot",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2b94ae52-9bb0-478e-8e4c-bf6c747a5c7d",
"path": "<Gamepad>/rightShoulder",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "75b3d327-54da-4b56-a39e-052b1c173b56",
"path": "<Keyboard>/i",
"interactions": "",
"processors": "",
"groups": "",
"action": "Shield",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "319796b1-6071-46f0-81dc-58b6bdb7d86a",
"path": "<Gamepad>/leftTrigger",
"interactions": "Press(pressPoint=0.5)",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ae8dc5a5-930d-412e-a196-627e63bfcd0c",
"path": "<Keyboard>/l",
"interactions": "",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3eaa9db8-9821-49ea-b640-0434a871fb19",
"path": "<Mouse>/rightButton",
"interactions": "",
"processors": "",
"groups": "",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ac165f0a-fa27-4311-b148-2689537b942b",
"path": "<Pointer>/delta/x",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "1D Axis",
"id": "a788bd05-d81e-47f4-a14c-5cb071e21c96",
"path": "1DAxis",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "9844ff0b-6a74-43bb-a969-9f59c74212b9",
"path": "<Gamepad>/rightStick/left",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "b81e038b-8786-4bbe-bb1d-aba1d54112d1",
"path": "<Gamepad>/rightStick/right",
"interactions": "",
"processors": "",
"groups": "",
"action": "RotateOld",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "4e9015a8-9ef1-4f5b-8776-ed1f246ce741",
"path": "<Pointer>/delta",
"interactions": "",
"processors": "ScaleVector2(x=2,y=2)",
"groups": "",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "2D Vector",
"id": "d57815af-cec9-4306-87c4-568f60807b45",
"path": "2DVector",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "b6d18645-6807-4991-b13d-6e1addc4e093",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "be675877-3d2f-4642-9224-2c1fe51b714f",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "277acb78-4db0-4c29-aa86-7777017df8d6",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "f92a1f57-10ef-4a5e-adcf-d8fdfa581ed6",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "bf1e5311-a90f-41fa-a9ed-c1359df17f24",
"path": "",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"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": ""
},
{
"name": "Restart",
"type": "Button",
"id": "e94117bb-34b9-400e-98a4-5bcdc0e1ef18",
"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
},
{
"name": "",
"id": "3558b9e6-24b3-420a-95a3-0bfd03222ba6",
"path": "<Keyboard>/r",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "b3ee58f5-8a7d-40c9-abc6-6694d289683d",
"path": "<Gamepad>/buttonNorth",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Restart",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
}

/Project/Assets/ML-Agents/Examples/Dodgeball/Input/FPSPlayerInputActions.inputactions.meta → /Project/Assets/ML-Agents/Examples/Dodgeball/Input/DodgeBallInputActions.inputactions.meta

正在加载...
取消
保存