public SimpleOverlay(string textureName, string shaderName = "Default", EffectPriority priority = EffectPriority.VeryLow, RenderLayers layer = RenderLayers.All) : base(priority, layer) { this._texture = TextureManager.AsyncLoad(textureName == null ? "" : textureName); this._shader = new ScreenShaderData(Main.ScreenShaderRef, shaderName); }
public SimpleOverlay(string textureName, ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow, RenderLayers layer = RenderLayers.All) : base(priority, layer) { this._texture = TextureManager.AsyncLoad(textureName == null ? "" : textureName); this._shader = shader; }
public override void UpdateBiomeVisuals() { Azercadmium.screenShaderColor = new Color[] { Color.Lerp(Color.OrangeRed, Color.Orange, (float)(Math.Sin(Main.GameUpdateCount * 0.001f) + 1) * 0.5f), }; bool honeyCrispAlive = false; float emberGladesBossEffectAmount = 0f; List <int> importantNPCs = new List <int>(); //int honeyCrisp = ModContent.NPCType<EmberHoneycrisp>(); //int heletron = ModContent.NPCType<Heletron>(); /*for (int i = 0; i < Main.npc.Length; i++) * { * NPC npc = Main.npc[i]; * if (npc.active) * { * if (npc.type == honeyCrisp || npc.type == heletron) * { * honeyCrispAlive = true; * float effectAmount = MathHelper.Clamp((2000 - Math.Abs(Vector2.Distance(player.Center, npc.Center))) * 0.001f, 0f, 1f); * emberGladesBossEffectAmount = effectAmount > emberGladesBossEffectAmount ? effectAmount : emberGladesBossEffectAmount; * importantNPCs.Add(npc.whoAmI); * } * } * }*/ float countMult = 0.0125f; float lerpAmount = 0.022f; float shaderMax = honeyCrispAlive ? MathHelper.Clamp((float)(Math.Sin(Main.GameUpdateCount * countMult) + 1) * 0.125f, 0.125f, 0.25f) : 0.1f; float opacityLerp2 = MathHelper.Clamp((Azercadmium.EmberGladesTileCount - 100) / 200f, 0f, 1f) + emberGladesBossEffectAmount; Azercadmium.screenShaderFade[0] = MathHelper.Lerp(Azercadmium.screenShaderFade[0], MathHelper.Clamp(opacityLerp2, 0, shaderMax), lerpAmount); if (Azercadmium.screenShaderFade[0] > 0) { ScreenShaderData shader = Filters.Scene["TintScreen"].GetShader(); shader.UseOpacity(Azercadmium.screenShaderFade[0]); shader.UseColor(Azercadmium.screenShaderColor[0]); if (!Filters.Scene["TintScreen"].Active) { Filters.Scene.Activate("TintScreen"); } } else { Filters.Scene.Deactivate("TintScreen"); } if (emberGladesBossEffectAmount > 0) { int randNum = (int)(105 - emberGladesBossEffectAmount * 100f); Point dustPoint = (player.Center - new Vector2(1000, 1000)).ToPoint(); Rectangle emberRectangle = new Rectangle(dustPoint.X, dustPoint.Y, 2000, 2000); if (WorldGen.genRand.NextBool(randNum)) { Dust.NewDust(new Vector2(WorldGen.genRand.Next(emberRectangle.X, emberRectangle.X + emberRectangle.Width), WorldGen.genRand.Next(emberRectangle.Y, emberRectangle.Y + emberRectangle.Height)), 2, 2, DustID.FlameBurst); } if (WorldGen.genRand.NextBool(randNum)) { Dust.NewDust(new Vector2(WorldGen.genRand.Next(emberRectangle.X, emberRectangle.X + emberRectangle.Width), WorldGen.genRand.Next(emberRectangle.Y, emberRectangle.Y + emberRectangle.Height)), 2, 2, DustID.FlameBurst); } } }
public static ScreenShaderData ApplyTime(this ScreenShaderData shader, float time) { if (shader.Shader.HasParameter("uTime")) { shader.Shader.Parameters["uTime"].SetValue(time); } return(shader); }
public static ScreenShaderData ApplyColor(this ScreenShaderData shader, Color color) { if (shader.Shader.HasParameter("uColor")) { shader.Shader.Parameters["uColor"].SetValue(color.ToVector3()); } return(shader); }
public static ScreenShaderData ApplyIntensity(this ScreenShaderData shader, float intensity) { if (shader.Shader.HasParameter("uIntensity")) { shader.Shader.Parameters["uIntensity"].SetValue(intensity); } return(shader); }
public SimpleOverlay( string textureName, string shaderName = "Default", EffectPriority priority = EffectPriority.VeryLow, RenderLayers layer = RenderLayers.All) : base(priority, layer) { this._texture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>(textureName == null ? "" : textureName, (AssetRequestMode)1); this._shader = new ScreenShaderData(Main.ScreenShaderRef, shaderName); }
public void HandleOurShader() { if (!OurShaderActive) { Filters.Scene["OurScreenShader"].GetShader().Shader.Parameters["active"].SetValue(false); Filters.Scene["OurScreenShader"].Deactivate(); return; } if (!Filters.Scene["OurScreenShader"].IsActive()) { Filters.Scene.Activate("OurScreenShader"); } ScreenShaderData ourScreenShaderData = Filters.Scene["OurScreenShader"].GetShader(); ourScreenShaderData.UseIntensity(OurShaderIntensity); string internalName = SelectedReference.Replace(" ", string.Empty).Replace("'", string.Empty).Replace("!", string.Empty); ourScreenShaderData.UseImage(ModContent.GetTexture("CommunistTerraria/Textures/Background/" + internalName)); ourScreenShaderData.Shader.Parameters["active"].SetValue(true); }
public Filter(ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow) { this._shader = shader; this._priority = priority; }
public SimpleOverlay(string textureName, string shaderName = "Default", EffectPriority priority = EffectPriority.VeryLow) : base(priority) { _texture = TextureManager.Retrieve(textureName == null ? "" : textureName); _shader = new ScreenShaderData(Main.screenShader, shaderName); }
public SimpleOverlay(string textureName, ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow) : base(priority) { _texture = TextureManager.Retrieve(textureName == null ? "" : textureName); _shader = shader; }
public override void AI() { Player P = Main.player[npc.target]; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active || !Main.dayTime) { npc.TargetClosest(false); P = Main.player[npc.target]; if (!P.active || P.dead || !Main.dayTime) { float speed = ((-10f)); npc.velocity = new Vector2(npc.velocity.X, npc.velocity.Y + speed); npc.active = false; } } else { if (Main.expertMode) { if (npc.life < npc.lifeMax * 0.20 && npc.ai[3] == 0) { npc.ai[3] = 1; NPC.SpawnOnPlayer(P.whoAmI, mod.NPCType("CirnoIceFairy")); NPC.SpawnOnPlayer(P.whoAmI, mod.NPCType("CirnoIceFairy2")); } npc.defense = 20 + (NPC.CountNPCS(mod.NPCType("CirnoIceFairy")) * 50) + (NPC.CountNPCS(mod.NPCType("CirnoIceFairy2")) * 50); } bool snow = P.ZoneSnow; npc.dontTakeDamage = (!snow); npc.netUpdate = true; npc.timeLeft = 99999; bobbing = bobbing + 1; npc.spriteDirection = -npc.direction; aicounter = aicounter + 1; Vector2 dist = P.Center - npc.Center; if (card > 0) { if (nightmaremode) { if (nightmareprog < card * 400) { nightmareprog += 1; } /*if (nightmareprog == 1) * { * * * }*/ if (SGAWorld.CirnoBlizzard < card * 100 && nightmareprog % 3 == 0) { SGAWorld.CirnoBlizzard += 1; } ScreenShaderData shad = Filters.Scene["SGAmod:CirnoBlizzard"].GetShader(); shad.UseColor(Color.Lerp(Color.Blue, Color.Turquoise, 0.5f + (float)Math.Sin(Main.GlobalTime))); Main.raining = true; Main.windSpeed = MathHelper.Clamp(Main.windSpeed + Math.Sign((P.Center.X - npc.Center.X)) * (-0.002f / 3f), -0.4f, 0.4f); Main.maxRaining = Math.Min(Main.maxRaining + 0.002f, 1f); Main.rainTime = 5; Main.UseStormEffects = true; nightmareprog = Math.Min(nightmareprog, 2000); if (nightmareprog > 100) { for (int i = 0; i < Main.maxPlayers; i += 1) { if (Main.player[i].active && !Main.player[i].dead) { Main.player[i].AddBuff(BuffID.WindPushed, 2); } } } if (nightmareprog > 500) { ScreenObstruction.screenObstruction = Math.Min((nightmareprog - 500) / 600f, 0.5f); for (int i = 0; i < Main.maxPlayers; i += 1) { if (Main.player[i].active && !Main.player[i].dead) { //if (card>3) //Main.player[i].AddBuff(BuffID.Obstructed, (int)((Main.maxRaining-0.5f)*120f)); Main.player[i].AddBuff(BuffID.Darkness, (int)((Main.maxRaining - 0.5f) * 60f)); } } } } } if (aistate == 3) { if (aicounter > 49) { aistate = 0; } } if (aistate == 2) { spellcard(card, aicounter, P); float floater = (float)(Math.Sin(bobbing / 14f) * 4f); npc.direction = -1; if (dist.X > 0) { npc.direction = 1; } npc.velocity = new Vector2(((P.Center.X - ((npc.Center.X))) / 150), ((P.Center.Y - ((npc.Center.Y + 120))) / 110) + floater); if (npc.life < npc.lifeMax * damagetospellcard) { aistate = 0; aicounter = 0; framevar = 0; stateaction = 0; frameid = 0; attacktype = 0; damagetospellcard = damagetospellcard - 0.15f; } } if (aistate == 3) { if (aicounter > 15) { int dustType = 113; //Main.rand.Next(139, 143); int dustIndex = Dust.NewDust(npc.Center + new Vector2(-16, -16), 32, 32, dustType); Dust dust = Main.dust[dustIndex]; dust.velocity.X = dust.velocity.X - npc.velocity.X; dust.velocity.Y = dust.velocity.Y - npc.velocity.Y; dust.scale *= 3f + Main.rand.Next(-30, 31) * 0.01f; dust.fadeIn = 0f; dust.noGravity = true; //dust.color=Main.hslToRgb((float)(npc.ai[0]/300)%1, 1f, 0.9f); npc.velocity = npc.velocity + (npc.DirectionTo(P.Center) * 0.7f); if (npc.velocity.Length() > 14) { npc.velocity.Normalize(); npc.velocity = npc.velocity * 14; } if (npc.velocity.X > 0) { npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); npc.direction = 1; } else { npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); npc.direction = -1; } if (dist.Length() > 180) { aicounter = aicounter - 1; } if (bobbing > 220) { float aimer = Main.rand.Next(-1000, 1000); if (bobbing % 25 == 0) { List <Projectile> bolts = Idglib.Shattershots(new Vector2(npc.Center.X, npc.Center.Y), P.position, new Vector2(P.width, P.height), ProjectileID.IceBolt, 20, (float)Main.rand.Next(60, 80) / 5, 25, 3, true, (float)(aimer / 8000), false, 60); } } if (aicounter > 220) { aistate = 0; aicounter = 40; framevar = 0; stateaction = 0; frameid = 0; attacktype = 0; } } else { bobbing = 0; npc.velocity = npc.velocity * 0.9f; } } else { npc.rotation = (float)0f; } if (aistate == 0) { if (npc.life < npc.lifeMax * damagetospellcard) { aistate = 2; aicounter = 0; stateaction = 0; attacktype = 0; card = card + 1; damagetospellcard = damagetospellcard - 0.20f; } if (aicounter > 90 && Main.rand.Next(-((int)15000 + npc.life / 2), (int)dist.Length()) > 100) { aicounter = 0; aistate = 3; framevar = 0; stateaction = 2; frameid = 14; } if (aicounter > 140 || (aicounter > 100 && card == 3)) { //if (!Collision.CheckAABBvLineCollision(P.Center-new Vector2(8,8), new Vector2(16,16), npc.Center+new Vector2(npc.Center.X+(npc.direction*64),0), P.Center, 10, ref point)) // aicounter = 0; aistate = 1; framevar = 0; stateaction = 1; frameid = 6; attacktype = (int)Main.rand.Next(0, 2); } //} float floater = (float)(Math.Sin(bobbing / 17f) * 9f); if (npc.Center.X < P.Center.X) { npc.direction = 1; npc.velocity = new Vector2(2, ((P.Center.Y - npc.Center.Y) / 12) + floater); } else { npc.velocity = new Vector2(-2, ((P.Center.Y - npc.Center.Y) / 12) + floater); npc.direction = -1; } npc.velocity.Normalize(); npc.velocity = npc.velocity * 2; } if (aistate == 1 || aistate == 10) { npc.velocity = new Vector2(0, 0); if (aistate == 10) { if (aicounter < 5) { mixup = Main.rand.Next(0, 3); } if (aicounter > 19 && aicounter < 76 && aicounter % 3 == 0 && mixup == 0) { float aimer = Main.rand.Next(0, 0); Idglib.Shattershots(new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y), P.position, new Vector2(P.width, P.height), 348, 10, (float)26, 0, 1, true, (float)(aimer / 8000), false, Main.rand.Next(100, 120)); } if (mixup == 2) { if (aicounter == 19) { for (int num315 = 0; num315 < 60; num315 = num315 + 1) { int dust = Dust.NewDust(new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y), 0, 0, 113, Main.rand.Next(-5, 5), Main.rand.Next(-5, 5), 25, Main.hslToRgb(0.6f, 0.9f, 1f), 3f); Main.dust[dust].noGravity = true; //Main.dust[dust].velocity *= 1.8f; //Main.dust[dust].velocity.Y -= 0.5f; Main.playerDrawDust.Add(dust); } } if (aicounter > 9 && aicounter < 66 && aicounter % 2 == 0) { float aimer = Main.rand.Next(0, 0); Idglib.Shattershots(P.position + new Vector2(Main.rand.Next(-100, 100), P.Center.Y + 200), P.position + new Vector2(Main.rand.Next(-100, 100), P.Center.Y - 500), new Vector2(P.width, P.height), ProjectileID.IcewaterSpit, 20, (float)23, 0, 1, true, 0, false, Main.rand.Next(270, 370)); } } if (aicounter == 19 && mixup == 1) { List <Projectile> itz = Idglib.Shattershots(npc.Center - new Vector2(0, 30), npc.Center - new Vector2(-npc.direction * 20, 30), new Vector2(0, 0), mod.ProjectileType("SnowCloud"), 40, 5f, 0, 1, true, 0, false, 500); itz[0].velocity = itz[0].velocity + new Vector2(0, -6); } } if (aistate == 1) { if (card == 0 || card > 1) { if (attacktype == 0) { if (aicounter == 20) { if (Main.netMode != 1) { int proj2 = Projectile.NewProjectile(0, npc.Center.Y, P.Center.X, P.Center.Y, 464, 40, 4, 0); Main.projectile[proj2].friendly = false; Main.projectile[proj2].hostile = true; //Main.projectile[proj2].timeLeft=70; Main.projectile[proj2].position = new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y); } } } if (attacktype == 1) { if (aicounter > 19 && aicounter < 46 && aicounter % 3 == 0) { //Shattershots(new Vector2(npc.Center.X+(npc.direction*48),npc.Center.Y),P.position,new Vector2(P.width,P.height),118,15,Main.rand.Next(6,18),0,1,true,Main.rand.Next(-4,4)); float aimer = Main.rand.Next(-1000, 1000); List <Projectile> bolts = Idglib.Shattershots(new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y), P.position, new Vector2(P.width, P.height), mod.ProjectileType("CirnoBolt"), 80, (float)Main.rand.Next(60, 80) / 10f, 0, 1, true, (float)(aimer / 8000), false, 200); CirnoBolt Cbolt = bolts[0].modProjectile as CirnoBolt; Cbolt.homing = 0.04f; bolts[0].netUpdate = true; //Shattershots(npc.position,P.position,new Vector2(P.width,P.height),83,20,12,40,2,true,0); } } } if (card == 1 || card > 1) { if (attacktype == 0) { if (aicounter == 20) { Idglib.Shattershots(new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y), P.position, new Vector2(P.width, P.height), ProjectileID.EnchantedBeam, 30, (float)Main.rand.Next(60, 80) / 4, 30, 2, true, 0, false, 150); } } if (attacktype == 1) { if (aicounter > 19 && aicounter < 79 && aicounter % 3 == 0) { //Shattershots(new Vector2(npc.Center.X+(npc.direction*48),npc.Center.Y),P.position,new Vector2(P.width,P.height),Projectile.IceBolt,15,Main.rand.Next(6,18),0,1,true,Main.rand.Next(-4,4)); float aimer = Main.rand.Next(-1000, 1000); Idglib.Shattershots(new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y), P.position, new Vector2(P.width, P.height), 174, 25, (float)Main.rand.Next(60, 80) / 3, 0, 1, true, (float)(aimer / 8000) + (float)(aicounter - 50), true, 200); Idglib.Shattershots(new Vector2(npc.Center.X + (npc.direction * 48), npc.Center.Y), P.position, new Vector2(P.width, P.height), 174, 25, (float)Main.rand.Next(60, 80) / 3, 0, 1, true, ((float)(aimer / 8000) + (float)(aicounter - 50)) + 90, true, 200); //Shattershots(npc.position,P.position,new Vector2(P.width,P.height),83,20,12,40,2,true,0); } } } } if (aicounter > 80) { frameid = 12; } if (aicounter == 90 || (aicounter == 40 && card == 3 && aistate != 10)) { if (aistate == 10) { aistate = 2; } else { aistate = 0; } framevar = 0; stateaction = 0; frameid = 0; aicounter = 0; } } } }
public SimpleOverlay(string textureName, ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow, RenderLayers layer = RenderLayers.All) : base(priority, layer) { _texture = Main.Assets.Request <Texture2D>((textureName == null) ? "" : textureName, Main.content, (AssetRequestMode)1); _shader = shader; }
public static ScreenShaderData ApplyOpacity(this ScreenShaderData shader, float opacity) { shader.Shader.Parameters["uOpacity"].SetValue(opacity); return(shader); }