From f43411c840da620913a5899320983379662c5d67 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 17 Aug 2024 19:16:17 +0300 Subject: [PATCH 1/5] AddFirstFilePNG --- ZoFo/Content/Textures/Animations/player_look_down.animation | 1 + ZoFo/Content/Textures/Animations/player_look_left.animation | 1 + .../Textures/Animations/player_look_left_down.animation | 1 + .../Content/Textures/Animations/player_look_left_up.animation | 1 + ZoFo/Content/Textures/Animations/player_look_right.animation | 1 + .../Textures/Animations/player_look_right_down.animation | 1 + .../Textures/Animations/player_look_right_up.animation | 1 + ZoFo/Content/Textures/Animations/player_look_up.animation | 1 + .../GameCore/GameObjects/Entities/EntittyForAnimationTests.cs | 4 ++-- 9 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 ZoFo/Content/Textures/Animations/player_look_down.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_left.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_left_down.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_left_up.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_right.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_right_down.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_right_up.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_up.animation diff --git a/ZoFo/Content/Textures/Animations/player_look_down.animation b/ZoFo/Content/Textures/Animations/player_look_down.animation new file mode 100644 index 0000000..3c008c0 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_down.animation @@ -0,0 +1 @@ +{"id":"player_look_down","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":464,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left.animation b/ZoFo/Content/Textures/Animations/player_look_left.animation new file mode 100644 index 0000000..13e8f0e --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left.animation @@ -0,0 +1 @@ +{"id":"player_look_left","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":696,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_down.animation b/ZoFo/Content/Textures/Animations/player_look_left_down.animation new file mode 100644 index 0000000..78f5150 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_down.animation @@ -0,0 +1 @@ +{"id":"player_look_left_down","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":580,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_up.animation b/ZoFo/Content/Textures/Animations/player_look_left_up.animation new file mode 100644 index 0000000..9fc0cf6 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_up.animation @@ -0,0 +1 @@ +{"id":"player_look_left_up","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":812,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right.animation b/ZoFo/Content/Textures/Animations/player_look_right.animation new file mode 100644 index 0000000..3d1bf63 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right.animation @@ -0,0 +1 @@ +{"id":"player_look_right","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":232,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_down.animation b/ZoFo/Content/Textures/Animations/player_look_right_down.animation new file mode 100644 index 0000000..fbdbeb9 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_down.animation @@ -0,0 +1 @@ +{"id":"player_look_right_down","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":348,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_up.animation b/ZoFo/Content/Textures/Animations/player_look_right_up.animation new file mode 100644 index 0000000..0fe59d4 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_up.animation @@ -0,0 +1 @@ +{"id":"player_look_right_up","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":116,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_up.animation b/ZoFo/Content/Textures/Animations/player_look_up.animation new file mode 100644 index 0000000..3b24dca --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_up.animation @@ -0,0 +1 @@ +{"id":"player_look_up","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":0,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs index fb545a1..09d21c2 100644 --- a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs +++ b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs @@ -12,10 +12,10 @@ namespace ZoFo.GameCore.GameObjects.Entities { //public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "тут пишите название анимации" }, "сдублируйте " + - public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_idle_top-right_noweapon" }, "player_idle_top-right_noweapon"); + public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_look_left_up" }, "player_look_left_up"); public EntittyForAnimationTests(Vector2 position) : base(position) { - graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,50,50); + graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,150,150); position = new Vector2(10, 10); } From c8108d6781374d8f8fab75f0ed75e15968fd4d20 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 17 Aug 2024 20:14:55 +0300 Subject: [PATCH 2/5] PlayerWeaponAFK --- .../Textures/Animations/player_look_down_weapon.animation | 1 + .../Textures/Animations/player_look_left_down_weapon.animation | 1 + .../Textures/Animations/player_look_left_up_weapon.animation | 1 + .../Textures/Animations/player_look_left_weapon.animation | 1 + .../Textures/Animations/player_look_right_down_weapon.animation | 1 + .../Textures/Animations/player_look_right_up_weapon.animation | 1 + .../Textures/Animations/player_look_right_weapon.animation | 1 + .../Content/Textures/Animations/player_look_up_weapon.animation | 1 + ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs | 2 +- ZoFo/ZoFo.csproj | 1 + 10 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 ZoFo/Content/Textures/Animations/player_look_down_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_left_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_right_weapon.animation create mode 100644 ZoFo/Content/Textures/Animations/player_look_up_weapon.animation diff --git a/ZoFo/Content/Textures/Animations/player_look_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_down_weapon.animation new file mode 100644 index 0000000..76f9b07 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_down_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_down_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":512,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation new file mode 100644 index 0000000..bc33138 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_left_down_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":640,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation new file mode 100644 index 0000000..68ddc46 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_up_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_left_up_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":896,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation new file mode 100644 index 0000000..2df77a0 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_left_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":768,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation new file mode 100644 index 0000000..49ca0c6 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_down_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_right_down_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":384,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation new file mode 100644 index 0000000..897c4b5 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_up_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_right_up_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":128,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_right_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_right_weapon.animation new file mode 100644 index 0000000..e7a753c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_right_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_right_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":256,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/player_look_up_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_up_weapon.animation new file mode 100644 index 0000000..4f45286 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_look_up_weapon.animation @@ -0,0 +1 @@ +{"id":"player_look_up_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":0,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs index 09d21c2..7d2d3c5 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 GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_look_left_up" }, "player_look_left_up"); + public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "player_look_left_up_weapon" }, "player_look_left_up_weapon"); public EntittyForAnimationTests(Vector2 position) : base(position) { graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,150,150); diff --git a/ZoFo/ZoFo.csproj b/ZoFo/ZoFo.csproj index c3a2b36..93ee8ce 100644 --- a/ZoFo/ZoFo.csproj +++ b/ZoFo/ZoFo.csproj @@ -33,6 +33,7 @@ + From 1a6f1c0fcec9d73a8f6b339400d0cde242400673 Mon Sep 17 00:00:00 2001 From: Kaktus200020 Date: Sun, 18 Aug 2024 14:33:23 +0300 Subject: [PATCH 3/5] addToClient --- ZoFo/GameCore/Client.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 665179e..af738dd 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -128,7 +128,14 @@ namespace ZoFo.GameCore gameObjects.Add(new Player((update as UpdateGameObjectCreated).position)); if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); +<<<<<<< Updated upstream + if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie") + gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position)); + +======= + +>>>>>>> Stashed changes (gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); //var a = Assembly.GetAssembly(typeof(GameObject)); //gameObjects.Add( TODO reflection From 50f1c5f4fc17c109f9c5b5aeb17f8ec5eb2b2c7a Mon Sep 17 00:00:00 2001 From: Kaktus200020 Date: Sun, 18 Aug 2024 14:37:07 +0300 Subject: [PATCH 4/5] Add zombie --- ZoFo/GameCore/Client.cs | 10 ++---- .../Entities/LivingEntities/Enemies/Enemy.cs | 7 ++++ .../Entities/LivingEntities/Enemies/Zombie.cs | 35 +++++++++++++++++++ ZoFo/GameCore/Server.cs | 1 + 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index af738dd..6c1c0a4 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -22,7 +22,8 @@ using System.Linq; using System.Web; using ZoFo.GameCore.GUI; using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; -using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; +using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; +using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; namespace ZoFo.GameCore { public class Client @@ -127,15 +128,10 @@ namespace ZoFo.GameCore if ((update as UpdateGameObjectCreated).GameObjectType == "Player") gameObjects.Add(new Player((update as UpdateGameObjectCreated).position)); if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") - gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); -<<<<<<< Updated upstream - if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie") + gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)) if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie") gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position)); -======= - ->>>>>>> Stashed changes (gameObjects.Last() as Entity).SetIdByClient((update as UpdateGameObjectCreated).IdEntity); //var a = Assembly.GetAssembly(typeof(GameObject)); //gameObjects.Add( TODO reflection diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs index f948689..61762ae 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Enemy.cs @@ -8,7 +8,14 @@ using Microsoft.Xna.Framework.Content; namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; public class Enemy : LivingEntity { + protected float speed; + protected int health; public Enemy(Vector2 position) : base(position) { + } + public override void Update() + { + + } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs new file mode 100644 index 0000000..632eceb --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs @@ -0,0 +1,35 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.Graphics; + +namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies +{ + class Zombie : Enemy + { + public override GraphicsComponent graphicsComponent { get; } = new("Textures/icons/8"); + public Zombie(Vector2 position) : base(position) + { + health = 5; + speed =2; + collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100); + graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100); + } + + public override void Update() + { + Vector2 duration = Vector2.Normalize(new Vector2(600 - position.X, 500 - position.Y)); + velocity=new Vector2(duration.X * speed, duration.Y*speed); + if(position.X>595 && 605>position.X && position.Y>495 && 505>position.Y) + { + velocity = Vector2.Zero; + } + //position.X += velocity.X*t; + //position.Y += velocity.Y * t; + } + } +} diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index d0272db..95a7ecd 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -126,6 +126,7 @@ namespace ZoFo.GameCore AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(40, 40))); AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(740, 140))); + AppManager.Instance.server.RegisterGameObject(new Zombie(new Vector2(1000, 1000))); AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(140, 440))); AppManager.Instance.server.RegisterGameObject(new Ammo(new Vector2(240, 440))); } From 0336c3095b92765726f9d1f88f8f75f431a4842d Mon Sep 17 00:00:00 2001 From: SergoDobro Date: Sun, 18 Aug 2024 15:15:14 +0300 Subject: [PATCH 5/5] Player List Added + animations --- ZoFo/Content/Content.mgcb | 105 ++++++++++++++++-- .../player_down-left_idle.animation | 21 ++++ .../player_down-right_idle.animation | 20 ++++ .../Animations/player_down_idle.animation | 20 ++++ .../player_idle_down-left_mining.animation | 21 ++++ .../player_idle_down_mining.animation | 21 ++++ .../player_idle_left_mining.animation | 21 ++++ .../player_idle_rights_mining.animation | 21 ++++ .../player_idle_top-left_mining.animation | 21 ++++ .../player_idle_top-rights_mining.animation | 20 ++++ .../Animations/player_left_idle.animation | 21 ++++ .../Animations/player_look_down.animation | 21 +++- .../player_look_left_down_weapon.animation | 21 +++- .../player_look_left_weapon.animation | 21 +++- .../Animations/player_right_idle.animation | 21 ++++ .../Animations/player_top-left_idle.animation | 21 ++++ .../player_top-right_idle.animation | 21 ++++ .../Animations/player_top_mining.animation | 21 ++++ .../Animations/testAnimation.animation | 21 ++++ .../Animations/testAnimationExample.animation | 21 +++- ZoFo/GameCore/Client.cs | 33 ++++-- .../Entities/LivingEntities/Enemies/Zombie.cs | 6 +- .../Entities/LivingEntities/Player/Player.cs | 2 +- ZoFo/GameCore/Graphics/AnimationBuilder.cs | 20 +++- ZoFo/GameCore/Server.cs | 20 ++-- 25 files changed, 539 insertions(+), 43 deletions(-) create mode 100644 ZoFo/Content/Textures/Animations/player_down-left_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_down-right_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_down_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/player_idle_down_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/player_idle_left_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/player_left_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_right_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_top-left_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_top-right_idle.animation create mode 100644 ZoFo/Content/Textures/Animations/player_top_mining.animation create mode 100644 ZoFo/Content/Textures/Animations/testAnimation.animation diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index d8fde75..09e9f35 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -85,18 +85,111 @@ /processorParam:Quality=Best /build:sounds/Zombi stoit.wav +#begin Textures/Animations/player_down_idle.animation +/copy:Textures/Animations/player_down_idle.animation + +#begin Textures/Animations/player_down-left_idle.animation +/copy:Textures/Animations/player_down-left_idle.animation + +#begin Textures/Animations/player_down-right_idle.animation +/copy:Textures/Animations/player_down-right_idle.animation + +#begin Textures/Animations/player_idle_down_mining.animation +/copy:Textures/Animations/player_idle_down_mining.animation + +#begin Textures/Animations/player_idle_down-left_mining.animation +/copy:Textures/Animations/player_idle_down-left_mining.animation + +#begin Textures/Animations/player_idle_left_mining.animation +/copy:Textures/Animations/player_idle_left_mining.animation + +#begin Textures/Animations/player_idle_rights_mining.animation +/copy:Textures/Animations/player_idle_rights_mining.animation + #begin Textures/Animations/player_idle_top_noweapon.animation /copy:Textures/Animations/player_idle_top_noweapon.animation +#begin Textures/Animations/player_idle_top-left_mining.animation +/copy:Textures/Animations/player_idle_top-left_mining.animation + #begin Textures/Animations/player_idle_top-right_noweapon.animation /copy:Textures/Animations/player_idle_top-right_noweapon.animation +#begin Textures/Animations/player_idle_top-rights_mining.animation +/copy:Textures/Animations/player_idle_top-rights_mining.animation + +#begin Textures/Animations/player_left_idle.animation +/copy:Textures/Animations/player_left_idle.animation + +#begin Textures/Animations/player_look_down_weapon.animation +/copy:Textures/Animations/player_look_down_weapon.animation + +#begin Textures/Animations/player_look_down.animation +/copy:Textures/Animations/player_look_down.animation + +#begin Textures/Animations/player_look_left_down_weapon.animation +/copy:Textures/Animations/player_look_left_down_weapon.animation + +#begin Textures/Animations/player_look_left_down.animation +/copy:Textures/Animations/player_look_left_down.animation + +#begin Textures/Animations/player_look_left_up_weapon.animation +/copy:Textures/Animations/player_look_left_up_weapon.animation + +#begin Textures/Animations/player_look_left_up.animation +/copy:Textures/Animations/player_look_left_up.animation + +#begin Textures/Animations/player_look_left_weapon.animation +/copy:Textures/Animations/player_look_left_weapon.animation + +#begin Textures/Animations/player_look_left.animation +/copy:Textures/Animations/player_look_left.animation + +#begin Textures/Animations/player_look_right_down_weapon.animation +/copy:Textures/Animations/player_look_right_down_weapon.animation + +#begin Textures/Animations/player_look_right_down.animation +/copy:Textures/Animations/player_look_right_down.animation + +#begin Textures/Animations/player_look_right_up_weapon.animation +/copy:Textures/Animations/player_look_right_up_weapon.animation + +#begin Textures/Animations/player_look_right_up.animation +/copy:Textures/Animations/player_look_right_up.animation + +#begin Textures/Animations/player_look_right_weapon.animation +/copy:Textures/Animations/player_look_right_weapon.animation + +#begin Textures/Animations/player_look_right.animation +/copy:Textures/Animations/player_look_right.animation + +#begin Textures/Animations/player_look_up_weapon.animation +/copy:Textures/Animations/player_look_up_weapon.animation + +#begin Textures/Animations/player_look_up.animation +/copy:Textures/Animations/player_look_up.animation + +#begin Textures/Animations/player_right_idle.animation +/copy:Textures/Animations/player_right_idle.animation + #begin Textures/Animations/player_running_top_rotate.animation /copy:Textures/Animations/player_running_top_rotate.animation +#begin Textures/Animations/player_top_mining.animation +/copy:Textures/Animations/player_top_mining.animation + +#begin Textures/Animations/player_top-left_idle.animation +/copy:Textures/Animations/player_top-left_idle.animation + +#begin Textures/Animations/player_top-right_idle.animation +/copy:Textures/Animations/player_top-right_idle.animation + #begin Textures/Animations/running_top.animation /copy:Textures/Animations/running_top.animation +#begin Textures/Animations/testAnimation.animation +/copy:Textures/Animations/testAnimation.animation + #begin Textures/Animations/testAnimationExample.animation /copy:Textures/Animations/testAnimationExample.animation @@ -580,15 +673,3 @@ /processorParam:TextureFormat=Color /build:Textures/TileSets/TilesetFloor.png -#begin Textures/TileSets/TilesetFloor.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/TileSets/TilesetFloor.png - diff --git a/ZoFo/Content/Textures/Animations/player_down-left_idle.animation b/ZoFo/Content/Textures/Animations/player_down-left_idle.animation new file mode 100644 index 0000000..6c2a6c7 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_down-left_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_down-left_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 560, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_down-right_idle.animation b/ZoFo/Content/Textures/Animations/player_down-right_idle.animation new file mode 100644 index 0000000..016a3f2 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_down-right_idle.animation @@ -0,0 +1,20 @@ +{ + "id": "player_down-right_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 358, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_down_idle.animation b/ZoFo/Content/Textures/Animations/player_down_idle.animation new file mode 100644 index 0000000..243946c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_down_idle.animation @@ -0,0 +1,20 @@ +{ + "id": "player_down_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 464, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation new file mode 100644 index 0000000..ba1b3c9 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_down-left_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_down-left_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 776, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_down_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_down_mining.animation new file mode 100644 index 0000000..92bda6c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_down_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_down_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 582, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_left_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_left_mining.animation new file mode 100644 index 0000000..81f9629 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_left_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_left_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 1358, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation new file mode 100644 index 0000000..6570cce --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_rights_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_rights_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 388, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": false, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation new file mode 100644 index 0000000..3dfef38 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_top-left_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_idle_top-left_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 1552, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation b/ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation new file mode 100644 index 0000000..d4a5828 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_idle_top-rights_mining.animation @@ -0,0 +1,20 @@ +{ + "id": "player_idle_top-rights_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 194, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_left_idle.animation b/ZoFo/Content/Textures/Animations/player_left_idle.animation new file mode 100644 index 0000000..8906cb3 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_left_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_left_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 696, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_look_down.animation b/ZoFo/Content/Textures/Animations/player_look_down.animation index 3c008c0..0b4e385 100644 --- a/ZoFo/Content/Textures/Animations/player_look_down.animation +++ b/ZoFo/Content/Textures/Animations/player_look_down.animation @@ -1 +1,20 @@ -{"id":"player_look_down","textureName":"Textures/AnimationTextures/Character/hr-level1_idle","startSpriteRectangle":{"X":0,"Y":464,"Width":92,"Height":116},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} +{ + "id": "player_look_down", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 464, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation index bc33138..5d7468b 100644 --- a/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation +++ b/ZoFo/Content/Textures/Animations/player_look_left_down_weapon.animation @@ -1 +1,20 @@ -{"id":"player_look_left_down_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":640,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} +{ + "id": "player_look_left_down_weapon", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle_gun", + "startSpriteRectangle": { + "X": 0, + "Y": 640, + "Width": 110, + "Height": 128 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation b/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation index 2df77a0..638f33a 100644 --- a/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation +++ b/ZoFo/Content/Textures/Animations/player_look_left_weapon.animation @@ -1 +1,20 @@ -{"id":"player_look_left_weapon","textureName":"Textures/AnimationTextures/Character/hr-level1_idle_gun","startSpriteRectangle":{"X":0,"Y":768,"Width":110,"Height":128},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":22,"isCycle":true,"offset":"0, 0"} +{ + "id": "player_look_left_weapon", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle_gun", + "startSpriteRectangle": { + "X": 0, + "Y": 768, + "Width": 110, + "Height": 128 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/Content/Textures/Animations/player_right_idle.animation b/ZoFo/Content/Textures/Animations/player_right_idle.animation new file mode 100644 index 0000000..a3c1538 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_right_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_right_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 232, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_top-left_idle.animation b/ZoFo/Content/Textures/Animations/player_top-left_idle.animation new file mode 100644 index 0000000..feb823e --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_top-left_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_top-left_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 812, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_top-right_idle.animation b/ZoFo/Content/Textures/Animations/player_top-right_idle.animation new file mode 100644 index 0000000..df132a3 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_top-right_idle.animation @@ -0,0 +1,21 @@ +{ + "id": "player_top-right_idle", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 116, + "Width": 92, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 22, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/player_top_mining.animation b/ZoFo/Content/Textures/Animations/player_top_mining.animation new file mode 100644 index 0000000..061d43a --- /dev/null +++ b/ZoFo/Content/Textures/Animations/player_top_mining.animation @@ -0,0 +1,21 @@ +{ + "id": "player_top_mining", + "textureName": "Textures/AnimationTextures/Character/hr-level1_mining_tool-1", + "startSpriteRectangle": { + "X": 0, + "Y": 0, + "Width": 196, + "Height": 194 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 13, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/testAnimation.animation b/ZoFo/Content/Textures/Animations/testAnimation.animation new file mode 100644 index 0000000..917113d --- /dev/null +++ b/ZoFo/Content/Textures/Animations/testAnimation.animation @@ -0,0 +1,21 @@ +{ + "id": "testAnimation", + "textureName": "Textures/AnimationTextures/Character/hr-level1_idle", + "startSpriteRectangle": { + "X": 0, + "Y": 0, + "Width": 53, + "Height": 116 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 5 + } + ], + "textureFrameInterval": 0, + "framesCount": 11, + "isCycle": true, + "offset": "0, 0" + +} diff --git a/ZoFo/Content/Textures/Animations/testAnimationExample.animation b/ZoFo/Content/Textures/Animations/testAnimationExample.animation index de970c1..88d3740 100644 --- a/ZoFo/Content/Textures/Animations/testAnimationExample.animation +++ b/ZoFo/Content/Textures/Animations/testAnimationExample.animation @@ -1 +1,20 @@ -{"id":"testAnimationExample","textureName":"Textures/AnimationTextures/unicorn","startSpriteRectangle":{"X":0,"Y":0,"Width":400,"Height":400},"frameSecond":[{"Item1":0,"Item2":1}],"textureFrameInterval":1,"framesCount":1,"isCycle":true,"offset":"0, 0"} +{ + "id": "testAnimationExample", + "textureName": "Textures/AnimationTextures/unicorn", + "startSpriteRectangle": { + "X": 0, + "Y": 0, + "Width": 400, + "Height": 400 + }, + "frameSecond": [ + { + "Item1": 0, + "Item2": 1 + } + ], + "textureFrameInterval": 1, + "framesCount": 1, + "isCycle": true, + "offset": "0, 0" +} diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index e61253e..626f732 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -12,9 +12,9 @@ using ZoFo.GameCore.GameObjects.MapObjects; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; using System.Drawing; using System.Reflection; -using ZoFo.GameCore.GameObjects.Entities; +using ZoFo.GameCore.GameObjects.Entities; using System.Net.Sockets; -using System.Net; +using System.Net; using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player; @@ -42,10 +42,14 @@ namespace ZoFo.GameCore // Подписка на действия инпутменеджера. // Отправляются данные апдейтса с обновлением инпута - AppManager.Instance.InputManager.ActionEvent += () => networkManager.AddData(new UpdateInput(){ - InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection, - InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection - }); + AppManager.Instance.InputManager.ActionEvent += () => + { + networkManager.AddData(new UpdateInput() + { + InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection, + InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection + }); + }; } public void OnDataSend(string data) @@ -70,7 +74,8 @@ namespace ZoFo.GameCore #endregion List mapObjects = new List(); - List gameObjects = new List(); + List gameObjects = new List(); + List players = new List(); List stopObjects = new List(); /// /// Клиент должен обнговлять игру анимаций @@ -102,7 +107,7 @@ namespace ZoFo.GameCore internal void GotData(UpdateData update) { - if (update is UpdateTileCreated) + if (update is UpdateTileCreated) { mapObjects.Add( new MapObject( @@ -112,7 +117,7 @@ namespace ZoFo.GameCore (update as UpdateTileCreated).tileSetName )); } - else if (update is UpdateStopObjectCreated) + else if (update is UpdateStopObjectCreated) { stopObjects.Add( new StopObject( @@ -125,12 +130,18 @@ namespace ZoFo.GameCore } else if (update is UpdateGameObjectCreated) { + GameObject created_gameObject; if ((update as UpdateGameObjectCreated).GameObjectType == "EntittyForAnimationTests") gameObjects.Add(new EntittyForAnimationTests((update as UpdateGameObjectCreated).position)); if ((update as UpdateGameObjectCreated).GameObjectType == "Player") - gameObjects.Add(new Player((update as UpdateGameObjectCreated).position)); + { + created_gameObject = new Player((update as UpdateGameObjectCreated).position); + players.Add(created_gameObject as Player); + gameObjects.Add(created_gameObject); + } if ((update as UpdateGameObjectCreated).GameObjectType == "Ammo") - gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)) if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie") + gameObjects.Add(new Ammo((update as UpdateGameObjectCreated).position)); + if ((update as UpdateGameObjectCreated).GameObjectType == "Zombie") gameObjects.Add(new Zombie((update as UpdateGameObjectCreated).position)); diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs index 632eceb..bc504f9 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs @@ -11,7 +11,7 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies { class Zombie : Enemy { - public override GraphicsComponent graphicsComponent { get; } = new("Textures/icons/8"); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent("Textures/icons/8"); public Zombie(Vector2 position) : base(position) { health = 5; @@ -22,7 +22,9 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies public override void Update() { - Vector2 duration = Vector2.Normalize(new Vector2(600 - position.X, 500 - position.Y)); + Vector2 duration = Vector2.Normalize( + AppManager.Instance.server.players[0].position - position + ); velocity=new Vector2(duration.X * speed, duration.Y*speed); if(position.X>595 && 605>position.X && position.Y>495 && 505>position.Y) { diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index 3e21338..42d89c2 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -21,7 +21,7 @@ public class Player : LivingEntity public bool IsTryingToShoot { get; set; } private float speed; private int health; - public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_running_top_rotate" }, "player_running_top_rotate"); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_look_down" }, "player_look_down"); private LootData lootData; public Player(Vector2 position) : base(position) { diff --git a/ZoFo/GameCore/Graphics/AnimationBuilder.cs b/ZoFo/GameCore/Graphics/AnimationBuilder.cs index 2ff7ac4..e85ec28 100644 --- a/ZoFo/GameCore/Graphics/AnimationBuilder.cs +++ b/ZoFo/GameCore/Graphics/AnimationBuilder.cs @@ -17,12 +17,20 @@ namespace ZoFo.GameCore.Graphics StreamReader reader; foreach (var fileName in animationFilesNames) { - if (!fileName.EndsWith(".animation")) continue; - reader = new StreamReader(fileName); - string json = reader.ReadToEnd(); - AnimationContainer animation = JsonConvert.DeserializeObject(json); - Animations.Add(animation); - reader.Close(); + try + { + if (!fileName.EndsWith(".animation")) continue; + reader = new StreamReader(fileName); + string json = reader.ReadToEnd(); + AnimationContainer animation = JsonConvert.DeserializeObject(json); + Animations.Add(animation); + reader.Close(); + } + catch + { + + + } } } diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 47ddd3d..329763c 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -124,6 +124,7 @@ namespace ZoFo.GameCore collisionManager = new CollisionManager(); gameObjects = new List(); entities = new List(); + players = new List(); new MapManager().LoadMap(); AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0))); @@ -143,8 +144,9 @@ namespace ZoFo.GameCore networkManager.CloseConnection(); } - private List gameObjects = new List(); - private List entities; //entity + public List gameObjects; + public List entities; //entity + public List players; public void Update(GameTime gameTime) { if (ticks == 3) //ОБРАБАТЫВАЕТСЯ 20 РАЗ В СЕКУНДУ @@ -198,24 +200,28 @@ namespace ZoFo.GameCore });//TODO return; } - if (gameObject is Entity) + if (gameObject is Entity entity) { - AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = (gameObject as Entity).Id, + AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, IdEntity = entity.Id, position = gameObject.position}); - collisionManager.Register((gameObject as Entity).collisionComponent); + collisionManager.Register(entity.collisionComponent); } else AddData(new UpdateGameObjectCreated() { GameObjectType = gameObject.GetType().Name, position = gameObject.position }); - + + if (gameObject is Player) + { + players.Add(gameObject as Player); + } ////var elems = gameObject.GetType().GetProperties(System.Reflection.BindingFlags.Public); ////if (elems.Count()>0) TODO ////{ //// AppManager.Instance.server.collisionManager.Register((elems.First().GetValue(gameObject) as CollisionComponent)); ////} - + } ///