Adventure Creator Wikia

This is a simple (unoptimised) example script that shows how a PlayMaker FSM can be used to control an AC Player during gameplay. It works by enabling the attached FSM, and disabling AC's automatic Motion Control, during gameplay - and the reverse during cutscenes.

To use, place in a script named PlayMakerControlPlayer, attach to a Player object that also has a PlayMakerFSM component that is used to control the player's movement.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HutongGames.PlayMaker;
using AC;

public class PlayMakerControlPlayer : MonoBehaviour
{

void Update ()
{
if (KickStarter.stateHandler && KickStarter.stateHandler.gameState == GameState.Cutscene)
{
// Disable custom movement
GetComponent <PlayMakerFSM>().enabled = false;
GetComponent <Player>().motionControl = MotionControl.Automatic;
}
else
{
// Enable custom movement
GetComponent <PlayMakerFSM>().enabled = true;
GetComponent <Player>().motionControl = MotionControl.Manual;
}
}

}