Renderování textu, jumpscary, win a lose screen

This commit is contained in:
Perry 2026-03-09 20:05:21 +01:00
parent 9bfe63a166
commit e6128dc9f5
21 changed files with 360 additions and 84 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -8,28 +9,50 @@ using Microsoft.Xna.Framework;
namespace FNAF_Clone;
public class ClientEnemyManager {
public static class ClientEnemyManager {
private static Dictionary<int, ClientEnemy> 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;
}
}