playMaker

Author Topic: Device Vibrate  (Read 1983 times)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3207
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Device Vibrate
« on: November 29, 2011, 06: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, 05:14:07 PM by alexchouls »