Attack fixes

This commit is contained in:
SergoDobro 2024-08-20 17:54:52 +03:00
parent 1e1be7d923
commit dd72218287
7 changed files with 39 additions and 22 deletions

View file

@ -83,6 +83,12 @@
/processorParam:Quality=Best
/build:sounds/Craft sound.wav
#begin sounds/gun-gunshot-01.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:sounds/gun-gunshot-01.wav
#begin sounds/Loot.wav
/importer:WavImporter
/processor:SoundEffectProcessor
@ -394,20 +400,8 @@
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png
#begin Textures/GUI/back.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/back.png
#begin Textures/Effects/explosion.png
#begin Textures/Effects/explosion.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -419,6 +413,18 @@
/processorParam:TextureFormat=Color
/build:Textures/Effects/explosion.png
#begin Textures/GUI/back.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/back.png
#begin Textures/GUI/background/base.png
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

View file

@ -138,6 +138,10 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
update = token.ToObject<UpdateGameObjectCreated>();
data.Add(update);
break;
case "UpdateGameObjectWithoutIdCreated":
update = token.ToObject<UpdateGameObjectWithoutIdCreated>();
data.Add(update);
break;
case "UpdateGameObjectDeleted":
update = token.ToObject<UpdateGameObjectDeleted>();
data.Add(update);

View file

@ -262,8 +262,8 @@ public class Player : LivingEntity
for (int i = 0; i < 3; i++)
{
Instantiate(new Particle(
(collisionComponent.stopRectangle.Location.ToVector2() * i / 3f) +
(collisionComponent.stopRectangle.Location.ToVector2() * (3 - i) / 3f)
((position - graphicsComponent.ObjectDrawRectangle.Location.ToVector2()) * i / 3f) +
((entity.position) * (3 - i) / 3f)
));
}
@ -276,9 +276,11 @@ public class Player : LivingEntity
{
DrawDebugRectangle(spriteBatch, GetDamageArea(AppManager.Instance.InputManager.InputAttackDirection), Color.Green);
DrawDebugRectangle(spriteBatch, GetDamageArea(AppManager.Instance.InputManager.InputAttackDirection, 2), Color.Green);
DrawDebugRectangle(spriteBatch, GetDamageArea(AppManager.Instance.InputManager.InputAttackDirection, 3), Color.Green);
base.Draw(spriteBatch);
}
public Rectangle GetDamageArea(Vector2 direction)
public Rectangle GetDamageArea(Vector2 direction, float mult = 1)
{
direction.Normalize();
var rect = collisionComponent.stopRectangle.SetOrigin(position);
@ -287,7 +289,7 @@ public class Player : LivingEntity
rect.Y -= size;
rect.Width += 2 * size;
rect.Height += 2 * size;
rect = rect.SetOrigin(direction * 40);
rect = rect.SetOrigin(direction * 40 * mult);
return rect;
}
}

View file

@ -16,11 +16,16 @@ namespace ZoFo.GameCore.GameObjects
public Particle(Vector2 position) : base(position)
{
graphicsComponent.ObjectDrawRectangle = new Rectangle(-30, -30,60,60).SetOrigin(position);
(graphicsComponent as AnimatedGraphicsComponent).actionOfAnimationEnd += _ => {
graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0,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 += _ => {
if (AppManager.Instance.client!=null)
{
AppManager.Instance.client.DeleteObject(this);
}
};
}
}

View file

@ -24,6 +24,7 @@ public abstract class GameObject
graphicsComponent.ObjectDrawRectangle.X = (int)position.X;
graphicsComponent.ObjectDrawRectangle.Y = (int)position.Y;
positionDraw = position;
}
public virtual void UpdateLogic()
{

View file

@ -208,7 +208,6 @@ namespace ZoFo.GameCore
});
return;
}
if (gameObject is Entity entity)
{
AddData(new UpdateGameObjectCreated()