public void AddCollider(string name, Rectangle rectangle) { var collider = new SpriteCollider(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); collider.Type = SpriteCollider.ColliderType.Block; _framesList[name].Collider = collider; }
public void AddAttackCollider(string name, List <List <Rectangle> > rectangleFrames, int attackWidth) { for (var i = 0; i < rectangleFrames.Count; i++) { for (var j = 0; j < rectangleFrames[i].Count; j++) { var collider = new SpriteCollider(rectangleFrames[i][j].X, rectangleFrames[i][j].Y, rectangleFrames[i][j].Width, rectangleFrames[i][j].Height); collider.Type = SpriteCollider.ColliderType.Attack; collider.AttackWidth = attackWidth; _framesList[name].Frames[i].AttackColliders.Add(collider); } } }
private Texture2D GetColliderTexture(SpriteCollider collider) { return(collider.Type == SpriteCollider.ColliderType.Block ? _colliderRedTexture : _colliderYellowTexture); }