47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using DunGen;
|
|
using UnityEngine;
|
|
|
|
namespace ScarletMansion.GamePatch.Props {
|
|
public class FloorPropBasedOnFloor : RandomProp {
|
|
|
|
public GameObject topFloorPrefab;
|
|
public List<GameObject> secondFloorPrefabs;
|
|
public GameObject mainFloorPrefab;
|
|
public List<GameObject> basementFloorPrefabs;
|
|
public GameObject bottomFloorPrefab;
|
|
|
|
public override void Process(RandomStream randomStream, Tile tile, ref List<GameObject> spawnedObjects) {
|
|
var baseY = KnightSpawnManager.Instance.transform.position.y;
|
|
var currentY = tile.transform.position.y;
|
|
|
|
var floor = Mathf.RoundToInt((currentY - baseY) / 8f);
|
|
Plugin.logger.LogDebug($"F{floor}");
|
|
// fuck it im lazy
|
|
GameObject p;
|
|
if (floor == 0) {
|
|
p = mainFloorPrefab;
|
|
} else if (floor == 1) {
|
|
p = secondFloorPrefabs[randomStream.Next(secondFloorPrefabs.Count)];
|
|
} else if (floor == -1) {
|
|
p = basementFloorPrefabs[randomStream.Next(basementFloorPrefabs.Count)];
|
|
} else if (floor >= 2) {
|
|
p = topFloorPrefab;
|
|
} else {
|
|
p = bottomFloorPrefab;
|
|
}
|
|
|
|
var gameObject = GameObject.Instantiate(p);
|
|
var gameObjectTransform = gameObject.transform;
|
|
gameObjectTransform.parent = transform;
|
|
|
|
gameObjectTransform.localPosition = Vector3.zero;
|
|
gameObjectTransform.localRotation = Quaternion.identity;
|
|
}
|
|
|
|
}
|
|
}
|