Пример #1
0
 public void start(Transform master, RAKTerrainMaster masterTerrain, GameObject sun)
 {
     this.sun           = sun;
     this.masterTerrain = masterTerrain;
     windZone           = master.gameObject.GetComponent <WindZone>();
     audioClips         = new RAKAudioClip[2];
     audioClips[0]      = new RAKAudioClip(RAKUtilities.getAudioClip(RAKUtilities.AUDIO_CLIP_RAIN_LIGHT));
     audioClips[1]      = new RAKAudioClip(RAKUtilities.getAudioClip(RAKUtilities.AUDIO_CLIP_WIND_MEDIUM));
     rainPrefab         = RAKUtilities.getPrefab("RainPrefab");
     audioSource        = master.gameObject.AddComponent <AudioSource>();
     audioSource.clip   = audioClips[0].audioClip;
     audioSource.loop   = true;
     windAudio          = master.gameObject.AddComponent <AudioSource>();
     windAudio.clip     = audioClips[1].audioClip;
     windAudio.loop     = true;
     setWeather(WeatherType.Clear);
     initialized = true;
 }
Пример #2
0
        public GameObject addCloudParticle(CloudType cloudType, GameObject parent)
        {
            GameObject cloudSection;

            if (cloudType == CloudType.DENSE_NORMAL)
            {
                cloudSection = RAKUtilities.getPrefab("CloudSectionAngry");
            }
            else
            {
                cloudSection = null;
            }
            cloudSection = (GameObject)Instantiate(cloudSection, Vector3.zero, Quaternion.identity);//, 1);
            cloudSection.transform.SetParent(parent.transform);
            cloudSection.transform.localPosition = Vector3.zero;
            return(cloudSection);

            /*ParticleSystem po = parent.AddComponent<ParticleSystem>();
             * ParticleSystem.MainModule mainModule = po.main;
             *
             * ParticleSystem.ShapeModule shapeModule = po.shape;
             * ParticleSystem.MinMaxCurve emissionCurve = po.emission.rateOverTime;
             * ParticleSystem.LimitVelocityOverLifetimeModule velOverTimeModule = po.limitVelocityOverLifetime;
             * ParticleSystem.ColorOverLifetimeModule colorModule = po.colorOverLifetime;
             * ParticleSystem.ColorBySpeedModule colorBySpeed = po.colorBySpeed;
             * ParticleSystem.RotationOverLifetimeModule rotationModule = po.rotationOverLifetime;
             * ParticleSystem.NoiseModule noiseModule = po.noise;
             * po.Stop();
             * if (cloudType == CloudType.DENSE_NORMAL)
             * {
             *  ParticleSystem.MinMaxCurve startSize = new ParticleSystem.MinMaxCurve(25);
             *  mainModule.startSize = startSize;
             *  mainModule.startRotationX = 0;
             *  mainModule.startRotationY = 360;
             *  mainModule.maxParticles = 5000;
             *  mainModule.duration = 10;
             *  mainModule.loop = true;
             *  mainModule.prewarm = true;
             *  mainModule.startLifetime = 10;
             *  mainModule.gravityModifier = .4f;
             *  mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
             *  mainModule.simulationSpeed = .2f;
             *  mainModule.startSpeed = 0;
             *  mainModule.scalingMode = ParticleSystemScalingMode.Shape;
             *  mainModule.emitterVelocityMode = ParticleSystemEmitterVelocityMode.Transform;
             *  ParticleSystem.MinMaxGradient startGradient = new ParticleSystem.MinMaxGradient(new Color(79, 79, 79, 255), new Color(161, 161, 161, 255));
             *  mainModule.startColor = startGradient;
             *
             *  shapeModule.shapeType = ParticleSystemShapeType.Box;
             *  shapeModule.scale = new Vector3(10, 0, 10);
             *  shapeModule.randomDirectionAmount = 0;
             *  shapeModule.randomPositionAmount = 0;
             *
             *  emissionCurve.constant = 500;
             *
             *  velOverTimeModule.limit = 50;
             *  velOverTimeModule.dampen = .1f;
             *  velOverTimeModule.enabled = true;
             *
             *  Gradient colorOverLifeGradient = new Gradient();
             *  GradientColorKey[] colorOverLifeColorKeys = new GradientColorKey[2];
             *  colorOverLifeColorKeys[0] = new GradientColorKey(new Color(128, 128, 128), 0);
             *  colorOverLifeColorKeys[1] = new GradientColorKey(new Color(45, 95, 118), 100);
             *  colorOverLifeGradient.SetKeys(colorOverLifeColorKeys, new GradientAlphaKey[] { new GradientAlphaKey(255, 0) });
             *  colorModule.color = colorOverLifeGradient;
             *  colorModule.enabled = true;
             *
             *  Gradient speedGradient = new Gradient();
             *  GradientColorKey[] speedColorKeys = new GradientColorKey[3];
             *  speedColorKeys[0] = new GradientColorKey(new Color(45, 95, 118), 0);
             *  speedColorKeys[1] = new GradientColorKey(new Color(8, 46, 63), 40);
             *  speedColorKeys[2] = new GradientColorKey(new Color(0, 0, 0), 100);
             *  speedGradient.SetKeys(speedColorKeys, new GradientAlphaKey[] { new GradientAlphaKey(255, 0) });
             *  colorBySpeed.color = speedGradient;
             *  colorBySpeed.range = new Vector2(0, 50);
             *  colorBySpeed.enabled = true;
             *
             *  rotationModule.x = 75;
             *  rotationModule.y = 75;
             *  rotationModule.z = 75;
             *  rotationModule.enabled = true;
             *
             *  noiseModule.strength = 10;
             *  noiseModule.frequency = .05f;
             *  noiseModule.scrollSpeed = 1;
             *  noiseModule.damping = true;
             *  noiseModule.octaveCount = 4;
             *  noiseModule.octaveMultiplier = .5f;
             *  noiseModule.octaveScale = 2;
             *  noiseModule.enabled = true;
             * }
             * else if (cloudType == CloudType.LIGHT_NORMAL)
             * {
             *  ParticleSystem.MinMaxCurve startSize = new ParticleSystem.MinMaxCurve(15, 25);
             *  mainModule.startSize = startSize;
             *  shapeModule.scale = new Vector3(15, 0, 15);
             *  emissionCurve.constant = 150;
             *  mainModule.maxParticles = 450;
             *  shapeModule.randomDirectionAmount = 1;
             *  shapeModule.randomPositionAmount = 1;
             * }
             * po.Play();
             * return po;*/
        }