示例#1
0
        public override void PreUpdate()
        {
            if (!branch)
            {
                if (strength > 7)
                {
                    strength--;
                }
                str = strength - 2;
                if (stepsLeft == splitAt)
                {
                    new TileRunnerTree(pos, true).Start();
                    splitAt -= 3 + WorldGen.genRand.Next(6);
                    if (splitAt < 10)
                    {
                        splitAt = 0;
                    }
                }
                else if (stepsLeft == 1)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        TileRunnerTree tr = new TileRunnerTree(pos, true);
                        tr.speed     = Utils.RotatedBy(speed, -1.57f + i * 1.046f);
                        tr.hRange    = new Point16(-3, 3);
                        tr.vRange    = new Point16(-3, 3);
                        tr.steps     = 20;
                        tr.stepsLeft = 12 + WorldGen.genRand.Next(9);
                        tr.splitAt   = 4 + WorldGen.genRand.Next(5);
                        tr.Start();
                    }
                }
            }
            else
            {
                str = 2;
                if (stepsLeft <= 4)
                {
                    str -= 0.35;
                }
                if (stepsLeft == splitAt)
                {
                    TileRunnerTree tr = new TileRunnerTree(pos, true);
                    tr.speed     = Utils.RotatedBy(speed, -0.6f);
                    tr.hRange    = new Point16(-3, 3);
                    tr.vRange    = new Point16(-3, 3);
                    tr.stepsLeft = stepsLeft;
                    tr.Start();

                    speed = Utils.RotatedBy(speed, 0.6f);
                }
            }
        }
示例#2
0
        private void GenerateTwilightTrees(GenerationProgress progress)
        {
            progress.Message = "Twilight Trees";

            int x = twilightX - 250;

            for (int i = 0; i < 2; i++)
            {
                x += 50 + WorldGen.genRand.Next(201);
                int y = twilightY - twilightSize / 4;

                while (!Main.tile[x, y].active())
                {
                    y++;
                }

                TileRunnerTree tr = new TileRunnerTree(new Vector2(x, y));

                if (WorldGen.genRand.NextBool())
                {
                    y       -= 8 + WorldGen.genRand.Next(9);
                    tr.pos.Y = y;

                    TileRunnerCave[] trs = new TileRunnerCave[4];

                    for (int j = 0; j < 4; j++)
                    {
                        int x2 = x - 9 + j * 6;
                        int y2 = y;
                        while (!Main.tile[x2, y2].active())
                        {
                            y2++;
                        }
                        trs[j]           = new TileRunnerCave(new Vector2(x, y), new Vector2(x2, y2), 4, true);
                        trs[j].steps     = 40;
                        trs[j].stepsLeft = 40;
                        trs[j].type      = (ushort)mod.TileType("TFWood");
                        trs[j].addTile   = true;
                    }

                    for (int j = 0; j < 4; j++)
                    {
                        trs[j].Start();
                    }

                    tr.strength = 6.5;
                }
                tr.Start();
            }
        }