Fix entities displaying
This commit is contained in:
parent
bd25894407
commit
5a7fc98597
3 changed files with 6 additions and 5 deletions
|
@ -20,20 +20,20 @@ public class Player : LivingEntity
|
|||
public bool IsTryingToShoot { get; set; }
|
||||
private float speed;
|
||||
private int health;
|
||||
public override AnimatedGraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "player_running_top_rotate" }, "player_running_top_rotate");
|
||||
public override AnimatedGraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "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();
|
||||
}
|
||||
float t;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<string> animationsId, string neitralAnimationId)
|
||||
public AnimatedGraphicsComponent(List<string> 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;
|
||||
|
|
Loading…
Add table
Reference in a new issue