예제 #1
0
	public void create(Vector3 position, Vector3 direction) {
		if(allWindParticles.running) {
			particles[indexParticles] = new CloudParticle(position,direction); // create Cloud
			if(indexParticles >= maxAmountParticles-1) indexParticles = 0; else indexParticles++; // if array is full, restart index
			if (amountParticles < indexParticles) amountParticles = indexParticles;
		}
	}
예제 #2
0
 public void PaintTheParticlesShadows(CloudParticle MyCloudParticle)
 {
     if (PaintType == TypePaintDistr.Random)
     {
         MyCloudParticle.PaintParticlesBelow(MainColor, SecondColor, TintStrength, offset, 0);
     }
     else
     if (PaintType == TypePaintDistr.Below)
     {
         MyCloudParticle.PaintParticlesBelow(MainColor, SecondColor, TintStrength, offset, 1);
     }
 }
예제 #3
0
    void  ManageCloudShadow(CloudParticle MyCloudParticle)
    {
        int  RandomNumber = Random.Range(0, 10);
        bool ShowShadow   = true;

        if (NumberOfShadows != TypeShadow.All)
        {
            if (NumberOfShadows == TypeShadow.Most && RandomNumber > 7)
            {
                ShowShadow = false;
            }
            else
            if (NumberOfShadows == TypeShadow.Half && RandomNumber > 5)
            {
                ShowShadow = false;
            }
            else
            if (NumberOfShadows == TypeShadow.Some && RandomNumber <= 7)
            {
                ShowShadow = false;
            }
            else
            if (NumberOfShadows == TypeShadow.None)
            {
                ShowShadow = false;
            }

            if (!ShowShadow && MyCloudParticle.IsShadowActive())
            {
                MyCloudParticle.SetShadowActive(false);
            }
            else
            if (ShowShadow && !MyCloudParticle.IsShadowActive())
            {
                MyCloudParticle.SetShadowActive(true);
            }
        }
        else
        if (!MyCloudParticle.IsShadowActive())
        {
            MyCloudParticle.SetShadowActive(true);
        }
    }
예제 #4
0
    void SpawnDustParticles()
    {
        var prefab       = Resources.Load <GameObject>("Prefabs/CloudParticle");
        int numberClouds = Random.Range(2, 4);

        for (int i = 0; i < numberClouds; i++)
        {
            GameObject cloudParticle = Instantiate <GameObject>(prefab);
            float      range         = 0.3f;
            Vector3    randOffset    = new Vector3(Random.Range(-range, range), Random.Range(-range * 1.25f, range * 1.25f), Random.Range(-range, range));
            cloudParticle.transform.position = new Vector3(
                transform.position.x + randOffset.x, transform.position.y - 1 + randOffset.y, transform.position.z + randOffset.z
                );

            CloudParticle controller = cloudParticle.GetComponent <CloudParticle>();
            controller.topScale = Random.Range(1.25f, 1.55f);
            controller.lifetime = Random.Range(1f, 1.33f);
        }
    }
예제 #5
0
// Change the Material depending on the type of cloud defined by user and the renderer (Bright/Realistic)
// So assign one of the two sets of materials available (Additive or Blended).
    void  AssignCloudMaterial(CloudParticle MyCloudParticle, TypeRender CloudRender, Type TypeClouds)
    {
        ModifyPTMaterials();
        if (CloudRender == TypeRender.Bright)
        {
            if (TypeClouds == Type.Nimbus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[0]);
            }
            else
            if (TypeClouds == Type.Nimbus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[1]);
            }
            else
            if (TypeClouds == Type.Nimbus3)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[2]);
            }
            else
            if (TypeClouds == Type.Nimbus4)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[3]);
            }
            else
            if (TypeClouds == Type.Cirrus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[4]);
            }
            else
            if (TypeClouds == Type.Cirrus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[5]);
            }
            else
            if (TypeClouds == Type.MixNimbus)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 4)]);
            }
            else
            if (TypeClouds == Type.MixCirrus)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(4, 6)]);
            }
            else
            if (TypeClouds == Type.MixAll)
            {
                MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 6)]);
            }
            else
            if (TypeClouds == Type.PT1)
            {
                //if(ProceduralTexture.IsInicialized())
                MyCloudParticle.SetMaterial(CloudsPTMatAdditive);
            }
        }
        else
        {
            if (TypeClouds == Type.Nimbus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[0]);
            }
            else
            if (TypeClouds == Type.Nimbus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[1]);
            }
            else
            if (TypeClouds == Type.Nimbus3)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[2]);
            }
            else
            if (TypeClouds == Type.Nimbus4)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[3]);
            }
            else
            if (TypeClouds == Type.Cirrus1)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[4]);
            }
            else
            if (TypeClouds == Type.Cirrus2)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[5]);
            }
            else
            if (TypeClouds == Type.MixNimbus)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 4)]);
            }
            else
            if (TypeClouds == Type.MixCirrus)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(4, 6)]);
            }
            else
            if (TypeClouds == Type.MixAll)
            {
                MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 6)]);
            }
            else
            if (TypeClouds == Type.PT1)
            {
                //if(ProceduralTexture.IsInicialized())
                MyCloudParticle.SetMaterial(CloudsPTMatBlended);
            }
        }
    }
예제 #6
0
    void  Start()
    {
        MyTransform = this.transform;
        MyPosition  = transform.position;
        CloudParticle MyCloudParticle;
        Vector3       MyPos;
        Vector3       SideAux;
        int           i;

        //CloudPrefab = GameObject.Find("VolCloud Basic");
        //CloudPrefab = Resources.LoadAssetAtPath("Assets/Volumetric Clouds/Prefabs/VolCloud Basic.prefab", typeof(GameObject));
        CloudPresetAnt       = CloudPreset;
        CloudRenderAnt       = CloudRender;
        CloudDetailAnt       = CloudDetail;
        TypeCloudsAnt        = TypeClouds;
        EmissionMultAnt      = EmissionMult;
        SizeFactorPartAnt    = SizeFactorPart;
        SoftCloudsAnt        = SoftClouds;
        SpreadDirAnt         = SpreadDir;
        LengthSpreadAnt      = LengthSpread;
        NumberCloudsAnt      = NumberClouds;
        MaximunVelocityAnt   = MaximunVelocity;
        VelocityMultipierAnt = VelocityMultipier;
        PaintTypeAnt         = PaintType;
        CloudColorAnt        = CloudColor;
        MainColorAnt         = MainColor;
        SecondColorAnt       = SecondColor;
        TintStrengthAnt      = TintStrength;
        offsetAnt            = offset;
        NumberOfShadowsAnt   = NumberOfShadows;
        MaxWithCloudAnt      = MaxWithCloud;
        MaxTallCloudAnt      = MaxTallCloud;
        MaxDepthCloudAnt     = MaxDepthCloud;

        // Define the axis the clouds are moving on. (Only one value X or Y or Z, must be not equal Zero).
        Vector3 MyVelocity = MaximunVelocity;

        if (MyVelocity.x > 0)
        {
            CloudsGenerateAxis = Axis.X;
        }
        else
        if (MyVelocity.x < 0)
        {
            CloudsGenerateAxis = Axis.XNeg;
        }
        else
        if (MyVelocity.y > 0)
        {
            CloudsGenerateAxis = Axis.Y;
        }
        else
        if (MyVelocity.y < 0)
        {
            CloudsGenerateAxis = Axis.YNeg;
        }
        else
        if (MyVelocity.z > 0)
        {
            CloudsGenerateAxis = Axis.Z;
        }
        else
        if (MyVelocity.z < 0)
        {
            CloudsGenerateAxis = Axis.ZNeg;
        }

        // Create the procedural Texture Object only if it's selected in the clouds option in the editor.
        if (TypeClouds == Type.PT1)
        {
            GameObject PText1 = new GameObject();
            PText1.name = "CloudsToyPT1";
            PText1.transform.position = Vector3.zero;
            PText1.transform.rotation = Quaternion.identity;
            PText1.transform.parent   = MyTransform;
            ProceduralTexture         = (ProceduralCloudTexture)PText1.AddComponent("ProceduralCloudTexture");
            PT1CopyInitialParameters();
        }

        // Create the materials based in the textures provided by the user. maximun textures . 6
        // There are two types of materials Additive Soft for bright Clouds & Blend for more realistic ones.
        // First type of clouds. Additive - Bright Ones.
        for (i = 0; i < 6; i++)
        {
            CloudsMatAdditive[i]             = new Material(Shader.Find("FX/CloudBright"));
            CloudsMatAdditive[i].mainTexture = CloudsTextAdd[i];
        }
        // Second type of Clouds. Realistic Ones.
        for (i = 0; i < 6; i++)
        {
            CloudsMatBlended[i] = new Material(Shader.Find("FX/CloudRealistic"));
            CloudsMatBlended[i].SetColor("_TintColor", CloudColor);
            CloudsMatBlended[i].mainTexture = CloudsTextBlended[i];
        }

        // Tirdth type of Cloud. Procedural Additive texture, Created only if procedural texture had been selected
        if (ProceduralTexture)
        {
            CloudsPTMatAdditive = new Material(Shader.Find("FX/CloudBright"));
            if (ProceduralTexture.IsInicialized())
            {
                CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
            }
            // Fourth type of Cloud. Procedural Blended texture
            CloudsPTMatBlended = new Material(Shader.Find("FX/CloudRealistic"));
            CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
            if (ProceduralTexture.IsInicialized())
            {
                CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;
            }
        }

        // Generate the clouds for first time, never well be destroyed during the scene.
        // Using a cubic shape to bounds the limits of coords. creation
        SideAux = Side / 2;
        for (i = 0; i < MaximunClouds; i++)
        {
            MyPos           = MyPosition;
            MyPos.x         = Random.Range(MyPos.x - SideAux.x, MyPos.x + SideAux.x);
            MyPos.y         = Random.Range(MyPos.y - SideAux.y, MyPos.y + SideAux.y);
            MyPos.z         = Random.Range(MyPos.z - SideAux.z, MyPos.z + SideAux.z);
            MyCloudParticle = new CloudParticle(MyPos, Quaternion.identity);
            MyCloudParticle.SetCloudParent(MyTransform);
            MyCloudsParticles.Add(MyCloudParticle);

            // Define some main particle properties
            if (TypeClouds == Type.Nimbus1 || TypeClouds == Type.Nimbus2 ||
                TypeClouds == Type.Nimbus3 || TypeClouds == Type.Nimbus4 ||
                TypeClouds == Type.MixNimbus || TypeClouds == Type.MixAll || TypeClouds == Type.PT1)
            {
                MyCloudParticle.DefineCloudProperties(i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 0, FixedSize, true, true);
            }
            else
            if (TypeClouds == Type.Cirrus1 || TypeClouds == Type.Cirrus2 || TypeClouds == Type.MixCirrus)
            {
                MyCloudParticle.DefineCloudProperties(i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 1, FixedSize, true, true);
            }

            AssignCloudMaterial(MyCloudParticle, CloudRender, TypeClouds);
            MyCloudParticle.SetCloudEmitter(i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SetCloudVelocity(MaximunVelocity, VelocityMultipier);
            MyCloudParticle.SetLengthScale(LengthSpread);
            MyCloudParticle.SetWorldVelocity(SpreadDir);
            MyCloudParticle.SoftCloud(SoftClouds);
            ManageCloudShadow(MyCloudParticle);
            // If the cloud will be active, Paint the cloud otherwise deactivate it (they are initially active, but dont emit anything)
            if (i < NumberClouds)
            {
                if (TypeClouds != Type.PT1)
                {
                    MyCloudParticle.SetActive(true);             // Emit the particles, because this cloud is visible
                    MyCloudParticle.UpdateCloudsPosition();      // Updating the positions of particles once the Particle Emmitter emit them.
                    if (CloudRender == TypeRender.Realistic)
                    {
                        MyCloudParticle.SetMainColor(CloudColor);          // Set the main color of the cloud
                    }
                    PaintTheParticlesShadows(MyCloudParticle);             // Colorize the cloud with the Cloud Color and the Secondary Color
                }
            }
            else
            {
                MyCloudParticle.DesactivateRecursively();
            }
        }
    }
    public override void Update(TimeSpan time)
    {
        tick++;

        playership.Position += new XY(1 / 8f, 0);


        var c = clouds.FirstOrDefault(c => c.pos == (Point)playership.Position.roundAway);

        if (c != null)
        {
            if (playership.Velocity.magnitude > 4)
            {
                int a     = c.symbol.Foreground.A;
                var delta = random.Next(1, 30);
                a -= delta;
                if (a > 0)
                {
                    c.symbol.Foreground = c.symbol.Foreground.SetAlpha((byte)a);
                    playership.fuel    += delta / 6;
                }
                else
                {
                    clouds.Remove(c);
                }
                playership.Velocity -= playership.Velocity / 20;

                UpdateGravity();
            }
            else
            {
                playership.Velocity -= playership.Velocity / 20;
            }
        }
        else
        {
            UpdateGravity();
        }
        UpdatePosition();

        void UpdatePosition()
        {
            playership.Position += playership.Velocity / RogueFrontier.Program.TICKS_PER_SECOND;
        }

        void UpdateGravity()
        {
            playership.Velocity -= new XY(0, 6 / 30f);
        }

        playership.UpdateControls();
        UpdateClouds();

        void UpdateClouds()
        {
            //Update clouds
            if (tick % 8 == 0)
            {
                clouds.ForEach(c => c.Update(random));
            }
            //Spawn cloud
            if (tick % 64 == 0)
            {
                int effectMinY = Height / 5;
                int effectMaxY = 4 * Height / 5;

                CloudParticle.CreateClouds(effectMinY, effectMaxY, clouds, random);
                CloudParticle.CreateClouds(effectMinY, effectMaxY, clouds, random);
                CloudParticle.CreateClouds(effectMinY, effectMaxY, clouds, random);
            }
        }
    }
예제 #8
0
    void Start()
    {
        MyTransform = this.transform;
        MyPosition = transform.position;
        CloudParticle MyCloudParticle;
        Vector3 MyPos;
        Vector3 SideAux;
        int i;

        //CloudPrefab = GameObject.Find("VolCloud Basic");
        //CloudPrefab = Resources.LoadAssetAtPath("Assets/Volumetric Clouds/Prefabs/VolCloud Basic.prefab", typeof(GameObject));
        CloudPresetAnt = CloudPreset;
        CloudRenderAnt = CloudRender;
        CloudDetailAnt = CloudDetail;
        TypeCloudsAnt = TypeClouds;
        EmissionMultAnt = EmissionMult;
        SizeFactorPartAnt = SizeFactorPart;
        SoftCloudsAnt = SoftClouds;
        SpreadDirAnt = SpreadDir;
        LengthSpreadAnt = LengthSpread;
        NumberCloudsAnt = NumberClouds;
        MaximunVelocityAnt = MaximunVelocity;
        VelocityMultipierAnt = VelocityMultipier;
        PaintTypeAnt = PaintType;
        CloudColorAnt = CloudColor;
        MainColorAnt = MainColor;
        SecondColorAnt = SecondColor;
        TintStrengthAnt = TintStrength;
        offsetAnt = offset;
        NumberOfShadowsAnt = NumberOfShadows;
        MaxWithCloudAnt = MaxWithCloud;
        MaxTallCloudAnt = MaxTallCloud;
        MaxDepthCloudAnt = MaxDepthCloud;

        // Define the axis the clouds are moving on. (Only one value X or Y or Z, must be not equal Zero).
        Vector3 MyVelocity = MaximunVelocity;
        if(MyVelocity.x > 0)
        CloudsGenerateAxis = Axis.X;
        else
        if(MyVelocity.x < 0)
        CloudsGenerateAxis = Axis.XNeg;
        else
        if(MyVelocity.y > 0)
        CloudsGenerateAxis = Axis.Y;
        else
        if(MyVelocity.y < 0)
        CloudsGenerateAxis = Axis.YNeg;
        else
        if(MyVelocity.z > 0)
        CloudsGenerateAxis = Axis.Z;
        else
        if(MyVelocity.z < 0)
        CloudsGenerateAxis = Axis.ZNeg;

        // Create the procedural Texture Object only if it's selected in the clouds option in the editor.
        if(TypeClouds == Type.PT1){
        GameObject PText1 = new GameObject();
        PText1.name = "CloudsToyPT1";
        PText1.transform.position =  Vector3.zero;
        PText1.transform.rotation =  Quaternion.identity;
        PText1.transform.parent = MyTransform;
        ProceduralTexture = (ProceduralCloudTexture)PText1.AddComponent ("ProceduralCloudTexture");
        PT1CopyInitialParameters();
        }

        // Create the materials based in the textures provided by the user. maximun textures . 6
        // There are two types of materials Additive Soft for bright Clouds & Blend for more realistic ones.
        // First type of clouds. Additive - Bright Ones.
        for(i = 0; i < 6; i++){
        CloudsMatAdditive[i] = new Material(Shader.Find("FX/CloudBright"));
        CloudsMatAdditive[i].mainTexture = CloudsTextAdd[i];
        }
        // Second type of Clouds. Realistic Ones.
        for(i = 0; i < 6; i++){
        CloudsMatBlended[i] = new Material(Shader.Find("FX/CloudRealistic"));
        CloudsMatBlended[i].SetColor("_TintColor", CloudColor);
        CloudsMatBlended[i].mainTexture = CloudsTextBlended[i];
        }

        // Tirdth type of Cloud. Procedural Additive texture, Created only if procedural texture had been selected
        if(ProceduralTexture){
        CloudsPTMatAdditive = new Material(Shader.Find("FX/CloudBright"));
        if(ProceduralTexture.IsInicialized())
            CloudsPTMatAdditive.mainTexture = ProceduralTexture.MyTexture;
        // Fourth type of Cloud. Procedural Blended texture
        CloudsPTMatBlended = new Material(Shader.Find("FX/CloudRealistic"));
        CloudsPTMatBlended.SetColor("_TintColor", CloudColor);
        if(ProceduralTexture.IsInicialized())
            CloudsPTMatBlended.mainTexture = ProceduralTexture.MyAlphaTexture;
        }

        // Generate the clouds for first time, never well be destroyed during the scene.
        // Using a cubic shape to bounds the limits of coords. creation
        SideAux =  Side/2;
        for(i = 0; i < MaximunClouds; i++){
        MyPos = MyPosition;
        MyPos.x = Random.Range (MyPos.x-SideAux.x, MyPos.x+SideAux.x);
        MyPos.y = Random.Range (MyPos.y-SideAux.y, MyPos.y+SideAux.y);
        MyPos.z = Random.Range (MyPos.z-SideAux.z, MyPos.z+SideAux.z);
        MyCloudParticle = new CloudParticle(MyPos, Quaternion.identity);
        MyCloudParticle.SetCloudParent(MyTransform);
        MyCloudsParticles.Add(MyCloudParticle);

        // Define some main particle properties
        if( TypeClouds == Type.Nimbus1 || TypeClouds == Type.Nimbus2 ||
            TypeClouds == Type.Nimbus3 || TypeClouds == Type.Nimbus4 ||
            TypeClouds == Type.MixNimbus || TypeClouds == Type.MixAll || TypeClouds == Type.PT1)
                MyCloudParticle.DefineCloudProperties (i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 0, FixedSize, true ,  true);
        else
        if(TypeClouds == Type.Cirrus1 || TypeClouds == Type.Cirrus2 || TypeClouds == Type.MixCirrus)
                MyCloudParticle.DefineCloudProperties (i, MaxWithCloud, MaxTallCloud, MaxDepthCloud, 1, FixedSize, true ,  true);

        AssignCloudMaterial (MyCloudParticle,  CloudRender ,  TypeClouds);
        MyCloudParticle.SetCloudEmitter (i, SpreadDir, SoftClouds, SizeFactorPart, EmissionMult, MaximunVelocity, VelocityMultipier);
        MyCloudParticle.SetCloudVelocity (MaximunVelocity, VelocityMultipier);
        MyCloudParticle.SetLengthScale(LengthSpread);
        MyCloudParticle.SetWorldVelocity(SpreadDir);
        MyCloudParticle.SoftCloud(SoftClouds);
        ManageCloudShadow(MyCloudParticle);
        // If the cloud will be active, Paint the cloud otherwise deactivate it (they are initially active, but dont emit anything)
        if(i < NumberClouds){
            if(TypeClouds != Type.PT1){
                MyCloudParticle.SetActive(true); // Emit the particles, because this cloud is visible
                MyCloudParticle.UpdateCloudsPosition(); // Updating the positions of particles once the Particle Emmitter emit them.
                if(CloudRender == TypeRender.Realistic)
                    MyCloudParticle.SetMainColor(CloudColor);  // Set the main color of the cloud
                PaintTheParticlesShadows(MyCloudParticle); // Colorize the cloud with the Cloud Color and the Secondary Color
            }
        }
        else
            MyCloudParticle.DesactivateRecursively();
        }
    }
예제 #9
0
    void ManageCloudShadow(CloudParticle MyCloudParticle)
    {
        int RandomNumber = Random.Range(0, 10);
        bool  ShowShadow = true;

        if(NumberOfShadows != TypeShadow.All){
        if(NumberOfShadows == TypeShadow.Most && RandomNumber > 7)
            ShowShadow = false;
        else
        if(NumberOfShadows == TypeShadow.Half && RandomNumber > 5)
            ShowShadow = false;
        else
        if(NumberOfShadows == TypeShadow.Some && RandomNumber <= 7)
            ShowShadow = false;
        else
        if(NumberOfShadows == TypeShadow.None)
            ShowShadow = false;

        if(!ShowShadow && MyCloudParticle.IsShadowActive())
            MyCloudParticle.SetShadowActive(false);
        else
        if(ShowShadow && !MyCloudParticle.IsShadowActive())
            MyCloudParticle.SetShadowActive(true);
        }
        else
        if(!MyCloudParticle.IsShadowActive())
            MyCloudParticle.SetShadowActive(true);
    }
예제 #10
0
 // Change the Material depending on the type of cloud defined by user and the renderer (Bright/Realistic)
 // So assign one of the two sets of materials available (Additive or Blended).
 void AssignCloudMaterial( CloudParticle MyCloudParticle ,   TypeRender CloudRender ,   Type TypeClouds)
 {
     ModifyPTMaterials();
     if(CloudRender == TypeRender.Bright){
     if(TypeClouds == Type.Nimbus1)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[0]);
     else
     if(TypeClouds == Type.Nimbus2)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[1]);
     else
     if(TypeClouds == Type.Nimbus3)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[2]);
     else
     if(TypeClouds == Type.Nimbus4)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[3]);
     else
     if(TypeClouds == Type.Cirrus1)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[4]);
     else
     if(TypeClouds == Type.Cirrus2)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[5]);
     else
     if(TypeClouds == Type.MixNimbus)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 4)]);
     else
     if(TypeClouds == Type.MixCirrus)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(4, 6)]);
     else
     if(TypeClouds == Type.MixAll)
         MyCloudParticle.SetMaterial(CloudsMatAdditive[Random.Range(0, 6)]);
     else
     if(TypeClouds == Type.PT1)
         //if(ProceduralTexture.IsInicialized())
             MyCloudParticle.SetMaterial(CloudsPTMatAdditive);
     }
     else{
     if(TypeClouds == Type.Nimbus1)
         MyCloudParticle.SetMaterial(CloudsMatBlended[0]);
     else
     if(TypeClouds == Type.Nimbus2)
         MyCloudParticle.SetMaterial(CloudsMatBlended[1]);
     else
     if(TypeClouds == Type.Nimbus3)
         MyCloudParticle.SetMaterial(CloudsMatBlended[2]);
     else
     if(TypeClouds == Type.Nimbus4)
         MyCloudParticle.SetMaterial(CloudsMatBlended[3]);
     else
     if(TypeClouds == Type.Cirrus1)
         MyCloudParticle.SetMaterial(CloudsMatBlended[4]);
     else
     if(TypeClouds == Type.Cirrus2)
         MyCloudParticle.SetMaterial(CloudsMatBlended[5]);
     else
     if(TypeClouds == Type.MixNimbus)
         MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 4)]);
     else
     if(TypeClouds == Type.MixCirrus)
         MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(4, 6)]);
     else
     if(TypeClouds == Type.MixAll)
         MyCloudParticle.SetMaterial(CloudsMatBlended[Random.Range(0, 6)]);
     else
     if(TypeClouds == Type.PT1)
         //if(ProceduralTexture.IsInicialized())
             MyCloudParticle.SetMaterial(CloudsPTMatBlended);
     }
 }
예제 #11
0
 public void PaintTheParticlesShadows(CloudParticle MyCloudParticle)
 {
     if(PaintType == TypePaintDistr.Random)
     MyCloudParticle.PaintParticlesBelow(MainColor, SecondColor, TintStrength, offset, 0);
     else
     if(PaintType == TypePaintDistr.Below)
     MyCloudParticle.PaintParticlesBelow(MainColor, SecondColor, TintStrength, offset, 1);
 }
        public void Update()
        {
            timer++;
            counter++;

            Camera2D.cam.Zoom = Math.Max(0.2f, 1 - (voidLine / -4000)) - .2f;

            animator.SetOrigin(new Vector2(voidLine - 220, 50));
            animator2.SetOrigin(new Vector2(voidLine - 140, 95));
            animator3.SetOrigin(new Vector2(voidLine - 50, 85));
            animator4.SetOrigin(new Vector2(voidLine - 90, 60));
            animator5.SetOrigin(new Vector2(voidLine - 86, 77));

            animator.Update();
            animator2.Update();
            animator3.Update();
            animator4.Update();
            animator5.Update();

            animator.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Idle));
            animator2.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk));
            animator3.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk2));
            animator4.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk));
            animator5.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk2));


            int mailGen  = Cloud.randCloud.Next(20000);
            int crateGen = Cloud.randCloud.Next(40000);
            int carGen   = Cloud.randCloud.Next(80000);

            if ((float)(mailGen) < 80f + counter / 5f)
            {
                float   randHeight = (float)(Cloud.randCloud.Next((int)roadHeight));
                Mailbox mb         = new Mailbox(new Vector2((Cloud.screenWidth * ((1 / Camera2D.cam.Zoom)) / 2) + 200, randHeight + 100f), this);
                renderables.Add(mb);
            }
            if ((float)(crateGen) < 80f + counter / 5f)
            {
                float randHeight = (float)(Cloud.randCloud.Next((int)roadHeight));
                crate cr         = new crate(new Vector2((Cloud.screenWidth * ((1 / Camera2D.cam.Zoom)) / 2) + 200, randHeight + 100f), this);
                renderables.Add(cr);
            }
            if ((float)(carGen) < 80f + counter / 5f && timer > 600)
            {
                float randHeight = (float)(Cloud.randCloud.Next((int)roadHeight));
                //car c = new car(new Vector2((Cloud.screenWidth + (1 / Camera2D.cam.Zoom)) / 2 + 200, randHeight), this);
                car c = new car(new Vector2((Cloud.screenWidth * (1 / Camera2D.cam.Zoom)) / 2 + 200, randHeight + 100f), this);
                renderables.Add(c);
            }

            //mainbg.velocity= new Vector2(worldSpeed, 0);
            if (vanSpeedA > 0)
            {
                vanSpeedA -= 1;
            }
            else
            {
                vanSpeedA = 0;
            }
            vanSpeed       += 0.5f - vanSpeedA;
            mainbg.velocity = new Vector2(mainbg.velocity.X - (vanSpeed / 1000), mainbg.velocity.Y);
            farbg.velocity  = new Vector2(mainbg.velocity.X / 5, farbg.velocity.Y);
            midbg.velocity  = new Vector2(mainbg.velocity.X / 2, midbg.velocity.Y);
            forebg.velocity = new Vector2(mainbg.velocity.X * 2, forebg.velocity.Y);
            roadbg.velocity = new Vector2(mainbg.velocity.X * 1.25f, farbg.velocity.Y);
            worldSpeed      = mainbg.velocity.X;
            edgeLine       -= vanSpeed;
            voidLine       -= vanSpeed;
            //voidbg.position = new Vector2(voidLine, voidbg.position.Y);

            oscillator = (oscillator + 1.0f) % ((float)Math.PI * 2.0f);

            if (voidLine + 360 > -1080 && !isDead)
            {
                float amt = Math.Min(1 - ((voidLine + 360) / -1080), 1);
                Camera2D.cam.rumble = amt * 10;
                if (amt > 0.3)
                {
                    Cloud.controller.Rumble(
                        amt /* * (((float)Math.Sin(oscillator) + 1) / 2.0f)*/,
                        amt /* * (((float)Math.Sin(oscillator) + 1) / 2.0f)*/,
                        1);
                }
            }

            if (particleTimer <= 0)
            {
                CloudParticle p1 = new CloudParticle(1, new Vector2(edgeLine + 60, 230 + Cloud.randCloud.Next(40) - 20), 0.999f, this);
                CloudParticle p2 = new CloudParticle(2, new Vector2(edgeLine + 60, 150 + Cloud.randCloud.Next(40) - 20), 0.92f, this);
                CloudParticle p3 = new CloudParticle(3, new Vector2(edgeLine + 60, 80 + Cloud.randCloud.Next(40) - 20), 0.7f, this);
                CloudParticle p4 = new CloudParticle(4, new Vector2(edgeLine + 60, -20 + Cloud.randCloud.Next(40) - 20), 0.6f, this);
                //CloudParticle p5 = new CloudParticle(5, new Vector2(edgeLine + 60, 100 + Cloud.randCloud.Next(200) - 100), 0.91f, this);
                renderables.Add(p1);
                renderables.Add(p2);
                renderables.Add(p3);
                renderables.Add(p4);
                //renderables.Add(p5);
                particleTimer = 12 + Cloud.randCloud.Next(10) - 5;
            }
            else
            {
                particleTimer--;
            }
            foreach (Renderable r in renderables)
            {
                if (r is Actor)
                {
                    (r as Actor).Update();
                }
            }

            foreach (Renderable r in toAdd)
            {
                renderables.Add(r);
            }
            toAdd.Clear();

            foreach (Renderable r in toRemove)
            {
                r.Unload();
                renderables.Remove(r);
            }
            toRemove.Clear();
        }