TECH TREES WHOO

Implemented procedural tech tree generation by porting GraphSharp to Unity.
Also, some database editor convenience changes.
This commit is contained in:
hyperion51 2020-04-11 19:18:02 +01:00
commit d5f2e3734a
573 changed files with 31001 additions and 222 deletions

View file

@ -0,0 +1,32 @@
using System.Collections.Generic;
using QuickGraph;
using QuickGraph.Algorithms;
using System.Windows;
using Unity.Mathematics;
using static Unity.Mathematics.math;
namespace GraphSharp.Algorithms.EdgeRouting
{
public abstract class EdgeRoutingAlgorithmBase<TVertex, TEdge, TGraph> : AlgorithmBase<TGraph>, IEdgeRoutingAlgorithm<TVertex, TEdge, TGraph>
where TVertex : class
where TEdge : IEdge<TVertex>
where TGraph : IVertexAndEdgeListGraph<TVertex, TEdge>
{
protected IDictionary<TVertex, float2> vertexPositions;
/// <summary>
/// Gets or sets the routing points of the edges.
/// </summary>
public IDictionary<TEdge, float2[]> EdgeRoutes
{
get;
private set;
}
public EdgeRoutingAlgorithmBase(TGraph visitedGraph, IDictionary<TVertex, float2> vertexPositions)
: base(visitedGraph)
{
this.vertexPositions = vertexPositions;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bed8fe5597d81214294894077e52ba2d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
namespace GraphSharp.Algorithms.EdgeRouting
{
public class EdgeRoutingParameters : IEdgeRoutingParameters
{
public object Clone()
{
return this.MemberwiseClone();
}
protected void NotifyChanged( string propertyName )
{
if ( PropertyChanged != null )
PropertyChanged( this, new System.ComponentModel.PropertyChangedEventArgs( propertyName ) );
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e98aa53af093bd418646cf9b584d57e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,16 @@
using System.Collections.Generic;
using QuickGraph.Algorithms;
using QuickGraph;
using System.Windows;
using Unity.Mathematics;
using static Unity.Mathematics.math;
namespace GraphSharp.Algorithms.EdgeRouting
{
public interface IEdgeRoutingAlgorithm<TVertex, TEdge, TGraph> : IAlgorithm<TGraph>
where TEdge : IEdge<TVertex>
where TGraph : IVertexAndEdgeListGraph<TVertex, TEdge>
{
IDictionary<TEdge, float2[]> EdgeRoutes { get; }
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 68d74f36ae422ac4081f5e347d001a87
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,25 @@
using System.Collections.Generic;
using GraphSharp.Algorithms.Layout;
using QuickGraph;
namespace GraphSharp.Algorithms.EdgeRouting
{
public interface IEdgeRoutingAlgorithmFactory<TVertex, TEdge, TGraph>
where TVertex : class
where TEdge : IEdge<TVertex>
where TGraph : class, IBidirectionalGraph<TVertex, TEdge>
{
/// <summary>
/// List of the available algorithms.
/// </summary>
IEnumerable<string> AlgorithmTypes { get; }
IEdgeRoutingAlgorithm<TVertex, TEdge, TGraph> CreateAlgorithm( string newAlgorithmType, ILayoutContext<TVertex, TEdge, TGraph> context, IEdgeRoutingParameters parameters);
IEdgeRoutingParameters CreateParameters( string algorithmType, IEdgeRoutingParameters oldParameters );
bool IsValidAlgorithm( string algorithmType );
string GetAlgorithmType( IEdgeRoutingAlgorithm<TVertex, TEdge, TGraph> algorithm );
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b27d7d08f55d06241aafc2dd2043377d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,6 @@
namespace GraphSharp.Algorithms.EdgeRouting
{
public interface IEdgeRoutingParameters : IAlgorithmParameters
{
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5ac77f8617e945740be2953866a9af7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,40 @@
using System.Collections.Generic;
using GraphSharp.Algorithms.Layout;
using System.Linq;
using QuickGraph;
namespace GraphSharp.Algorithms.EdgeRouting
{
public class StandardEdgeRoutingAlgorithmFactory<TVertex, TEdge, TGraph> : IEdgeRoutingAlgorithmFactory<TVertex, TEdge, TGraph>
where TVertex : class
where TEdge : IEdge<TVertex>
where TGraph : class, IBidirectionalGraph<TVertex, TEdge>
{
protected static readonly string[] algorithmTypes = new string[] { };
public IEnumerable<string> AlgorithmTypes
{
get { return algorithmTypes; }
}
public IEdgeRoutingAlgorithm<TVertex, TEdge, TGraph> CreateAlgorithm( string newAlgorithmType, ILayoutContext<TVertex, TEdge, TGraph> context, IEdgeRoutingParameters parameters )
{
return null;
}
public IEdgeRoutingParameters CreateParameters( string algorithmType, IEdgeRoutingParameters oldParameters )
{
return null;
}
public bool IsValidAlgorithm( string algorithmType )
{
return AlgorithmTypes.Any( at => at == algorithmType );
}
public string GetAlgorithmType( IEdgeRoutingAlgorithm<TVertex, TEdge, TGraph> algorithm )
{
return string.Empty;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 42cb3c373dd36714799b300b45df721b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: