File size: 777 Bytes
ce81a16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Photon.Deterministic;
using System;
using System.Collections.Generic;

namespace Quantum
{
	public static class CommandSetup
	{
		public static DeterministicCommand[] CreateCommands(RuntimeConfig gameConfig, SimulationConfig simulationConfig)
		{
			Type   baseType = typeof(DeterministicCommand);
			Type[] allTypes = typeof(CommandSetup).Assembly.GetTypes();

			List<DeterministicCommand> commands = new List<DeterministicCommand>(16);

			foreach (Type type in allTypes)
			{
				if (type.IsSubclassOf(baseType) == true && type.IsAbstract == false)
				{
					DeterministicCommand command = Activator.CreateInstance(type) as DeterministicCommand;
					if (command != null)
					{
						commands.Add(command);
					}
				}
			}

			return commands.ToArray();
		}
	}
}