Playmaker Forum

PlayMaker News => General Discussion => Topic started by: FXCarl on September 17, 2014, 02:07:04 PM

Title: Generate fsm template by code ?
Post by: FXCarl on September 17, 2014, 02:07:04 PM
if it possible, i can build a step by step game flow by text lines without drag and drop lots of icons  8)

i tried these codes, but it cann't work  :(

Code: [Select]
void Start () {
FsmTemplate fsmt = ScriptableObject.CreateInstance<FsmTemplate>();
Fsm fsm = new Fsm();
// Gen FSM
FsmState IdleState = new FsmState(fsm);
IdleState.Name = "IdleState";
fsm.StartState = "IdleState";
//
fsmt.fsm = fsm;
PlayMakerFSM fsmObj = gameObject.AddComponent<PlayMakerFSM>();
fsmObj.SetFsmTemplate(fsmt);
}
Title: Re: Generate fsm template by code ?
Post by: jeanfabre on September 18, 2014, 09:44:02 AM
Hi,

 never tried it, so you'll have to fiddle with it big time, you may find that not everything you need will be exposed in the PlayMaker api... so be careful with this.

 Bye,

 Jean