Všechna monstra, dynamický targeting. Bugfixy u monster.

This commit is contained in:
Perry 2026-03-17 20:14:29 +01:00
parent 55fd052072
commit 4fdff0a0cc
18 changed files with 345 additions and 43 deletions

View file

@ -6,7 +6,7 @@ using MonoGameLibrary.Graphics;
namespace FNAF_Clone;
public class ClientEnemy : GlobalEnemy<MapTileProjection, TileConnectorProjection> {
public ClientEnemy(int typeId, string name, int id, EnemyUIElement sprite, int difficulty, MapTileProjection location, JumpscareUIElement jumpscareSprite) : base(difficulty, id) {
public ClientEnemy(int typeId, string name, int id, EnemyUIElement sprite, int difficulty, MapTileProjection location, JumpscareUIElement jumpscareSprite) : base(id) {
Name = name;
TypeId = typeId;
Sprite = sprite;

View file

@ -58,6 +58,28 @@ public static class ClientEnemyManager {
new JumpscareUIElement(UIManager.EnemyAtlas["spot-awake-lit"], new(0, 0), 3, 2, 2, 0.1f, afterStop:defaultAfterJumpscare)
));
break;
case EnemyType.DASH:
AddEnemy(new ClientEnemy(
(int)type,
"Dash",
id,
new EnemyUIElement(UIManager.EnemyAtlas["dash-lit"], UIManager.EnemyAtlas["dash-unlit"], cameraCorner, 3),
difficulty,
location,
new JumpscareUIElement(UIManager.EnemyAtlas["dash-lit"], new(0, 0), 3, 2, 2, 0.1f, afterStop:defaultAfterJumpscare)
));
break;
case EnemyType.MARE:
AddEnemy(new ClientEnemy(
(int)type,
"Mare",
id,
new EnemyUIElement(UIManager.EnemyAtlas["mare-lit"], UIManager.EnemyAtlas["mare-unlit"], cameraCorner),
difficulty,
location,
new JumpscareUIElement(UIManager.EnemyAtlas["mare-lit"], new(0, 0), 3, 2, 2, 0.1f, afterStop:defaultAfterJumpscare)
));
break;
}
}

View file

@ -10,7 +10,8 @@
<Region name="spot-awake-unlit" x="240" y="480" width="240" height="240"/>
<Region name="spot-asleep-lit" x="0" y="720" width="240" height="240"/>
<Region name="spot-asleep-unlit" x="240" y="720" width="240" height="240"/>
<Region name="dash" x="0" y="960" width="240" height="240"/>
<Region name="dash-lit" x="0" y="960" width="240" height="240"/>\
<Region name="dash-unlit" x="240" y="960" width="240" height="240"/>
<Region name="mare-lit" x="0" y="1200" width="240" height="240"/>
<Region name="mare-unlit" x="240" y="1200" width="240" height="240"/>
</Regions>

View file

@ -30,7 +30,10 @@ public class MenuInputField : UIElement {
textBoxElement.Text = defaultValue;
}
public string Text => textBoxElement.Text;
public string Text{
get => textBoxElement.Text;
set => textBoxElement.Text = value;
}
public override void Draw(SpriteBatch spriteBatch) {
labelElement.Draw(spriteBatch);

View file

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using FNAF_Clone.Map;
using GlobalClassLib;
using Microsoft.Xna.Framework;
@ -121,7 +119,6 @@ public class UIManager {
menuScreen.AddElement("host-button",
new TextUIElement(new(connectButton.Bounds.Item1.X, connectButton.Bounds.Item2.Y + 30), PixelMonoFont) {Text = "HOST"});
loadingScreen.AddElement("loading-text", new LoadingUIElement(new(320, 180), PixelMonoFont, field.Text));
}
@ -129,6 +126,8 @@ public class UIManager {
public static void DisplayMainMenu() {
Screen.SetScreen(ScreenTypes.MENU);
CommandManager.AllowGameControls(false);
// if(Client.Player.username != null)
// ((MenuInputField)menuScreen["username-field"]).Text = Client.Player.username;
}
@ -255,7 +254,7 @@ public class UIManager {
public static void UpdateCameras(int[] camIds) {
foreach (var id in camIds){
MapTileProjection tile = ClientMapManager.Get(id);
if(tile.Owner == null) continue;
if(tile.Owner == null || tile.Id == Client.Player.state.officeTileId || tile.Id == Client.Opponent.state.officeTileId) continue;
lightIndicators[id].Visible = tile.Lit;
}
@ -283,6 +282,7 @@ public class UIManager {
Screen.SetScreen(ScreenTypes.OFFICE);
enemy.JumpscareSprite.Play();
timerElement.Stop();
CommandManager.AllowGameControls(false);
// UIElement jumpscareElement = enemy.Sprite.Clone();
// jumpscareElement.ScaleMultiplier = 2;
// jumpscareElement.SetPosition(new Point(0, 0));