FANDOM


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;
}
}

}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.