Server job assigning logic, submarine movement syncing, submarine collision improvements, spawnpoints in levels
This commit is contained in:
@@ -23,7 +23,7 @@ namespace Subsurface
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
WayPoint randomWayPoint = WayPoint.GetRandom(WayPoint.SpawnType.Enemy);
|
||||
WayPoint randomWayPoint = WayPoint.GetRandom(SpawnType.Enemy);
|
||||
|
||||
int amount = Rand.Range(minAmount, maxAmount, false);
|
||||
|
||||
|
||||
@@ -92,11 +92,13 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
|
||||
public static ScriptedEvent LoadRandom()
|
||||
public static ScriptedEvent LoadRandom(string seed)
|
||||
{
|
||||
XDocument doc = ToolBox.TryLoadXml(configFile);
|
||||
if (doc == null) return null;
|
||||
|
||||
Random rand = new Random(seed.GetHashCode());
|
||||
|
||||
int eventCount = doc.Root.Elements().Count();
|
||||
//int[] commonness = new int[eventCount];
|
||||
float[] eventProbability = new float[eventCount];
|
||||
@@ -123,9 +125,9 @@ namespace Subsurface
|
||||
probabilitySum += eventProbability[i];
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
float randomNumber = Rand.Range(0.0f,probabilitySum);
|
||||
float randomNumber = (float)rand.NextDouble() * probabilitySum;
|
||||
|
||||
i = 0;
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace Subsurface
|
||||
tasks.Add(newTask);
|
||||
}
|
||||
|
||||
public void StartShift(int scriptedEventCount)
|
||||
public void StartShift(Level level)
|
||||
{
|
||||
CreateScriptedEvents(scriptedEventCount);
|
||||
CreateScriptedEvents(level);
|
||||
|
||||
taskListBox.ClearChildren();
|
||||
}
|
||||
@@ -59,13 +59,11 @@ namespace Subsurface
|
||||
tasks.Clear();
|
||||
}
|
||||
|
||||
private void CreateScriptedEvents(int scriptedEventCount)
|
||||
private void CreateScriptedEvents(Level level)
|
||||
{
|
||||
for (int i = 0; i < scriptedEventCount; i++)
|
||||
{
|
||||
ScriptedEvent scriptedEvent = ScriptedEvent.LoadRandom();
|
||||
AddTask(new ScriptedTask(scriptedEvent));
|
||||
}
|
||||
ScriptedEvent scriptedEvent = ScriptedEvent.LoadRandom(level.Seed);
|
||||
AddTask(new ScriptedTask(scriptedEvent));
|
||||
|
||||
}
|
||||
|
||||
public void TaskStarted(Task task)
|
||||
|
||||
Reference in New Issue
Block a user