public static void Prepare()
 {
     SpawnCitizenAI          = GameConnectionManager.Instance.HumanAIConnection.SpawnCitizenAI;
     StartPathFindCitizenAI  = GameConnectionManager.Instance.HumanAIConnection.StartPathFindCitizenAI;
     SimulationStepCitizenAI = GameConnectionManager.Instance.HumanAIConnection.SimulationStepCitizenAI;
     ArriveAtDestination     = GameConnectionManager.Instance.HumanAIConnection.ArriveAtDestination;
     InvalidPath             = GameConnectionManager.Instance.HumanAIConnection.InvalidPath;
     PathfindFailure         = GameConnectionManager.Instance.HumanAIConnection.PathfindFailure;
     PathfindSuccess         = GameConnectionManager.Instance.HumanAIConnection.PathfindSuccess;
 }
        internal static HumanAIConnection GetConnection()
        {
            try {
                StartPathFindDelegate startPathFindCitizenAI =
                    TranspilerUtil.CreateDelegate <StartPathFindDelegate>(
                        typeof(CitizenAI),
                        "StartPathFind",
                        true);
                SimulationStepDelegate simulationStepCitizenAI =
                    AccessTools.MethodDelegate <SimulationStepDelegate>(
                        TranspilerUtil.DeclaredMethod <SimulationStepTarget>(typeof(CitizenAI), "SimulationStep"),
                        null,
                        false);
                ArriveAtDestinationDelegate arriveAtDestination =
                    TranspilerUtil.CreateDelegate <ArriveAtDestinationDelegate>(
                        typeof(HumanAI),
                        "ArriveAtDestination",
                        true);
                SpawnDelegate spawnCitizenAI =
                    TranspilerUtil.CreateDelegate <SpawnDelegate>(
                        typeof(HumanAI),
                        "Spawn",
                        true);
                InvalidPathHumanAIDelegate invalidPath =
                    TranspilerUtil.CreateDelegate <InvalidPathHumanAIDelegate>(
                        typeof(CitizenAI),
                        "InvalidPath",
                        true);
                PathfindFailureHumanAIDelegate pathfindFailure =
                    TranspilerUtil.CreateDelegate <PathfindFailureHumanAIDelegate>(
                        typeof(HumanAI),
                        "PathfindFailure",
                        true);
                PathfindSuccessHumanAIDelegate pathfindSuccess =
                    TranspilerUtil.CreateDelegate <PathfindSuccessHumanAIDelegate>(
                        typeof(HumanAI),
                        "PathfindSuccess",
                        true);

                return(new HumanAIConnection(
                           spawnCitizenAI,
                           startPathFindCitizenAI,
                           simulationStepCitizenAI,
                           arriveAtDestination,
                           invalidPath,
                           pathfindFailure,
                           pathfindSuccess));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }
 internal HumanAIConnection(SpawnDelegate spawnCitizenAI,
                            StartPathFindDelegate startPathFindCitizenAI,
                            SimulationStepDelegate simulationStepCitizenAI,
                            ArriveAtDestinationDelegate arriveAtDestination,
                            InvalidPathHumanAIDelegate invalidPath,
                            PathfindFailureHumanAIDelegate pathfindFailure,
                            PathfindSuccessHumanAIDelegate pathfindSuccess)
 {
     SpawnCitizenAI          = spawnCitizenAI ?? throw new ArgumentNullException(nameof(spawnCitizenAI));
     StartPathFindCitizenAI  = startPathFindCitizenAI ?? throw new ArgumentNullException(nameof(startPathFindCitizenAI));
     SimulationStepCitizenAI = simulationStepCitizenAI ?? throw new ArgumentNullException(nameof(simulationStepCitizenAI));
     ArriveAtDestination     = arriveAtDestination ?? throw new ArgumentNullException(nameof(arriveAtDestination));
     InvalidPath             = invalidPath ?? throw new ArgumentNullException(nameof(invalidPath));
     PathfindFailure         = pathfindFailure ?? throw new ArgumentNullException(nameof(pathfindFailure));
     PathfindSuccess         = pathfindSuccess ?? throw new ArgumentNullException(nameof(pathfindSuccess));
 }