diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index 5072c8d..ca0ddac 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -20,19 +20,19 @@ public class Player : LivingEntity public bool IsTryingToShoot { get; set; } private float speed; private int health; - public override AnimatedGraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); + public override AnimatedGraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate", new Rectangle(0,0,100,100)); public Player(Vector2 position) : base(position) { //InputWeaponRotation = new Vector2(0, 0); //InputPlayerRotation = new Vector2(0, 0); collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100); - graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,100,100); } public override void Update() { + MovementLogic(); } diff --git a/ZoFo/GameCore/GameObjects/GameObject.cs b/ZoFo/GameCore/GameObjects/GameObject.cs index f569685..85189ea 100644 --- a/ZoFo/GameCore/GameObjects/GameObject.cs +++ b/ZoFo/GameCore/GameObjects/GameObject.cs @@ -13,7 +13,7 @@ public abstract class GameObject public Vector2 position; public Vector2 rotation; //вектор направления объекта - public abstract GraphicsComponent graphicsComponent { get; } + public virtual GraphicsComponent graphicsComponent { get; } #region ServerSide public GameObject(Vector2 position) diff --git a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs index cc2f87d..36edc5b 100644 --- a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs +++ b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs @@ -11,7 +11,6 @@ namespace ZoFo.GameCore.Graphics public class AnimatedGraphicsComponent : GraphicsComponent { - public Rectangle ObjectDrawRectangle; @@ -51,8 +50,9 @@ namespace ZoFo.GameCore.Graphics private int interval; private int lastInterval; private Rectangle sourceRectangle; - public AnimatedGraphicsComponent(List animationsId, string neitralAnimationId) + public AnimatedGraphicsComponent(List animationsId, string neitralAnimationId, Rectangle objectDrawRectangle = new()) { + ObjectDrawRectangle = objectDrawRectangle; //this._spriteBatch = _spriteBatch; currentFrame = 0; lastInterval = 1; @@ -202,6 +202,7 @@ namespace ZoFo.GameCore.Graphics public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch) { + DebugHUD.Instance.Log($"{destinationRectangle.Width} : {destinationRectangle.Height}"); Texture2D texture = textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)]; float scale;