60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using System;
|
|
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
using Syntriax.Engine.Core.Abstract;
|
|
|
|
namespace Syntriax.Engine.Core;
|
|
|
|
// TODO Probably gonna have to rethink this
|
|
public class Sprite : ISprite
|
|
{
|
|
public Action<ISprite>? OnTextureChanged { get; set; }
|
|
public Action<ISprite>? OnColorChanged { get; set; }
|
|
public Action<ISprite>? OnDepthChanged { get; set; }
|
|
|
|
private Texture2D _texture = null!;
|
|
private Color _color = Color.White;
|
|
private float _depth = 0f;
|
|
|
|
public Texture2D Texture2D
|
|
{
|
|
get => _texture;
|
|
set
|
|
{
|
|
if (_texture == value)
|
|
return;
|
|
|
|
_texture = value;
|
|
OnTextureChanged?.Invoke(this);
|
|
}
|
|
}
|
|
|
|
public Color Color
|
|
{
|
|
get => _color;
|
|
set
|
|
{
|
|
if (_color == value)
|
|
return;
|
|
|
|
_color = value;
|
|
OnColorChanged?.Invoke(this);
|
|
}
|
|
}
|
|
|
|
public float Depth
|
|
{
|
|
get => _depth;
|
|
set
|
|
{
|
|
if (_depth == value)
|
|
return;
|
|
|
|
_depth = value;
|
|
OnDepthChanged?.Invoke(this);
|
|
}
|
|
}
|
|
}
|