using Engine.Input; using OpenTK.Mathematics; namespace DoomDeathmatch.Component.Util; public class RotateComponent : Engine.Scene.Component.Component { private readonly IInputHandler _inputHandler = Engine.Engine.Instance.InputHandler!; public override void Update(double parDeltaTime) { if (_inputHandler.IsKeyPressed(KeyboardButtonCode.Q)) GameObject.Transform.Rotation *= Quaternion.FromAxisAngle(Vector3.UnitY, (float)parDeltaTime * 0.5f); else if (_inputHandler.IsKeyPressed(KeyboardButtonCode.E)) GameObject.Transform.Rotation *= Quaternion.FromAxisAngle(Vector3.UnitY, -(float)parDeltaTime * 0.5f); if (_inputHandler.IsMouseButtonPressed(MouseButtonCode.Left)) GameObject.Transform.Rotation *= Quaternion.FromAxisAngle(Vector3.UnitZ, (float)parDeltaTime * 0.5f); else if (_inputHandler.IsMouseButtonPressed(MouseButtonCode.Right)) GameObject.Transform.Rotation *= Quaternion.FromAxisAngle(Vector3.UnitZ, -(float)parDeltaTime * 0.5f); } }