Example #1
0
        private static Matrix GetSpawnMatrixForProteansWithGardener(
            App app,
            int databaseId,
            int systemId,
            OrbitalObjectInfo[] objects)
        {
            Matrix         matrixForGardener = Gardeners.GetSpawnMatrixForGardener(app, systemId, objects);
            StarSystemInfo starSystemInfo    = app.GameDatabase.GetStarSystemInfo(systemId);
            float          num               = starSystemInfo == (StarSystemInfo)null || starSystemInfo.IsDeepSpace ? 1000f : 10000f;
            Vector3        vector3           = -matrixForGardener.Forward;
            Matrix         world             = Matrix.CreateWorld(matrixForGardener.Position + vector3 * num, -vector3, Vector3.UnitY);
            Vector3        position          = world.Position;
            Vector3?       shipFleetPosition = app.GameDatabase.GetShipFleetPosition(databaseId);

            if (shipFleetPosition.HasValue)
            {
                position = Vector3.Transform(shipFleetPosition.Value, world);
            }
            return(Matrix.CreateWorld(position, world.Forward, Vector3.UnitY));
        }
Example #2
0
        public static Gardeners InitializeEncounter(GameDatabase gamedb, AssetDatabase assetdb)
        {
            Gardeners gardeners = new Gardeners();

            gardeners.PlayerId = gamedb.InsertPlayer("Protean", "protean", new int?(), assetdb.RandomEncounterPrimaryColor, new Vector3(0.0f), "", "\\base\\factions\\protean\\avatars\\Protean_Avatar.tga", 0.0, 0, false, false, false, 0, AIDifficulty.Normal);
            DesignInfo design1 = new DesignInfo(gardeners.PlayerId, "Protean", new string[1]
            {
                string.Format("factions\\{0}\\sections\\{1}", (object)"protean", (object)"protean.section")
            });

            gardeners._proteanDesignId = gamedb.InsertDesignByDesignInfo(design1);
            if (gamedb.HasEndOfFleshExpansion())
            {
                DesignInfo design2 = new DesignInfo(gardeners.PlayerId, "Gardener", new string[1]
                {
                    string.Format("factions\\{0}\\sections\\{1}", (object)"protean", (object)"Rama.section")
                });
                gardeners._gardenerDesignId = gamedb.InsertDesignByDesignInfo(design2);
            }
            return(gardeners);
        }
Example #3
0
        public static Gardeners ResumeEncounter(GameDatabase gamedb)
        {
            Gardeners  gardeners  = new Gardeners();
            PlayerInfo playerInfo = gamedb.GetPlayerInfos().ToList <PlayerInfo>().FirstOrDefault <PlayerInfo>((Func <PlayerInfo, bool>)(x =>
            {
                if (!x.isStandardPlayer)
                {
                    return(x.Name.Contains("Protean"));
                }
                return(false);
            }));

            gardeners.PlayerId = playerInfo.ID;
            List <DesignInfo> list = gamedb.GetDesignInfosForPlayer(gardeners.PlayerId).ToList <DesignInfo>();

            gardeners._proteanDesignId = list.First <DesignInfo>((Func <DesignInfo, bool>)(x => x.DesignSections[0].FilePath.EndsWith("protean.section"))).ID;
            DesignInfo designInfo = list.First <DesignInfo>((Func <DesignInfo, bool>)(x => x.DesignSections[0].FilePath.EndsWith("Rama.section")));

            if (designInfo != null && gamedb.HasEndOfFleshExpansion())
            {
                gardeners._gardenerDesignId = designInfo.ID;
            }
            return(gardeners);
        }
Example #4
0
        public static Matrix GetSpawnTransform(
            App app,
            int databaseId,
            int fleetId,
            int shipIndex,
            int systemId,
            OrbitalObjectInfo[] objects)
        {
            GardenerInfo gardenerInfo = app.GameDatabase.GetGardenerInfos().FirstOrDefault <GardenerInfo>((Func <GardenerInfo, bool>)(x => x.FleetId == fleetId));

            if (gardenerInfo == null)
            {
                return(Matrix.Identity);
            }
            if (gardenerInfo.IsGardener)
            {
                return(Gardeners.GetSpawnMatrixForGardener(app, systemId, objects));
            }
            if (gardenerInfo.GardenerFleetId != 0)
            {
                return(Gardeners.GetSpawnMatrixForProteansWithGardener(app, databaseId, systemId, objects));
            }
            return(Gardeners.GetSpawnMatrixForProteansAtHome(app, databaseId, shipIndex, systemId, objects));
        }