Add attribute system with core stats and gameplay components

This commit is contained in:
2025-10-13 12:10:45 +02:00
commit ce3596efaa
55 changed files with 1161 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using GameCore.ECS;
using GameCore.ECS.Interfaces;
using GameCore.Input;
namespace GameCore.Movement;
public class RotationSystem : ISystem
{
private const float MinPitch = -(float)System.Math.PI / 2f;
private const float MaxPitch = (float)System.Math.PI / 2f;
public void Update(World world, float deltaTime)
{
var entities = world.GetEntitiesWith<InputStateComponent>();
foreach (var entity in entities)
{
var input = world.GetComponent<InputStateComponent>(entity);
var rotation = world.GetComponent<RotationComponent>(entity);
if (input == null || rotation == null)
continue;
rotation.Rotation.Y += input.LookDirection.Y;
rotation.Rotation.X += input.LookDirection.X;
rotation.Rotation.X = System.Math.Clamp(rotation.Rotation.X, MinPitch, MaxPitch);
}
}
}