コード例 #1
0
        public override void draw(SpriteBatch spriteBatch, int xNonTile, int yNonTile, float layerDepth, float alpha = 1f)
        {
            if (Game1.eventUp && Game1.CurrentEvent.isTileWalkedOn(xNonTile / 64, yNonTile / 64))
            {
                return;
            }
            if ((int)(this.ParentSheetIndex) != 590 && (int)(this.Fragility) != 2)
            {
                spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile + 32), (float)(yNonTile + 51 + 4))), new Microsoft.Xna.Framework.Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0.0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, layerDepth - 1E-06f);
            }
            SpriteBatch spriteBatch1      = spriteBatch;
            Texture2D   objectSpriteSheet = Game1.objectSpriteSheet;
            Vector2     local             = Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(xNonTile + 32 + (this.shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0)), (float)(yNonTile + 32 + (this.shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0))));

            Microsoft.Xna.Framework.Rectangle?sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(GameLocation.getSourceRectForObject(this.ParentSheetIndex));
            Color   color  = Color.White * alpha;
            double  num1   = 0.0;
            Vector2 origin = new Vector2(8f, 8f);
            Vector2 scale  = this.scale;
            double  num2   = (double)this.scale.Y > 1.0 ? (double)this.getScale().Y : 4.0;
            int     num3   = (bool)(this.flipped) ? 1 : 0;
            double  num4   = (double)layerDepth;

            spriteBatch1.Draw(TextureSheet.getTexture(), local, sourceRectangle, color, (float)num1, origin, (float)num2, (SpriteEffects)num3, (float)num4);
        }
コード例 #2
0
        public MultiTileComponent(int which, String name, String description, Animations.AnimationManager animationManager)
        {
            this.name                     = name;
            this.displayName              = name;
            this.description              = description;
            this.animationManager         = animationManager;
            this.TextureSheet             = animationManager.getExtendedTexture();
            this.defaultBoundingBox       = new Rectangle(0, 0, 16, 16);
            this.boundingBox.Value        = new Rectangle((int)0 * Game1.tileSize, (int)0 * Game1.tileSize, 1 * Game1.tileSize, 1 * Game1.tileSize);
            this.defaultSourceRect.Width  = 16;
            this.defaultSourceRect.Height = 16;
            this.sourceRect               = new Rectangle(which * 16 % TextureSheet.getTexture().Width, which * 16 / TextureSheet.getTexture().Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
            this.defaultSourceRect        = this.sourceRect;
            this.serializationName        = this.GetType().ToString();
            this.ParentSheetIndex         = which;

            this.NetFields.AddField(new NetCode.NetTexture2DExtended(this.getExtendedTexture()));

            this.InitializeBasics(0, Vector2.Zero);
        }