work in progress
This commit is contained in:
parent
fd917022cf
commit
7426a68c8e
4 changed files with 34 additions and 6 deletions
|
@ -133,11 +133,11 @@ namespace ZoFo.GameCore
|
||||||
UpdateShaking();
|
UpdateShaking();
|
||||||
for (int i = 0; i < gameObjects.Count; i++)
|
for (int i = 0; i < gameObjects.Count; i++)
|
||||||
{
|
{
|
||||||
gameObjects[i].UpdateAnimations();
|
gameObjects[i].Update_OnClient();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < particles.Count; i++)
|
for (int i = 0; i < particles.Count; i++)
|
||||||
{
|
{
|
||||||
particles[i].UpdateAnimations();
|
particles[i].Update_OnClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
networkManager.SendData();//set to ticks
|
networkManager.SendData();//set to ticks
|
||||||
|
|
|
@ -34,9 +34,9 @@ public class LivingEntity : Entity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateAnimations()
|
public override void Update_OnClient()
|
||||||
{
|
{
|
||||||
base.UpdateAnimations();
|
base.Update_OnClient();
|
||||||
}
|
}
|
||||||
protected Vector2 prevPosition_forClient;
|
protected Vector2 prevPosition_forClient;
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
|
|
@ -33,4 +33,32 @@ namespace ZoFo.GameCore.GameObjects
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class Granade : Particle
|
||||||
|
{
|
||||||
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "explosion_1" }, "explosion_1");
|
||||||
|
|
||||||
|
public Granade(Vector2 positionTo, Vector2? positionFrom = null) : base(positionTo)
|
||||||
|
{
|
||||||
|
|
||||||
|
graphicsComponent.ObjectDrawRectangle = new Rectangle(-30, -30, 60, 60).SetOrigin(position);
|
||||||
|
AppManager.Instance.SoundManager.StartSound("gun-gunshot-01", Vector2.Zero, Vector2.Zero, 0.5f, (float)(Random.Shared.NextDouble() * 2 - 1));
|
||||||
|
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += _ => {
|
||||||
|
|
||||||
|
Delete_OnClient(this);
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Vector2 positionFrom;
|
||||||
|
Vector2 positionTo;
|
||||||
|
float dt = 0;
|
||||||
|
public override void Update_OnClient()
|
||||||
|
{
|
||||||
|
position.X = (1 - dt) * positionFrom.X + dt * positionTo.X;
|
||||||
|
position.Y = (1 - dt) * positionFrom.X + dt * positionTo.X;
|
||||||
|
dt += 0.05f;
|
||||||
|
|
||||||
|
//position =
|
||||||
|
base.Update_OnClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public abstract class GameObject
|
||||||
/// Для клиента
|
/// Для клиента
|
||||||
/// Обновление, которое вызывается у клиента, для просмотра анимаций
|
/// Обновление, которое вызывается у клиента, для просмотра анимаций
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void UpdateAnimations()
|
public virtual void Update_OnClient()
|
||||||
{
|
{
|
||||||
positionDraw = (position * 0.15f + positionDraw*0.85f);
|
positionDraw = (position * 0.15f + positionDraw*0.85f);
|
||||||
graphicsComponent.ObjectDrawRectangle.X = (int)positionDraw.X; //Move To place where Updates Sets your position
|
graphicsComponent.ObjectDrawRectangle.X = (int)positionDraw.X; //Move To place where Updates Sets your position
|
||||||
|
|
Loading…
Add table
Reference in a new issue