Projekt přejmenován. Neko nastaven na výchozí pozici
This commit is contained in:
parent
1a27dd6fab
commit
ceac37920b
104 changed files with 873 additions and 208 deletions
33
ONDClient/GUI/EnemyUIElement.cs
Normal file
33
ONDClient/GUI/EnemyUIElement.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using MonoGameLibrary.Graphics;
|
||||
|
||||
namespace ONDClient.GUI;
|
||||
|
||||
public class EnemyUIElement : UIElement {
|
||||
private int unlitTexturesId;
|
||||
private bool currentlyLit = true;
|
||||
|
||||
public EnemyUIElement(TextureRegion litTexture, TextureRegion unlitTexture, Point position, int drawPriority = 0) : base([litTexture, unlitTexture], position, drawPriority) {
|
||||
unlitTexturesId = 1;
|
||||
}
|
||||
|
||||
public EnemyUIElement(TextureRegion[] litTextures, TextureRegion[] unlitTextures, Point position, int drawPriority = 0) : base(litTextures.Concat(unlitTextures).ToArray(), position, drawPriority) {
|
||||
unlitTexturesId = litTextures.Length;
|
||||
}
|
||||
|
||||
public void SetTexture(bool lit, int id) {
|
||||
currentlyLit = lit;
|
||||
base.SetTexture(lit ? id : id + unlitTexturesId);
|
||||
}
|
||||
|
||||
public override void SetTexture(int id) {
|
||||
base.SetTexture(currentlyLit ? id : id + unlitTexturesId);
|
||||
}
|
||||
|
||||
public void SetTexture(bool lit) {
|
||||
if(lit == currentlyLit) return;
|
||||
currentlyLit = lit;
|
||||
SetTexture(lit ? currentTextureId - unlitTexturesId : currentTextureId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue