SDM_LethalCompany_Mod/ScarletMansion/ScarletMansion/GamePatch/Props/RandomPrefabCycle.cs
2026-05-01 00:06:39 -07:00

31 lines
796 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.LogDebug($"Updating RandomPrefab cylce to {value}");
cycle = value;
}
public override void Process(RandomStream randomStream, Tile tile, ref List<GameObject> spawnedObjects) {
if (props.Count <= 0) return;
Plugin.logger.LogDebug($"Cycle {cycle}");
var cycleValue = cycle++;
var index = cycleValue % props.Count;
var prefab = props[index];
SpawnGameObject(randomStream, prefab);
}
}
}