Fixed treasure room event for bedroom Fixed painting's interaction with MattyFixes Fixed critical damage bug introduced by v62 Increased lights spawn for all presets by a lot Added Coroner compatibility Added Scarlet Devil Mansion (moon) to the interior's spawn list Lights now have a chance of flickering and dying
59 lines
1.3 KiB
C#
59 lines
1.3 KiB
C#
using DunGen;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace ScarletMansion.GamePatch.Components
|
|
{
|
|
public class PathOpenUpParent : MonoBehaviour, IDungeonCompleteReceiver {
|
|
|
|
[System.Serializable]
|
|
public class Chokepoint {
|
|
public PathOpenup[] paths;
|
|
|
|
public void UpdatePath(System.Random sysRandom){
|
|
var count = sysRandom.Next(1, Mathf.Min(paths.Length, 2));
|
|
var length = paths.Length;
|
|
|
|
var items = new int[length];
|
|
for(var i = 0; i < length; i++){
|
|
items[i] = i;
|
|
}
|
|
Utility.Shuffle(sysRandom, items);
|
|
|
|
var j = 0;
|
|
while(j < 1) {
|
|
paths[j].UpdatePath(PathOpenup.State.Active);
|
|
++j;
|
|
}
|
|
|
|
while(j < length) {
|
|
paths[j].UpdatePath(PathOpenup.State.UnActive);
|
|
++j;
|
|
}
|
|
}
|
|
}
|
|
|
|
public Chokepoint[] chokepoints;
|
|
public PathOpenup[] paths;
|
|
|
|
void Reset(){
|
|
paths = GetComponentsInChildren<PathOpenup>();
|
|
}
|
|
|
|
public void OnDungeonComplete(Dungeon dungeon) {
|
|
var anyChanges = true;
|
|
var sysRandom = DunGenPatch.Patch.CreateSystemRandom();
|
|
|
|
foreach(var c in chokepoints) {
|
|
c.UpdatePath(sysRandom);
|
|
}
|
|
|
|
foreach(var c in paths) {
|
|
c.CleanUp();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|