Ejemplo n.º 1
0
        public void MakeNew()
        {
            IsLoaded = false;

            MyTileSetInfo = new TileSetInfo();

            CustomStartEnd = false;

            Pillars    = new BlockGroup();
            Platforms  = new BlockGroup();
            Ceilings   = new BlockGroup();
            StartBlock = new BlockGroup();
            EndBlock   = new BlockGroup();

            FixedWidths       = false;
            ProvidesTemplates = false;

            StandInType = TileSets.None;

            ObstacleUpgrades = new List <Upgrade>();

            FlexibleHeight = false;
            HasCeiling     = false;

            Name   = "";
            MyPath = "";
            Guid   = 0;

            Tint = new Vector4(1);

            ScreenshotString = "";

            MyBackgroundType = BackgroundType.Random;

            CoinScoreColor = new Color(220, 255, 255);
        }
Ejemplo n.º 2
0
        public PieceQuad GetPieceTemplate(BlockBase block, Rand rnd, BlockGroup group)
        {
            if (group == null)
            {
                if (block.BlockCore.Ceiling)
                {
                    group = Ceilings;
                }
                else if (block.BlockCore.EndPiece)
                {
                    group = EndBlock;
                }
                else if (block.BlockCore.StartPiece)
                {
                    group = StartBlock;
                }
                else
                {
                    if (block.Box.TopOnly && block.BlockCore.UseTopOnlyTexture)
                    {
                        group = Platforms;
                        if (group.Widths.Length == 0)
                        {
                            group = Pillars;
                        }
                    }
                    else
                    {
                        group = Pillars;
                    }
                }
            }

            // Get the block's info
            var box  = block.Box;
            var core = block.BlockCore;

            // Get the width of the block (accounting for possible rotations for Meatboy levels)
            float width = 0;

            if (core.MyOrientation == PieceQuad.Orientation.RotateRight ||
                core.MyOrientation == PieceQuad.Orientation.RotateLeft)
            {
                width = box.Current.Size.Y;
            }
            else
            {
                width = box.Current.Size.X;
            }

            int int_width = group.SnapWidthUp(width - .1f);

            // Get the piecequad template
            try
            {
                return(group.Choose(int_width, rnd));
            }
            catch
            {
                Tools.Log(string.Format("Could not find {0} of width {1} for tileset {2}",
                                        "block", width, Name));
                return(null);
            }
        }