feat: refactoring && walls

This commit is contained in:
2024-04-18 16:04:53 +07:00
parent 6333d80fd4
commit 36af656e0d
20 changed files with 202 additions and 93 deletions

View File

@@ -1,9 +1,12 @@
using System.Numerics;
using BakeryGame.Components.Common;
using BakeryGame.Components.Environment;
using BakeryGame.Components.Player;
using BakeryGame.Models;
using Raylib_cs;
using Scellecs.Morpeh;
namespace BakeryGame.Systems;
namespace BakeryGame.Systems.Common;
public class CollisionSystem: ISystem
{

View File

@@ -1,7 +1,9 @@
using System.Numerics;
using Raylib_cs;
using BakeryGame.Components.Common;
using BakeryGame.Components.Player;
using Scellecs.Morpeh;
namespace BakeryGame.Systems.Player;
public class CameraSystem : ISystem
{
private Filter _filter;
@@ -28,21 +30,22 @@ public class CameraSystem : ISystem
ref var camera = ref cameraComponent.Camera;
// Camera target follows player
camera.Target = new Vector2(position.X + 20, position.Y + 20);
//camera.Target.X = position.X;
//camera.Target.Z = position.Z;
// // Camera rotation controls
// if (IsKeyDown(KEY_A)) camera.rotation--;
// else if (IsKeyDown(KEY_S)) camera.rotation++;
// Limit camera rotation to 80 degrees (-40 to 40)
if (camera.Rotation > 40) camera.Rotation = 40;
else if (camera.Rotation < -40) camera.Rotation = -40;
// if (camera.Rotation > 40) camera.Rotation = 40;
// else if (camera.Rotation < -40) camera.Rotation = -40;
// Camera zoom controls
camera.Zoom += Raylib.GetMouseWheelMove() * 0.05f;
if (camera.Zoom > 3.0f) camera.Zoom = 3.0f;
else if (camera.Zoom < 0.1f) camera.Zoom = 0.1f;
// camera.Zoom += Raylib.GetMouseWheelMove() * 0.05f;
//
// if (camera.Zoom > 3.0f) camera.Zoom = 3.0f;
// else if (camera.Zoom < 0.1f) camera.Zoom = 0.1f;
// // Camera reset (zoom and rotation)
// if (IsKeyPressed(KEY_R))

View File

@@ -1,6 +1,9 @@
using BakeryGame.Components.Player;
using Raylib_cs;
using Scellecs.Morpeh;
namespace BakeryGame.Systems.Player;
public sealed class HealthSystem : ISystem
{
private Filter filter;

View File

@@ -1,7 +1,11 @@
using BakeryGame.Components.Common;
using BakeryGame.Components.Player;
using BakeryGame.Models;
using Raylib_cs;
using Scellecs.Morpeh;
namespace BakeryGame.Systems.Player;
public sealed class MovementSystem : ISystem
{
private Filter _filter;

View File

@@ -1,8 +1,11 @@
using System.Numerics;
using BakeryGame.Components.Common;
using BakeryGame.Components.Player;
using Raylib_cs;
using Scellecs.Morpeh;
public class BallRenderSystem : ISystem
namespace BakeryGame.Systems.Player;
public class PlayerRenderSystem : ISystem
{
private Filter _filter;
public World World { get; set; }

View File

@@ -1,6 +1,10 @@
using BakeryGame.Components.Common;
using BakeryGame.Components.Environment;
using Raylib_cs;
using Scellecs.Morpeh;
namespace BakeryGame.Systems.Rendering;
public class BlockRenderSystem : ISystem
{
private Filter _filter;

View File

@@ -1,6 +1,9 @@
using BakeryGame.Components.Player;
using Raylib_cs;
using Scellecs.Morpeh;
namespace BakeryGame.Systems.Rendering;
public class HPRenderSystem : ILateSystem
{
private Filter _filter;