Upload from upload_mods.ps1
This commit is contained in:
89
Scripts/Manager/Inactive/OutbreakManagerRebirth.cs
Normal file
89
Scripts/Manager/Inactive/OutbreakManagerRebirth.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Audio;
|
||||
|
||||
public class OutbreakManagerRebirth
|
||||
{
|
||||
private static OutbreakManagerRebirth instance = null;
|
||||
|
||||
private static float outbreakUpdateCheck = 0f;
|
||||
private static float outbreakUpdateTick = 10f;
|
||||
|
||||
public static bool HasInstance => instance != null;
|
||||
|
||||
public static OutbreakManagerRebirth Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
OutbreakManagerRebirth.instance = new OutbreakManagerRebirth();
|
||||
Log.Out("Starting Outbreak Manager");
|
||||
RebirthVariables.isHerd = false;
|
||||
RebirthVariables.stopWHSpawns = true;
|
||||
RebirthVariables.herdDuration = 0f;
|
||||
ModEvents.GameUpdate.RegisterHandler(Update);
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (!RebirthUtilities.IsHordeNight())
|
||||
{
|
||||
if ((Time.time - outbreakUpdateCheck) > outbreakUpdateTick)
|
||||
{
|
||||
outbreakUpdateCheck = Time.time;
|
||||
//Log.Out("OutbreakManagerRebirth-Update TICK");
|
||||
|
||||
//Log.Out("OutbreakManagerRebirth-Update RebirthVariables.isHerd: " + RebirthVariables.isHerd);
|
||||
//Log.Out("OutbreakManagerRebirth-Update RebirthVariables.herdStartTime: " + RebirthVariables.herdStartTime);
|
||||
//Log.Out("OutbreakManagerRebirth-Update RebirthVariables.herdDuration: " + RebirthVariables.herdDuration);
|
||||
|
||||
if (!RebirthVariables.stopWHSpawns && RebirthVariables.isWHSpawned)
|
||||
{
|
||||
float diff = Time.time - RebirthVariables.herdStartTime;
|
||||
//Log.Out("OutbreakManagerRebirth-Update diff: " + diff + " / " + RebirthVariables.herdDuration);
|
||||
|
||||
AIDirectorWanderingHordeComponent director = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorWanderingHordeComponent>();
|
||||
|
||||
if (director != null && director.spawners.Count > 0)
|
||||
{
|
||||
AIWanderingHordeSpawner spawner = director.spawners[director.spawners.Count - 1];
|
||||
if (spawner != null)
|
||||
{
|
||||
//Log.Out("OutbreakManagerRebirth-Update spawner.commandList.Count: " + spawner.commandList.Count);
|
||||
}
|
||||
}
|
||||
|
||||
if (diff >= RebirthVariables.herdDuration)
|
||||
{
|
||||
Log.Out("OutbreakManagerRebirth-Update STOP OUTBREAK");
|
||||
RebirthVariables.isHerd = false;
|
||||
RebirthVariables.stopWHSpawns = true;
|
||||
RebirthVariables.herdDuration = 0f;
|
||||
|
||||
if (director != null && director.spawners.Count > 0)
|
||||
{
|
||||
AIWanderingHordeSpawner spawner = director.spawners[director.spawners.Count - 1];
|
||||
if (spawner != null)
|
||||
{
|
||||
spawner.Cleanup();
|
||||
director.spawners.RemoveAt(director.spawners.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("OutbreakManagerRebirth-Update HORDE NIGHT, STOP WANDERING HORDE");
|
||||
RebirthVariables.isHerd = false;
|
||||
RebirthVariables.stopWHSpawns = true;
|
||||
RebirthVariables.herdDuration = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user