Custom Movement Action

Create a custom movement action. Movements, such as forward, left, right, stop, etc. are actions that can be called from any skill. If you wish to create a custom action for a movement panel, it can be done here.


Code:


using System;
using System.Windows.Forms;
using ARC;

namespace Custom_Movement_Example {

  public partial class MainForm : ARC.UCForms.FormPluginMaster {

    readonly string MOVEMENT_JUMP_ID = "Jump";

    public MainForm() {

      InitializeComponent();

      // show a config button in the title bar. Set this to false if you do not have a config form.
      ConfigButton = true;

      // Bind to the movement event for every movement that is specified this will raise
      EZBManager.MovementManager.OnMovement2 += MovementManager_OnMovement2;
    }

    private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {

      // Unbind from the movement event when the form is going away
      EZBManager.MovementManager.OnMovement2 += MovementManager_OnMovement2;
    }

    private void MovementManager_OnMovement2(MovementManager.MovementDirectionEnum direction, byte speedLeft, byte speedRight) {

      if (direction == MovementManager.MovementDirectionEnum.Custom && EZBManager.MovementManager.GetCustomMovementId == MOVEMENT_JUMP_ID) {

        // Handle the code here for the custom movement type
      }
    }

    private void btnCustomMovement_Click(object sender, EventArgs e) {

      // This will execute the custom movement action

      EZBManager.MovementManager.GoCustom(MOVEMENT_JUMP_ID);
    }
  }
}