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,5 +1,6 @@
using FNAF_Server.Map;
using GlobalClassLib;
using PacketLib;
namespace FNAF_Server.Enemies;
@ -18,9 +19,12 @@ public abstract class Enemy : GlobalEnemy<MapTile, TileConnector> {
public override void Spawn(MapTile location) {
base.Spawn(location);
Spawned = true;
// EnemyManager.AddEnemy(this);
}
public abstract void Reset();
public abstract void Attack(ServerPlayer player);
public virtual void Attack(ServerPlayer player) {
Server.SendUpdateToAll([GameEvent.ENEMY_ATTACK(Id, player.state.pid)]);
GameLogic.DeclareWinner(Server.OtherPlayer(player));
}
}

View file

@ -41,11 +41,6 @@ public class LurkEnemy : Enemy {
Server.SendUpdateToAll([GameEvent.ENEMY_RESET(Id, Location.Id)]);
}
public override void Attack(ServerPlayer player) {
throw new NotImplementedException();
}
public override void Update() {
base.Update();
@ -58,7 +53,8 @@ public class LurkEnemy : Enemy {
Console.WriteLine($"Enemy {TypeId} ({Name}) moving to {Location.PositionAsString})");
break;
case Pathfinder.Decision.AttackType:
throw new NotImplementedException();
Attack(decision.attackTarget!);
break;
case Pathfinder.Decision.ResetType:
Reset();
break;

View file

@ -33,11 +33,6 @@ public class NekoEnemy : Enemy {
Server.SendUpdateToAll([GameEvent.ENEMY_RESET(Id, Location.Id)]);
}
public override void Attack(ServerPlayer player) {
throw new NotImplementedException();
}
public override void Update() {
base.Update();
@ -50,7 +45,8 @@ public class NekoEnemy : Enemy {
Console.WriteLine($"Enemy {TypeId} ({Name}) moving to {Location.PositionAsString})");
break;
case Pathfinder.Decision.AttackType:
throw new NotImplementedException();
Attack(decision.attackTarget!);
break;
case Pathfinder.Decision.ResetType:
Reset();
break;

View file

@ -30,10 +30,6 @@ public class SpotEnemy : Enemy {
Server.SendUpdateToAll([GameEvent.ENEMY_RESET(Id, Location.Id)]);
}
public override void Attack(ServerPlayer player) {
throw new NotImplementedException();
}
public override void Update() {
if (GameLogic.NSecondUpdate){
if(!movementOpportunity.Running)
@ -65,7 +61,7 @@ public class SpotEnemy : Enemy {
Reset();
}
else if (pathId == path.Length - 1){
Attack(Server.P1);
Attack(Server.P2);
}
}
else if (p2WatchCounter > p1WatchCounter){
@ -74,7 +70,7 @@ public class SpotEnemy : Enemy {
Reset();
}
else if (pathId == 0){
Attack(Server.P2);
Attack(Server.P1);
}
}