Hi community,
I am trying to write a bridge of sorts between Dungen and Playmaker assets.
I am trying to copy the array values from my script to the fsm array variable so I can work with it in playmaker. For some reason I can't figure out why the array values wont load into the playmaker fsm I have assigned in the inspector. Any help would be appreciated, Thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DunGen;
using HutongGames.PlayMaker;
public class GetDoorPrefabsInTile : MonoBehaviour
{
public FsmArray pfsmArray;
public PlayMakerFSM DoorFunctionalityFSM;
public string nameOfArrayToWorkWith;
public Tile tile;
private GameObject[] PlaymakerFSMArray;
private void Start()
{
pfsmArray = DoorFunctionalityFSM.FsmVariables.GetFsmArray(nameOfArrayToWorkWith);
}
public void FindDoorPrefabs()
{
// Get the tile that you want somehow
GameObject[] tempArray;
int doorIndex = 0;
int Doorwaycount = tile.Placement.AllDoorways.Count;
tempArray = new GameObject[Doorwaycount];
// Loop through each used doorway in the tile - used doorways are those that are connected to other tiles
foreach (var doorway in tile.Placement.UsedDoorways)
{
// Only one door prefab is spawed per doorway-pair so it might be on this doorway, or it might be on the other
GameObject doorPrefab = (doorway.UsedDoorPrefab != null) ? doorway.UsedDoorPrefab : doorway.ConnectedDoorway.UsedDoorPrefab;
if (doorway.UsedDoorPrefab != null)
{
tempArray[doorIndex] = doorPrefab;
doorIndex++;
}
}
//doorIndex = 0;
pfsmArray.Values = tempArray;
}
}