From be0d38bb95c289dc4dfd7ae06def105058dd24a9 Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Sun, 18 Aug 2024 10:53:42 +0300 Subject: [PATCH] Fix inheritance --- .../GameCore/GameObjects/Entities/EntittyForAnimationTests.cs | 2 +- .../GameObjects/Entities/LivingEntities/LivingEntity.cs | 2 +- .../GameObjects/Entities/LivingEntities/Player/Player.cs | 4 ++-- ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs | 2 -- ZoFo/GameCore/Server.cs | 3 +++ 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs index 5ff1061..46d2abe 100644 --- a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs +++ b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs @@ -12,7 +12,7 @@ namespace ZoFo.GameCore.GameObjects.Entities { //public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "тут пишите название анимации" }, "сдублируйте " + - public override AnimatedGraphicsComponent graphicsComponent { get; } = new(new List { "player_running_top_rotate" }, "player_running_top_rotate"); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); public EntittyForAnimationTests(Vector2 position) : base(position) { graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*12, 16 * 16); diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs index 7d4d845..cc6cb9c 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/LivingEntity.cs @@ -21,7 +21,7 @@ public class LivingEntity : Entity inputManager = new InputManager(); } - public override AnimatedGraphicsComponent graphicsComponent { get; } = null; + public override GraphicsComponent graphicsComponent { get; } = null; #region Server side /*public override void Update() diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index ca0ddac..6d1b34a 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -20,12 +20,12 @@ 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", new Rectangle(0,0,100,100)); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); public Player(Vector2 position) : base(position) { //InputWeaponRotation = new Vector2(0, 0); //InputPlayerRotation = new Vector2(0, 0); - + graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100); collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100); } diff --git a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs index 36edc5b..36b34ec 100644 --- a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs +++ b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs @@ -202,7 +202,6 @@ 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; @@ -226,7 +225,6 @@ namespace ZoFo.GameCore.Graphics destinationRectangle = Scaling(destinationRectangle); _spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White); - DebugHUD.Instance.Log(texture.Name); } public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle) diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index de52802..f60d911 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -99,6 +99,9 @@ namespace ZoFo.GameCore AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(40, 40))); AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(140, 140))); + AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(300, 140))); + AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(450, 140))); + AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(140, 140))); } ///