public AnimationsHolder load(PlayerTexture playertex) { Sprite[] animationsprites = divideTexture(playertex.sprite, playertex.config.frames_per_line, 4, playertex.config.width, playertex.config.height, playertex.config.pixel_per_unit); AnimationsHolder animations = new AnimationsHolder(); int i = 0; animations.Iddle = animationsprites [i]; i++; animations.DownAnimation = loadArray(animations.DownAnimation, animationsprites, playertex.config.frames_per_line, i); i = i + (playertex.config.frames_per_line - 2); animations.IddleDown = animationsprites [i]; i = i + 2; animations.UpAnimation = loadArray(animations.UpAnimation, animationsprites, playertex.config.frames_per_line, i); i = i + (playertex.config.frames_per_line - 2); animations.IddleUp = animationsprites [i]; i = i + 2; animations.LeftAnimation = loadArray(animations.LeftAnimation, animationsprites, playertex.config.frames_per_line, i); i = i + (playertex.config.frames_per_line - 2); animations.IddleLeft = animationsprites [i]; i = i + 2; animations.RightAnimation = loadArray(animations.RightAnimation, animationsprites, playertex.config.frames_per_line, i); i = i + (playertex.config.frames_per_line - 2); animations.IddleRight = animationsprites [i]; return(animations); }
public PlayerTile(Vector2 location, PlayerTexture tex) : base(location, Constants.playerColor) { this.tex = tex; vertcies = new[] { new Vector2(location.X * Constants.playerSize, location.Y * Constants.playerSize), new Vector2((location.X + 1) * Constants.playerSize, location.Y * Constants.playerSize), new Vector2((location.X + 1) * Constants.playerSize, (location.Y + 1) * Constants.playerSize), new Vector2(location.X * Constants.playerSize, (location.Y + 1) * Constants.playerSize) }; }
/// <summary> /// Gets a <see cref="Bitmap" /> texture mapped to the specified skin variant and texture ID. /// </summary> /// <param name="skinVariant">The skin variant.</param> /// <param name="textureId">The texture ID.</param> /// <returns>The corresponding <see cref="Bitmap" />.</returns> public Bitmap GetTexture(int skinVariant, PlayerTexture textureId) { return(_textures[skinVariant, (int)textureId]?.Clone() as Bitmap); }