浏览代码

Added Boolean on Player Controller for toggling usage of old Input Manager API

/main
andytouch 4 年前
当前提交
bc0a4649
共有 2 个文件被更改,包括 17 次插入7 次删除
  1. 5
      InputSystem_LocalMultiplayer_Project/Assets/Scenes/Scene_Example_Warriors.unity
  2. 19
      InputSystem_LocalMultiplayer_Project/Assets/Scripts/PlayerController.cs

5
InputSystem_LocalMultiplayer_Project/Assets/Scenes/Scene_Example_Warriors.unity


propertyPath: m_Actions
value:
objectReference: {fileID: 0}
- target: {fileID: 4244790990042693115, guid: 7040c04d00ad25e4cad0ba1b7d40c3c0,
type: 3}
propertyPath: useOldInputManager
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5587485868546598810, guid: 7040c04d00ad25e4cad0ba1b7d40c3c0,
type: 3}
propertyPath: m_textInfo.characterCount

19
InputSystem_LocalMultiplayer_Project/Assets/Scripts/PlayerController.cs


public Animator playerAnimator;
[Header("Input")]
public bool useOldInputManager = false;
public PlayerInput playerInput;
private string actionMapGameplay = "Player Controls";
private string actionMapMenu = "Menu Controls";

void CalculateMovementInput()
{
if(useOldInputManager)
{
var v = Input.GetAxisRaw("Vertical");
var h = Input.GetAxisRaw("Horizontal");
inputDirection = new Vector3(h, 0, v);
}
var v = Input.GetAxisRaw("Vertical");
var h = Input.GetAxisRaw("Horizontal");
inputDirection = new Vector3(h, 0, v);
if(inputDirection == Vector3.zero)
{
currentInput = false;

void CalculateAttackInput()
{
if(Input.GetKeyDown(KeyCode.E))
if(useOldInputManager)
playerAnimator.SetTrigger("Attack");
if(Input.GetKeyDown(KeyCode.E))
{
playerAnimator.SetTrigger("Attack");
}
}
}

正在加载...
取消
保存