Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawNPCDirect_Deerclops()

static void Terraria.Main.DrawNPCDirect_Deerclops ( SpriteBatch mySpriteBatch,
NPC rCurrentNPC,
ref Vector2 screenPos,
int typeCache,
ref Microsoft::Xna::Framework::Color npcColor,
ref Vector2 halfSize,
SpriteEffects npcSpriteEffect )
inlinestaticprivate

Definition at line 24672 of file Main.cs.

24673 {
24674 Texture2D value = TextureAssets.Npc[typeCache].Value;
24675 Vector2 vector = rCurrentNPC.Bottom - screenPos;
24676 Microsoft.Xna.Framework.Rectangle rectangle = value.Frame(5, 5, rCurrentNPC.frame.Y / 5, rCurrentNPC.frame.Y % 5, 2, 2);
24677 Vector2 origin = rectangle.Size() * new Vector2(0.5f, 1f);
24678 origin.Y -= 4f;
24679 int num = 106;
24680 if (rCurrentNPC.spriteDirection == 1)
24681 {
24682 origin.X = num;
24683 }
24684 else
24685 {
24686 origin.X = rectangle.Width - num;
24687 }
24689 float amount = 0f;
24690 float amount2 = 0f;
24691 int num2 = 0;
24692 float num3 = 0f;
24693 float num4 = 0f;
24694 float num5 = 10f;
24696 if (rCurrentNPC.localAI[3] > 0f)
24697 {
24698 float num6 = rCurrentNPC.localAI[3] / 36f;
24699 num2 = 2;
24700 num3 = num6 * num6;
24701 num4 = 20f;
24702 value2 = new Microsoft.Xna.Framework.Color(80, 0, 0, 255) * 0.5f;
24703 amount2 = 1f;
24705 }
24706 for (int i = 0; i < num2; i++)
24707 {
24710 value3 = rCurrentNPC.GetAlpha(value3);
24712 value3 *= 1f - num3 * 0.5f;
24714 mySpriteBatch.Draw(value, vector2 + new Vector2(0f, 1f).RotatedBy((float)i * ((float)Math.PI * 2f) / (float)num2 + GlobalTimeWrappedHourly * num5) * num3 * num4, rectangle, value3, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24715 }
24718 float num7 = 0f;
24719 if (rCurrentNPC.localAI[3] > 0f)
24720 {
24721 float amount3 = Utils.Remap(rCurrentNPC.localAI[3], 0f, 20f, 0f, 1f);
24723 }
24724 if (rCurrentNPC.ai[0] == 7f || rCurrentNPC.ai[0] == 8f)
24725 {
24726 num7 = Utils.Remap(rCurrentNPC.ai[1], 20f, 60f, 0f, 2f);
24727 if (num7 > 1f)
24728 {
24729 num7 = 2f - num7;
24730 }
24732 color2 *= 1f - num7;
24733 float num8 = 5f;
24734 for (int j = 0; (float)j < num8; j++)
24735 {
24737 float num9 = num7 * num7;
24738 float num10 = 80f * num9;
24739 float num11 = 80f * num9 + (float)(30 * j) * num9;
24740 Vector2 vector4 = Vector2.UnitX.RotatedBy((float)j * ((float)Math.PI * 2f) / num8 + GlobalTimeWrappedHourly * 6f) * num10;
24741 Vector2 vector5 = Vector2.UnitX.RotatedBy((float)j * ((float)Math.PI * 2f) / num8 + GlobalTimeWrappedHourly * 3f * ((float)j * 0.5f)) * num11;
24742 mySpriteBatch.Draw(value, vector3 + vector4 + vector5, rectangle, color2 * 0.5f, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24743 }
24744 }
24745 mySpriteBatch.Draw(value, vector, rectangle, color2, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24746 if (rCurrentNPC.localAI[3] > 0f)
24747 {
24748 Texture2D value5 = TextureAssets.Extra[245].Value;
24749 float num12 = Utils.Remap(rCurrentNPC.localAI[3], 0f, 20f, 0f, 1f);
24750 Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(255, 30, 30, 66) * rCurrentNPC.Opacity * num12 * 0.25f * (1f - num7);
24751 for (int k = 0; k < num2; k++)
24752 {
24754 mySpriteBatch.Draw(value5, vector6 + new Vector2(0f, 1f).RotatedBy((float)k * ((float)Math.PI * 2f) / (float)num2 + GlobalTimeWrappedHourly * num5) * num3 * 4f, rectangle, color3, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24755 }
24756 }
24757 }
const double PI
Definition Math.cs:16
static Asset< Texture2D >[] Npc
static Asset< Texture2D >[] Extra
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491

References Terraria.GameContent.TextureAssets.Extra, Terraria.Main.GlobalTimeWrappedHourly, System.Text.RegularExpressions.i, Microsoft.Xna.Framework.Color.Lerp(), Terraria.GameContent.TextureAssets.Npc, System.Math.PI, Terraria.Utils.Remap(), Microsoft.Xna.Framework.Color.Transparent, Microsoft.Xna.Framework.Vector2.UnitX, System.value, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Color.White.

Referenced by Terraria.Main.DrawNPCDirect().