public SpriteSheet(ITrackedTexture trackedTexture, int spriteWidth, int spriteHeight) { this.TrackedTexture = trackedTexture; this._spriteWidth = spriteWidth; this._spriteHeight = spriteHeight; this._widthInTiles = trackedTexture.CurrentTexture.Width / this._spriteWidth; }
protected SlimeManager(ICoreApi coreApi, string slimeName) { this.CoreApi = coreApi; this.SlimeName = slimeName; this.SlimeLocation = new AssetLocation($@"Characters\Monsters\{this.SlimeName}", ContentSource.GameContent); this.OverriddenTexture = coreApi.Drawing.GetTrackedTexture(this.SlimeLocation); this.OverriddenTexture.Drawing += (sender, info) => this.OverrideDraw(info); }
public ISpriteSheet CreateSimpleSpriteSheet(ITrackedTexture trackedTexture, int spriteWidth, int spriteHeight) { string preferredProperty = trackedTexture.CurrentTexture.Match <Texture2D, string>() .When(this.ObjectSpriteSheet.TrackedTexture.CurrentTexture, nameof(DrawingApi.ObjectSpriteSheet)) .When(this.CraftableSpriteSheet.TrackedTexture.CurrentTexture, nameof(DrawingApi.CraftableSpriteSheet)) .Else((string)null); if (preferredProperty != null) { this._coreApiHelper.Owner.Monitor.Log($"A new sprite sheet was created for a texture which already has a sprite sheet provided. {nameof(IDrawingInfo)}.{preferredProperty} should be used instead.", LogLevel.Warn); } return(new SpriteSheet(trackedTexture, spriteWidth, spriteHeight)); }
public HatSpriteSheet(ITrackedTexture trackedTexture) : base(trackedTexture, 20, 20) { }