playMaker

Author Topic: GetKey/Up/Down by Input Manager Names  (Read 3147 times)

Xander Davis

  • Playmaker Newbie
  • *
  • Posts: 24
GetKey/Up/Down by Input Manager Names
« 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').

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: GetKey/Up/Down by Input Manager Names
« Reply #1 on: June 25, 2013, 09:57:17 AM »
Use the Get Button actions. These let you use buttons named in the Input Manager.