Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: Xander Davis on June 25, 2013, 08:42:56 AM

Title: GetKey/Up/Down by Input Manager Names
Post by: Xander Davis on June 25, 2013, 08:42:56 AM
How can we reconfigure this to either detect names from the Input Manager or enable us to manually input the string of the name for the Input Manager?

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Input)]
[Tooltip("Sends an Event when a Key is released.")]
public class GetKeyUpString : FsmStateAction
{
[RequiredField]
public KeyCode key;
public FsmEvent sendEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeResult;

public override void Reset()
{
sendEvent = null;
key = KeyCode.None;
storeResult = null;
}

public override void OnUpdate()
{
bool keyUp = Input.GetKeyUp(key);

if (keyUp)
Fsm.Event(sendEvent);

storeResult.Value = keyUp;
}
}
}

My issue is I have logic that depends on a keyUp of a Joystick Button, but can't have that same logic for the Keyboard equivalent keyUp... of both the same action in the Input Manager (in this case 'Attack').
Title: Re: GetKey/Up/Down by Input Manager Names
Post by: Alex Chouls on June 25, 2013, 09:57:17 AM
Use the Get Button actions. These let you use buttons named in the Input Manager.