Esempio n. 1
0
        public static int NewGore(Vector2 Position, Vector2 Velocity, int Type, float Scale = 1f)
        {
            if (Main.netMode == 2 || Main.gamePaused)
            {
                return(500);
            }
            if (Main.rand == null)
            {
                Main.rand = new Random();
            }
            int index1 = 500;

            for (int index2 = 0; index2 < 500; ++index2)
            {
                if (!Main.gore[index2].active)
                {
                    index1 = index2;
                    break;
                }
            }
            if (index1 == 500)
            {
                return(index1);
            }
            Main.gore[index1].numFrames    = (byte)1;
            Main.gore[index1].frame        = (byte)0;
            Main.gore[index1].frameCounter = (byte)0;
            Main.gore[index1].behindTiles  = false;
            Main.gore[index1].light        = 0.0f;
            Main.gore[index1].position     = Position;
            Main.gore[index1].velocity     = Velocity;
            Main.gore[index1].velocity.Y  -= (float)Main.rand.Next(10, 31) * 0.1f;
            Main.gore[index1].velocity.X  += (float)Main.rand.Next(-20, 21) * 0.1f;
            Main.gore[index1].type         = Type;
            Main.gore[index1].active       = true;
            Main.gore[index1].alpha        = 0;
            Main.gore[index1].rotation     = 0.0f;
            Main.gore[index1].scale        = Scale;
            if (!ChildSafety.Disabled && ChildSafety.DangerousGore(Type))
            {
                Main.gore[index1].type      = Main.rand.Next(11, 14);
                Main.gore[index1].scale     = (float)((double)Utils.NextFloat(Main.rand) * 0.5 + 0.5);
                Main.gore[index1].velocity /= 2f;
            }
            if (Gore.goreTime == 0 || Type == 11 || (Type == 12 || Type == 13) || (Type == 16 || Type == 17 || (Type == 61 || Type == 62)) || (Type == 63 || Type == 99 || (Type == 220 || Type == 221) || (Type == 222 || Type == 435 || (Type == 436 || Type == 437))) || Type >= 861 && Type <= 862)
            {
                Main.gore[index1].sticky = false;
            }
            else if (Type >= 375 && Type <= 377)
            {
                Main.gore[index1].sticky = false;
                Main.gore[index1].alpha  = 100;
            }
            else
            {
                Main.gore[index1].sticky   = true;
                Main.gore[index1].timeLeft = Gore.goreTime;
            }
            if (Type >= 706 && Type <= 717)
            {
                Main.gore[index1].numFrames   = (byte)15;
                Main.gore[index1].behindTiles = true;
                Main.gore[index1].timeLeft    = Gore.goreTime * 3;
            }
            if (Type == 16 || Type == 17)
            {
                Main.gore[index1].alpha = 100;
                Main.gore[index1].scale = 0.7f;
                Main.gore[index1].light = 1f;
            }
            if (Type >= 570 && Type <= 572)
            {
                Main.gore[index1].velocity = Velocity;
            }
            if (Type == 860 || Type == 892 || Type == 893)
            {
                Main.gore[index1].velocity = new Vector2((float)(((double)Utils.NextFloat(Main.rand) - 0.5) * 3.0), Utils.NextFloat(Main.rand) * 6.283185f);
            }
            if (Type >= 411 && Type <= 430 && Main.goreLoaded[Type])
            {
                Main.gore[index1].position.X  = Position.X - (float)(Main.goreTexture[Type].Width / 2) * Scale;
                Main.gore[index1].position.Y  = Position.Y - (float)Main.goreTexture[Type].Height * Scale;
                Main.gore[index1].velocity.Y *= (float)Main.rand.Next(90, 150) * 0.01f;
                Main.gore[index1].velocity.X *= (float)Main.rand.Next(40, 90) * 0.01f;
                int num = Main.rand.Next(4) * 5;
                Main.gore[index1].type    += num;
                Main.gore[index1].timeLeft = Main.rand.Next(Gore.goreTime / 2, Gore.goreTime * 2);
            }
            if (Type >= 825 && Type <= 827)
            {
                Main.gore[index1].sticky = false;
                if (Main.goreLoaded[Type])
                {
                    Main.gore[index1].alpha      = 150;
                    Main.gore[index1].velocity   = Velocity;
                    Main.gore[index1].position.X = Position.X - (float)(Main.goreTexture[Type].Width / 2) * Scale;
                    Main.gore[index1].position.Y = Position.Y - (float)((double)Main.goreTexture[Type].Height * (double)Scale / 2.0);
                    Main.gore[index1].timeLeft   = Main.rand.Next(Gore.goreTime / 2, Gore.goreTime + 1);
                }
            }
            return(index1);
        }