diff --git a/FNAF_Clone/ClientEnemy.cs b/FNAF_Clone/ClientEnemy.cs index 7a2b982..821cb93 100644 --- a/FNAF_Clone/ClientEnemy.cs +++ b/FNAF_Clone/ClientEnemy.cs @@ -6,11 +6,12 @@ using MonoGameLibrary.Graphics; namespace FNAF_Clone; public class ClientEnemy : GlobalEnemy { - public ClientEnemy(int typeId, string name, int id, UIElement sprite, int difficulty, MapTileProjection location) : base(difficulty, id) { + public ClientEnemy(int typeId, string name, int id, UIElement sprite, int difficulty, MapTileProjection location, JumpscareUIElement jumpscareSprite) : base(difficulty, id) { Name = name; TypeId = typeId; Sprite = sprite; Location = location; + JumpscareSprite = jumpscareSprite; } // public TextureRegion Sprite { get; set; } @@ -18,4 +19,6 @@ public class ClientEnemy : GlobalEnemy enemies = new(); private static Point cameraCorner = new Point(64, 64); + private static Action defaultAfterJumpscare = UIManager.ShowDeathScreen; public static void AddEnemy(ClientEnemy enemy) { enemies.Add(enemy.Id, enemy); - UIManager.AddEnemySprite(enemy.Id, enemy.Sprite); + UIManager.AddEnemySprite(enemy.Id, enemy.Sprite, enemy.JumpscareSprite); } public static void AddEnemyByTemplate(EnemyType type, int id, int difficulty, MapTileProjection location) { switch (type){ case EnemyType.LURK: - AddEnemy(new ClientEnemy((int)type, "Lurk", id, new UIElement(UIManager.enemyAtlas[0], cameraCorner), difficulty, location)); + AddEnemy(new ClientEnemy( + (int)type, + "Lurk", + id, + new UIElement(UIManager.EnemyAtlas[0], cameraCorner), + difficulty, + location, + new JumpscareUIElement(UIManager.EnemyAtlas[0], new(0, 0), 3, 2, 2, 0.1f, afterStop:defaultAfterJumpscare))); break; case EnemyType.NEKO: - AddEnemy(new ClientEnemy((int)type, "Neko", id, new UIElement(UIManager.enemyAtlas[1], cameraCorner), difficulty, location)); + AddEnemy(new ClientEnemy( + (int)type, + "Neko", + id, + new UIElement(UIManager.EnemyAtlas[1], cameraCorner), + difficulty, + location, + new JumpscareUIElement(UIManager.EnemyAtlas[1], new(0, -30), 3, 2, 2, 0.1f, afterStop:defaultAfterJumpscare))); break; case EnemyType.SPOT: UIElement element = - new UIElement([UIManager.enemyAtlas[2], UIManager.enemyAtlas[3], UIManager.enemyAtlas[4], UIManager.enemyAtlas[5]], cameraCorner); + new UIElement([UIManager.EnemyAtlas[2], UIManager.EnemyAtlas[3], UIManager.EnemyAtlas[4], UIManager.EnemyAtlas[5]], cameraCorner); element.SetTexture(2); - AddEnemy(new ClientEnemy((int)type, "Spot", id, element, difficulty, location)); + AddEnemy(new ClientEnemy( + (int)type, + "Spot", + id, + element, + difficulty, + location, + new JumpscareUIElement(UIManager.EnemyAtlas[2], new(0, 0), 3, 2, 2, 0.1f, afterStop:defaultAfterJumpscare))); break; } } diff --git a/FNAF_Clone/CommandManager.cs b/FNAF_Clone/CommandManager.cs index dd48958..c21cdbe 100644 --- a/FNAF_Clone/CommandManager.cs +++ b/FNAF_Clone/CommandManager.cs @@ -19,10 +19,14 @@ public class CommandManager { ("Toggle back door", Keys.S, ToggleDoorBack) ]; - private static InputListenerHook toggleCamHook = new(true); + private static InputListenerHook allControlsHook{ get; } = new(true); public static void InitInputListeners() { - Array.ForEach(keybinds, tuple => InputManager.AddListener(tuple.label, tuple.key, () => tuple.action(), InputTiming.PRESS, toggleCamHook)); + Array.ForEach(keybinds, tuple => InputManager.AddListener(tuple.label, tuple.key, () => tuple.action(), InputTiming.PRESS, allControlsHook)); + } + + public static void AllowInput(bool state) { + allControlsHook.Enabled = state; } private static void SendToggleCamera() { diff --git a/FNAF_Clone/Content/Content.mgcb b/FNAF_Clone/Content/Content.mgcb index 362ea42..ea1b793 100644 --- a/FNAF_Clone/Content/Content.mgcb +++ b/FNAF_Clone/Content/Content.mgcb @@ -73,3 +73,10 @@ #begin images/testBlocks-definition.xml /copy:images/testBlocks-definition.xml +#begin ponderosa.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:ponderosa.spritefont + diff --git a/FNAF_Clone/Content/ponde___.ttf b/FNAF_Clone/Content/ponde___.ttf new file mode 100644 index 0000000..89eab2d Binary files /dev/null and b/FNAF_Clone/Content/ponde___.ttf differ diff --git a/FNAF_Clone/Content/font.spritefont b/FNAF_Clone/Content/ponderosa.spritefont similarity index 97% rename from FNAF_Clone/Content/font.spritefont rename to FNAF_Clone/Content/ponderosa.spritefont index bd33ecf..fa8b598 100755 --- a/FNAF_Clone/Content/font.spritefont +++ b/FNAF_Clone/Content/ponderosa.spritefont @@ -11,13 +11,13 @@ with. - Arial + Ponderosa - 12 + 20