playMaker

Author Topic: Device Vibrate  (Read 10072 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Device Vibrate
« on: November 29, 2011, 08:18:44 PM »
Simple action to call iPhoneUtils.Vibrate:

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

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Device)]
[Tooltip("Causes the device to vibrate for half a second.")]
public class DeviceVibrate : FsmStateAction
{
public override void Reset()
{
}

public override void OnEnter()
{
iPhoneUtils.Vibrate();
}
}
}

As you can see it's super easy to wrap a simple Unity command - just make an action and call the command in OnEnter().

EDIT: Changed action name to DeviceVibrate.
« Last Edit: December 09, 2011, 07:14:07 PM by alexchouls »