浏览代码

updated input, added dash

/hh-develop-fps_game_project
HH 4 年前
当前提交
f6b37bea
共有 11 个文件被更改,包括 566 次插入59 次删除
  1. 29
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions
  2. 2
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions.meta
  3. 80
      Project/Assets/ML-Agents/Examples/FPS_Game/Scenes/FPS_Game.unity
  4. 18
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/AgentCubeMovement.cs
  5. 32
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/FPSAgent.cs
  6. 52
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSAgentInput.cs
  7. 11
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSAgentInput.cs.meta
  8. 390
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.cs
  9. 11
      Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.cs.meta
  10. 0
      /Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions
  11. 0
      /Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions.meta

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


{
"name": "FPS_Player_InputActions",
"name": "FPSPlayerInputActions",
"maps": [
{
"name": "Player Action Map",

"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
},
{
"name": "Dash",
"type": "Button",
"id": "49d5245a-a350-4f94-b4c8-cf578d61000b",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
}
],
"bindings": [

"id": "6fdb596c-c0bb-4f37-b409-c235e9612acf",
"path": "<Gamepad>/leftStick",
"interactions": "",
"processors": "",
"processors": "StickDeadzone",
"groups": "",
"action": "Walk",
"isComposite": false,

{
"name": "",
"id": "28ddf0bd-ea22-4069-ba60-ca41d4742bf9",
"path": "<Gamepad>/buttonSouth",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "",

{
"name": "",
"id": "fe641861-0da7-43ba-8bd6-e95a17232a77",
"path": "<XInputController>/rightTrigger",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "",

"id": "0c0d917f-0af9-4575-b970-f441fd97db20",
"path": "<Gamepad>/rightStick",
"interactions": "",
"processors": "StickDeadzone",
"groups": "",
"action": "RotateBody",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "319796b1-6071-46f0-81dc-58b6bdb7d86a",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"action": "RotateBody",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
}

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


assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 0
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:

80
Project/Assets/ML-Agents/Examples/FPS_Game/Scenes/FPS_Game.unity


m_ZDamping: 0
m_AngularDampingMode: 0
m_PitchDamping: 0
m_YawDamping: 1
m_YawDamping: 0.15
m_RollDamping: 0
m_AngularDamping: 0
--- !u!4 &763385665401675561

agentRunSpeed: 10
agentTerminalVel: 20
agentRunInAirSpeed: 1
strafeSpeed: 40
strafeSpeed: 20
dashBoostForce: 20
dashForceMode: 1
dashBoostForce: 40
dashForceMode: 2
dashCoolDownDuration: 0.15
dashCoolDownTimer: 0
agentIdleDragVelCoeff: 1
UseGroundPound: 0
groundPoundForceMode: 1

walkingAnimScale: 0.1
bodyMesh: {fileID: 1479187680222836870}
cam: {fileID: 1828481695}
groundCheck: {fileID: 0}
--- !u!4 &1479187681323959701
Transform:
m_ObjectHideFlags: 0

- component: {fileID: 235556834305398865}
- component: {fileID: 7759475058439974328}
- component: {fileID: 1479187681323959707}
- component: {fileID: 1479187681323959708}
m_Layer: 0
m_Name: FPSAgent
m_TagString: agent

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1479187681323959706}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name:

m_Calls: []
m_ActionEvents:
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1479187681323959783}
m_MethodName: OnMovement
m_Mode: 0
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_Calls: []
m_ActionId: 2f9ecc77-85d9-4189-8faf-18dcf905d2d4
m_ActionName: Player Action Map/WalkForward[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d]
- m_PersistentCalls:

m_ActionId: d2faa0a0-e027-4a5d-a155-870bb0ceaf7c
m_ActionName: Player Action Map/Jump
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1479187681323959783}
m_MethodName: OnShoot
m_Mode: 0
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_Calls: []
m_ActionId: cbcb2a57-a474-46a7-b133-cf144f6de321
m_ActionName: Player Action Map/Shoot
- m_PersistentCalls:

- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1479187681323959783}
m_MethodName: OnRotate
m_Mode: 0
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_Calls: []
- m_PersistentCalls:
m_Calls: []
m_ActionId: 49d5245a-a350-4f94-b4c8-cf578d61000b
m_ActionName: Player Action Map/Dash[/XboxOneGampadMacOSWireless/buttonEast]
--- !u!114 &1479187681323959708
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1479187681323959706}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8895a539297b24544aba7209546d2e36, type: 3}
m_Name:
m_EditorClassIdentifier:
moveInput: {x: 0, y: 0}
shootInput: 0
jumpInput: 0
dashInput: 0
rotateInput: {x: 0, y: 0}
shieldInput: 0
--- !u!114 &1479187681323959776
MonoBehaviour:
m_ObjectHideFlags: 0

m_Name:
m_EditorClassIdentifier:
m_BrainParameters:
VectorObservationSize: 1
VectorObservationSize: 0
VectorActionSize: 04000000
VectorActionSize: 06000000
VectorActionDescriptions: []
VectorActionSpaceType: 1
m_Model: {fileID: 0}

m_InputH: 0
leftStrafe: 0
rightStrafe: 0
m_ShootInput: 0
--- !u!114 &1543860467109742330
MonoBehaviour:
m_ObjectHideFlags: 0

18
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/AgentCubeMovement.cs


public float dashBoostForce = 20f;
public ForceMode dashForceMode = ForceMode.Impulse;
public bool dashPressed;
public float dashCoolDownDuration = .2f;
public float dashCoolDownTimer;
[Header("IDLE")]
//coefficient used to dampen velocity when idle

public Camera cam;
private float lookDir;
private Rigidbody rb;
private AgentCubeGroundCheck groundCheck;
public AgentCubeGroundCheck groundCheck;
private float inputH;
private float inputV;
void Awake()

{
if (groundCheck.isGrounded)
{
Jump(rb);
Jump();
}
else if (UseGroundPound)
{

}
strafeCoolDownTimer += Time.fixedDeltaTime;
dashCoolDownTimer += Time.fixedDeltaTime;
if (!allowKeyboardInput)
{

//
// }
public void Jump(Rigidbody rb)
public void Jump()
{
Vector3 velToUse = rb.velocity;
velToUse.y = agentJumpVelocity;

rb.velocity = Vector3.zero;
rb.AddForce(dir.normalized * strafeSpeed, strafeForceMode);
strafeCoolDownTimer = 0;
}
}
public void Dash(Vector3 dir)
{
if (dir != Vector3.zero && dashCoolDownTimer > dashCoolDownDuration)
{
rb.velocity = Vector3.zero;
rb.AddForce(dir.normalized * dashBoostForce, dashForceMode);
dashCoolDownTimer = 0;
}
}

32
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/FPSAgent.cs


private Camera m_Cam;
[Header("HEALTH")] public AgentHealth agentHealth;
private FPSAgentInput input;
// Start is called before the first frame update
public override void Initialize()
{

input = GetComponent<FPSAgentInput>();
}
public override void OnEpisodeBegin()

// sensor.AddObservation(localVelocity.x);
// sensor.AddObservation(localVelocity.z);
// sensor.AddObservation(m_Frozen);
sensor.AddObservation(m_ShootInput);
// sensor.AddObservation(m_ShootInput);
}
// else if (useVectorFrozenFlag)

m_Rotate = act[2];
m_ShootInput = act[3];
m_CubeMovement.RotateBody(m_Rotate, m_InputV);
Vector3 moveDir = m_Cam.transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));
m_CubeMovement.RunOnGround(m_AgentRb,
m_Cam.transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV)));
m_CubeMovement.RunOnGround(m_AgentRb, moveDir);
// if (m_InputH != 0)
// {

if (m_ShootInput > 0)
{
gunController.Shoot();
}
if (act[4] > 0 && m_CubeMovement.groundCheck.isGrounded)
{
m_CubeMovement.Jump();
}
if (act[5] > 0)
{
m_CubeMovement.Dash(moveDir);
}
// }

var contActionsOut = actionsOut.ContinuousActions;
// contActionsOut[0] = m_InputV; //inputV
// contActionsOut[2] = m_Rotate; //rotate
contActionsOut[3] = m_ShootInput; //shoot
// contActionsOut[3] = m_ShootInput; //shoot
contActionsOut[0] = inputMovement.y;
contActionsOut[1] = inputMovement.x;
contActionsOut[2] = rotateMovement.x;
contActionsOut[0] = input.moveInput.y;
contActionsOut[1] = input.moveInput.x;
contActionsOut[2] = input.rotateInput.x;
contActionsOut[3] = input.shootInput ? 1 : 0; //shoot
contActionsOut[4] = input.jumpInput ? 1 : 0; //shoot
contActionsOut[5] = input.dashInput ? 1 : 0; //shoot
// contActionsOut[0] = inputMovement.y;
// contActionsOut[1] = inputMovement.x;
// contActionsOut[2] = rotateMovement.x;
// m_InputH = 0;
// if (leftStrafe)
// {

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


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class FPSAgentInput : MonoBehaviour
{
private FPSPlayerInputActions inputActions;
private FPSPlayerInputActions.PlayerActionMapActions actionMap;
private Gamepad gamepad;
public Vector2 moveInput;
public bool shootInput;
public bool jumpInput;
public bool dashInput;
public Vector2 rotateInput;
public bool shieldInput;
// Start is called before the first frame update
void Awake()
{
inputActions = new FPSPlayerInputActions();
actionMap = inputActions.PlayerActionMap;
}
void OnEnable()
{
gamepad = Gamepad.current;
inputActions.Enable();
}
private void OnDisable()
{
inputActions.Disable();
}
// Update is called once per frame
void FixedUpdate()
{
// Vector2 move = gamepad.leftStick.ReadValue();
moveInput = actionMap.Walk.ReadValue<Vector2>();
// shootInput = actionMap.Shoot.ReadValue<float>() > 0;
shootInput = gamepad.rightTrigger.isPressed;
rotateInput = actionMap.RotateBody.ReadValue<Vector2>();
// jumpInput = actionMap.Jump.ReadValue<float>() > 0;
// jumpInput = actionMap.Jump.performed;
jumpInput = gamepad.buttonSouth.isPressed;
dashInput = gamepad.buttonWest.isPressed;
}
}

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


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

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


// GENERATED AUTOMATICALLY FROM 'Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions'
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public class @FPSPlayerInputActions : IInputActionCollection, IDisposable
{
public InputActionAsset asset { get; }
public @FPSPlayerInputActions()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""FPSPlayerInputActions"",
""maps"": [
{
""name"": ""Player Action Map"",
""id"": ""bb797917-97ca-47e1-b3c9-0572380e9376"",
""actions"": [
{
""name"": ""Walk"",
""type"": ""Value"",
""id"": ""2f9ecc77-85d9-4189-8faf-18dcf905d2d4"",
""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"": ""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"": ""RotateBody"",
""type"": ""Value"",
""id"": ""379999a6-e908-4242-ae2f-384e38bcb7cb"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Dash"",
""type"": ""Button"",
""id"": ""49d5245a-a350-4f94-b4c8-cf578d61000b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
{
""name"": ""2D Vector"",
""id"": ""f7a4010c-91c6-422f-91e7-4b14cbdb214a"",
""path"": ""2DVector"",
""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"": ""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>/buttonEast"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""fe641861-0da7-43ba-8bd6-e95a17232a77"",
""path"": ""<Gamepad>/buttonSouth"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Shoot"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""2b94ae52-9bb0-478e-8e4c-bf6c747a5c7d"",
""path"": ""<Gamepad>/leftTrigger"",
""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"": ""0c0d917f-0af9-4575-b970-f441fd97db20"",
""path"": ""<Gamepad>/rightStick"",
""interactions"": """",
""processors"": ""StickDeadzone"",
""groups"": """",
""action"": ""RotateBody"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""319796b1-6071-46f0-81dc-58b6bdb7d86a"",
""path"": ""<Gamepad>/buttonEast"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// 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);
}
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();
}
// 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;
public struct PlayerActionMapActions
{
private @FPSPlayerInputActions m_Wrapper;
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 InputActionMap Get() { return m_Wrapper.m_PlayerActionMap; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(PlayerActionMapActions set) { return set.Get(); }
public void SetCallbacks(IPlayerActionMapActions instance)
{
if (m_Wrapper.m_PlayerActionMapActionsCallbackInterface != 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;
}
m_Wrapper.m_PlayerActionMapActionsCallbackInterface = instance;
if (instance != null)
{
@Walk.started += instance.OnWalk;
@Walk.performed += instance.OnWalk;
@Walk.canceled += instance.OnWalk;
@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;
@Shoot.started += instance.OnShoot;
@Shoot.performed += instance.OnShoot;
@Shoot.canceled += instance.OnShoot;
@Shield.started += instance.OnShield;
@Shield.performed += instance.OnShield;
@Shield.canceled += instance.OnShield;
@RotateBody.started += instance.OnRotateBody;
@RotateBody.performed += instance.OnRotateBody;
@RotateBody.canceled += instance.OnRotateBody;
@Dash.started += instance.OnDash;
@Dash.performed += instance.OnDash;
@Dash.canceled += instance.OnDash;
}
}
}
public PlayerActionMapActions @PlayerActionMap => new PlayerActionMapActions(this);
public interface IPlayerActionMapActions
{
void OnWalk(InputAction.CallbackContext context);
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 OnRotateBody(InputAction.CallbackContext context);
void OnDash(InputAction.CallbackContext context);
}
}

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


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

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

/Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPS_Player_InputActions.inputactions.meta → /Project/Assets/ML-Agents/Examples/FPS_Game/Input/FPSPlayerInputActions.inputactions.meta

正在加载...
取消
保存