Esempio n. 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));
        }
Esempio n. 2
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));
        }