public void AddIdentifyAtBand(string resourceName, ResourceBand band, string bodyName, float amount)
        {
            if (!IsIdentified(resourceName, band.name, bodyName))
            {
                List <SpaceDustDiscoveryData> toIdentify = distributionData.FindAll(x =>
                                                                                    (x.ResourceName == resourceName) &&
                                                                                    (x.BandName == band.name) &&
                                                                                    (x.BodyName == bodyName));

                if (toIdentify == null || toIdentify.Count == 0)
                {
                    distributionData.Add(new SpaceDustDiscoveryData(resourceName, band.name, bodyName, true, true));
                }
                else
                {
                    foreach (SpaceDustDiscoveryData data in toIdentify)
                    {
                        if (data.Discovered)
                        {
                            data.identifyPercent += amount * band.RemoteDiscoveryScale;
                        }
                        if (data.identifyPercent >= 100f)
                        {
                            IdentifyResourceBand(resourceName, band, bodyName);
                        }
                    }
                }
            }
        }
示例#2
0
        public void CreateField(ResourceBand band,
                                string resourceName,
                                bool discovered,
                                bool identified,
                                Vector3 scaledSpacePosition)
        {
            targetCount = (int)(Mathf.Clamp(Settings.particleFieldBaseCount * band.ParticleCountScale, 1f, Settings.particleFieldMaxParticleCount));
            spinRate    = band.ParticleRotateRate;


            resName = resourceName;
            resBand = band;
            particleRenderer.maxParticleSize      = Settings.particleFieldMaxViewportParticleScale;
            particleRenderer.material             = new Material(Shader.Find(Settings.particleFieldShaderName));
            particleRenderer.material.mainTexture = (Texture)GameDatabase.Instance.GetTexture(Settings.particleFieldTextureUrl, false);

            if (identified)
            {
                particleColor = Settings.GetResourceColor(resourceName);
            }
            else
            {
                particleColor = Settings.resourceDiscoveredColor;
            }

            List <ParticleSystem.Particle> particles = GenerateParticles(targetCount);

            particleField.SetParticles(particles.ToArray(), targetCount);

            particleBuffer = new ParticleSystem.Particle[particleField.main.maxParticles];
            fieldGenerated = true;
            //Utils.Log($"[Field]: Created new field at {scaledSpacePosition}");
        }
        public void AddDiscoveryAtBand(string resourceName, ResourceBand band, string bodyName, float amount)
        {
            if (!IsDiscovered(resourceName, band.name, bodyName))
            {
                List <SpaceDustDiscoveryData> toDiscover = distributionData.FindAll(x =>
                                                                                    (x.ResourceName == resourceName) &&
                                                                                    (x.BandName == band.name) &&
                                                                                    (x.BodyName == bodyName));

                if (toDiscover == null || toDiscover.Count == 0)
                {
                    distributionData.Add(new SpaceDustDiscoveryData(resourceName, band.name, bodyName, false, false));
                }
                else
                {
                    foreach (SpaceDustDiscoveryData data in toDiscover)
                    {
                        data.discoveryPercent += amount * band.RemoteDiscoveryScale;
                        if (data.discoveryPercent >= 100f)
                        {
                            DiscoverResourceBand(resourceName, band, bodyName);
                        }
                    }
                }
            }
        }
        public void IdentifyResourceBand(string resourceName, ResourceBand band, string bodyName)
        {
            if (!IsIdentified(resourceName, band.name, bodyName))
            {
                List <SpaceDustDiscoveryData> toIdentify = distributionData.FindAll(x =>
                                                                                    (x.ResourceName == resourceName) &&
                                                                                    (x.BandName == band.name) &&
                                                                                    (x.BodyName == bodyName));

                if (toIdentify == null || toIdentify.Count == 0)
                {
                    distributionData.Add(new SpaceDustDiscoveryData(resourceName, band.name, bodyName, true, true));
                }
                else
                {
                    foreach (SpaceDustDiscoveryData data in toIdentify)
                    {
                        data.Discovered       = true;
                        data.discoveryPercent = 100;
                        data.Identified       = true;
                        data.identifyPercent  = 100;
                    }
                }
                if (HighLogic.LoadedSceneIsFlight)
                {
                    ScreenMessage msg = new ScreenMessage(Localizer.Format("#LOC_SpaceDust_Message_Identified", resourceName, bodyName), 5f, ScreenMessageStyle.UPPER_CENTER);
                    ScreenMessages.PostScreenMessage(msg);
                }
                Utils.Log($"[SpaceDustScenario]: Identified {resourceName} in {band.name} at {bodyName}");
                if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
                {
                    float scienceValue = FlightGlobals.GetBodyByName(bodyName).scienceValues.InSpaceHighDataValue *band.identifyScienceReward;
                    Utils.Log($"[SpaceDustScenario]: Added {scienceValue} science because  {band.name} at {bodyName} was identified");

                    ResearchAndDevelopment.Instance.AddScience(scienceValue, TransactionReasons.ScienceTransmission);
                }
            }
        }
 public void AddIdentifyAtBand(string resourceName, ResourceBand band, CelestialBody b, float amount)
 {
     AddIdentifyAtBand(resourceName, band, b.bodyName, amount);
 }
 public void IdentifyResourceBand(string resourceName, ResourceBand band, CelestialBody b)
 {
     IdentifyResourceBand(resourceName, band, b.bodyName);
 }
 public void DiscoverResourceBand(string resourceName, ResourceBand band, CelestialBody b)
 {
     DiscoverResourceBand(resourceName, band, b.bodyName);
 }
示例#8
0
 public void IdentifyResourceBand(string resourceName, ResourceBand band, CelestialBody b, bool addScience)
 {
     IdentifyResourceBand(resourceName, band, b.bodyName, addScience);
 }
示例#9
0
 public void DiscoverResourceBand(string resourceName, ResourceBand band, CelestialBody b, bool addScience)
 {
     DiscoverResourceBand(resourceName, band, b.bodyName, addScience);
 }