Přidán indikátor právě aktivní kamery pro oba hráče. Indikátor protivníka se mění podle toho, jestli má zapnutý monitor.
This commit is contained in:
parent
3049417914
commit
4484b127c5
8 changed files with 60 additions and 9 deletions
|
|
@ -14,7 +14,11 @@ public class UIElement {
|
|||
public bool Pressable { get; set; } = false;
|
||||
public bool Visible { get; set; } = true;
|
||||
|
||||
public (Point, Point) Bounds{ get; private set; } // TODO: Change this to support non-rectangular hitboxes
|
||||
public (Point, Point) Bounds{
|
||||
get;
|
||||
private set { field = value; UpdateBounds(); }
|
||||
} // TODO: Change this to support non-rectangular hitboxes
|
||||
|
||||
private (Point, Point) screenSpaceBounds;
|
||||
private List<TextureRegion> textures = new();
|
||||
private int currentTextureId = 0;
|
||||
|
|
@ -32,6 +36,10 @@ public class UIElement {
|
|||
private int pixelScaleMultiplier = 1;
|
||||
private void LoadPixelScaleMultiplier() {
|
||||
pixelScaleMultiplier = (int)(UIManager.GlobalPixelMultiplier * _scaleMultiplier); // TODO: move GlobalPixelMultiplier somewhere where it would make sense
|
||||
UpdateBounds();
|
||||
}
|
||||
|
||||
private void UpdateBounds() {
|
||||
screenSpaceBounds = (Bounds.Item1.MultiplyByScalar(pixelScaleMultiplier), Bounds.Item2.MultiplyByScalar(pixelScaleMultiplier));
|
||||
}
|
||||
|
||||
|
|
@ -85,4 +93,8 @@ public class UIElement {
|
|||
textures[currentTextureId].Draw(spriteBatch, screenSpaceBounds.Item1.ToVector2(), Color.White, 0, Vector2.Zero, pixelScaleMultiplier, SpriteEffects.None, 0);
|
||||
// texture.Draw(spriteBatch, bounds.Item1.ToVector2(), Color.White);
|
||||
}
|
||||
|
||||
public void SetPosition(Point position) {
|
||||
Bounds = (position, position + new Point(textures[0].Width, textures[0].Height));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue