コード例 #1
0
        public bool IsSectorInArea(MyMwcVector3Int sectorPosition)
        {
            Vector3 sectorPos              = MySolarSystemUtils.SectorsToKm(sectorPosition);
            Vector3 fromSectorToCenter     = sectorPos - Position;
            float   fromSectorToCenterDist = fromSectorToCenter.Length();

            return(fromSectorToCenterDist <= Radius);
        }
コード例 #2
0
        public override float GetSectorInterpolator(MyMwcVector3Int sectorPosition)
        {
            Vector3 sectorPos              = MySolarSystemUtils.SectorsToKm(sectorPosition);
            Vector3 fromSectorToCenter     = sectorPos - Position;
            float   fromSectorToCenterDist = fromSectorToCenter.Length();

            if (fromSectorToCenterDist > Radius)
            {
                // Out of circle zone
                return(0);
            }

            float cubicInterpolator = MathHelper.SmoothStep(0, 1, fromSectorToCenterDist / Radius);

            return(cubicInterpolator);
        }
コード例 #3
0
        public override float GetSectorInterpolator(MyMwcVector3Int sectorPosition)
        {
            //Sem ja
            Vector3 sectorPos = MySolarSystemUtils.SectorsToKm(sectorPosition);
            //vzdalenost od stredu vesmiru ke mne  //stred vesmiru
            Vector3 centerToSector     = sectorPos - OrbitProperties.OrbitCenter;
            float   sectorToCenterDist = centerToSector.Length();

            //Stred pulmesice            //stred vesmiru
            Vector3 centerToZone = OrbitProperties.AreaCenter - OrbitProperties.OrbitCenter;
            float   orbitRadius  = centerToZone.Length();


            //vzdalenost mezi orbitama
            float distFromOrbit = Math.Abs(orbitRadius - sectorToCenterDist);

            if (distFromOrbit > OrbitProperties.MaxDistanceFromOrbitHigh)
            {
                // Not in area (not on ring)
                return(0);
            }

            //
            //float baseAngle = MyMath.AngleTo(centerToZone, Vector3.UnitZ).Y;
            //float angle = MyMath.AngleTo(centerToZone, centerToSector).Y;
            float angle = MyMath.AngleBetween(centerToSector, centerToZone);

            if (Math.Abs(angle) > HalfAngle)
            {
                // Not in area (other part of orbit)
                return(0);
            }

            float angleInterpolator       = angle / HalfAngle;
            float maxDistFromOrbitAtAngle = MathHelper.SmoothStep(OrbitProperties.MaxDistanceFromOrbitHigh, OrbitProperties.MaxDistanceFromOrbitLow, angleInterpolator);

            if (distFromOrbit > maxDistFromOrbitAtAngle)
            {
                // Not in area (not in shape of zone)
                return(0);
            }

            float interpolator = distFromOrbit / maxDistFromOrbitAtAngle;

            interpolator = 1 - (float)Math.Pow(interpolator, 3);
            return(interpolator);
        }
コード例 #4
0
        /// <summary>
        /// Rebuild the areas
        /// </summary>
        public static void CreateRimeArea()
        {
            Areas[MySolarSystemAreaEnum.Rime] = new MySolarSystemAreaOrbit()
            {
                Name            = "Rime",
                AreaType        = MySolarSystemArea.AreaEnum.PostPlanet,
                OrbitProperties = new MyOrbitProperties()
                {
                    OrbitCenter              = Vector3.Zero,
                    AreaCenter               = MySolarSystemUtils.SectorsToKm(MyBgrCubeConsts.RIME_SECTOR),
                    LongSpread               = 0.05f,
                    MaxDistanceFromOrbitLow  = 2.1f * MyBgrCubeConsts.MILLION_KM,
                    MaxDistanceFromOrbitHigh = 8.4f * MyBgrCubeConsts.MILLION_KM,
                },
                SolarMapData = new MySolarMapData()
                {
                    DustColor            = new Vector3(0.8f, 0.11f, 0.08f),
                    DustColorVariability = new Vector4(0.15f),
                    TemplateGroups       = new MyTemplateGroupInfo[]
                    {
                        new MyTemplateGroupInfo {
                            Importance = 1, Count = 0, TemplateGroup = MyTemplateGroupEnum.RandomStations
                        },
                        new MyTemplateGroupInfo {
                            Importance = 0.5f, Count = 0, TemplateGroup = MyTemplateGroupEnum.RandomStations
                        },
                    }
                },
                SectorData = new MySolarSectorData()
                {
                    SunProperties      = RimeSunProperties,
                    FogProperties      = RimeFogProperties,
                    ImpostorProperties = RimeImpostorsProperties,
                    GodRaysProperties  = RimeGodRaysProperties,
                    DebrisProperties   = DefaultDebrisProperties,

                    SectorObjectsCounts        = RimeObjectsProperties,
                    PrimaryAsteroidMaterials   = DefaultAsteroidMaterials,
                    SecondaryAsteroidMaterials = DefaultAsteroidMaterials,

                    ParticleDustProperties = RimeDustProperties,
                },
            };
        }
コード例 #5
0
        /// <summary>
        /// Rebuild the areas
        /// </summary>
        public static void CreateChineseRafinaryArea()
        {
            Areas[MySolarSystemAreaEnum.ChineseRafinary] = new MySolarSystemAreaOrbit()
            {
                Name            = "Chinese Rafinary",
                AreaType        = MySolarSystemArea.AreaEnum.PostPlanet,
                OrbitProperties = new MyOrbitProperties()
                {
                    OrbitCenter              = Vector3.Zero,
                    AreaCenter               = MySolarSystemUtils.SectorsToKm(MyBgrCubeConsts.CHINESERAFINARY_SECTOR),
                    LongSpread               = 0.15f,
                    MaxDistanceFromOrbitLow  = 4.1f * MyBgrCubeConsts.MILLION_KM,
                    MaxDistanceFromOrbitHigh = 9.4f * MyBgrCubeConsts.MILLION_KM,
                },
                SolarMapData = new MySolarMapData()
                {
                    DustColor            = new Vector3(0.32f, 0.71f, 0.18f),
                    DustColorVariability = new Vector4(0.15f),
                    TemplateGroups       = new MyTemplateGroupInfo[]
                    {
                        new MyTemplateGroupInfo {
                            Importance = 1, Count = 0, TemplateGroup = MyTemplateGroupEnum.RandomStations
                        },
                        new MyTemplateGroupInfo {
                            Importance = 0.5f, Count = 0, TemplateGroup = MyTemplateGroupEnum.RandomStations
                        },
                    }
                },
                SectorData = new MySolarSectorData()
                {
                    SunProperties      = ChineseRafinarySunProperties,
                    FogProperties      = ChineseRafinaryFogProperties,
                    ImpostorProperties = ChineseRafinaryImpostorsProperties,
                    DebrisProperties   = DefaultDebrisProperties,

                    SectorObjectsCounts        = ChineseRafinaryObjectsProperties,
                    PrimaryAsteroidMaterials   = ChineseRafinaryAsteroidMaterials,
                    SecondaryAsteroidMaterials = ChineseRafinarySecondaryMaterials,

                    ParticleDustProperties = ChineseRafinaryDustProperties,
                },
            };
        }