2024-04-28 14:41:33 -07:00

32 lines
757 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using DunGen;
namespace ScarletMansion.GamePatch.Props {
public class RandomPrefabCycle : RandomPrefabBase {
public static int cycle = 0;
public static void UpdateCycle(int value){
Plugin.logger.LogInfo($"Updating RandomPrefab cylce to {value}");
cycle = value;
}
public override void Process(RandomStream randomStream, Tile tile) {
if (props.Count <= 0) return;
Plugin.logger.LogInfo($"Cycle {cycle}");
var cycleValue = cycle++;
var index = cycleValue % props.Count;
var prefab = props[index];
SpawnGameObject(randomStream, prefab);
}
}
}