diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index 14c8973..ba94670 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -124,54 +124,54 @@ #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_down_weapon.animation +/copy:Textures/Animations/player_look_down_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_left_down.animation +/copy:Textures/Animations/player_look_left_down.animation -#begin Textures/Animations/player_look_right_down.animation -/copy:Textures/Animations/player_look_right_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_right_up_weapon.animation -/copy:Textures/Animations/player_look_right_up_weapon.animation +#begin Textures/Animations/player_look_left_up.animation +/copy:Textures/Animations/player_look_left_up.animation -#begin Textures/Animations/player_look_right_up.animation -/copy:Textures/Animations/player_look_right_up.animation +#begin Textures/Animations/player_look_left_up_weapon.animation +/copy:Textures/Animations/player_look_left_up_weapon.animation -#begin Textures/Animations/player_look_right_weapon.animation -/copy:Textures/Animations/player_look_right_weapon.animation +#begin Textures/Animations/player_look_left_weapon.animation +/copy:Textures/Animations/player_look_left_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_right_down.animation +/copy:Textures/Animations/player_look_right_down.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_up.animation +/copy:Textures/Animations/player_look_right_up.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_weapon.animation +/copy:Textures/Animations/player_look_right_weapon.animation #begin Textures/Animations/player_look_up.animation /copy:Textures/Animations/player_look_up.animation +#begin Textures/Animations/player_look_up_weapon.animation +/copy:Textures/Animations/player_look_up_weapon.animation + #begin Textures/Animations/player_right_idle.animation /copy:Textures/Animations/player_right_idle.animation @@ -196,6 +196,21 @@ #begin Textures/Animations/testAnimationExample.animation /copy:Textures/Animations/testAnimationExample.animation +#begin Textures/Animations/zombie_attack.animation +/copy:Textures/Animations/zombie_attack.animation + +#begin Textures/Animations/zombie_damaged.animation +/copy:Textures/Animations/zombie_damaged.animation + +#begin Textures/Animations/zombie_death.animation +/copy:Textures/Animations/zombie_death.animation + +#begin Textures/Animations/zombie_idle.animation +/copy:Textures/Animations/zombie_idle.animation + +#begin Textures/Animations/zombie_walk.animation +/copy:Textures/Animations/zombie_walk.animation + #begin Textures/AnimationTextures/Character/hr-level1_idle.png /importer:TextureImporter /processor:TextureProcessor @@ -280,6 +295,30 @@ /processorParam:TextureFormat=Color /build:Textures/AnimationTextures/unicorn.png +#begin Textures/AnimationTextures/Zombie/zombie_spritesheet_v1.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/AnimationTextures/Zombie/zombie_spritesheet_v1.png + +#begin Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.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/AnimationTextures/Zombie/zombie_spritesheet_v2.png + #begin Textures/GUI/background/base.png /importer:TextureImporter /processor:TextureProcessor diff --git a/ZoFo/Content/MapData/MapSession.tiled-session b/ZoFo/Content/MapData/MapSession.tiled-session index c7b859f..e679791 100644 --- a/ZoFo/Content/MapData/MapSession.tiled-session +++ b/ZoFo/Content/MapData/MapSession.tiled-session @@ -47,6 +47,7 @@ "TileSets/TileSet 1.tsj", "TileSets/WallSet.tsj" ], + "stampsFolder": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/MapData/TileStamps", "tileset.lastUsedFormat": "json", "tileset.margin": 0, "tileset.spacing": 0, diff --git a/ZoFo/Content/MapData/TileStamps/boulders.stamp b/ZoFo/Content/MapData/TileStamps/boulders.stamp new file mode 100644 index 0000000..a76d82f --- /dev/null +++ b/ZoFo/Content/MapData/TileStamps/boulders.stamp @@ -0,0 +1 @@ +{"name":"Boulders","variations":[{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALCZ55iAYYIjjzZpiYhqszucpsvt8fr8tSAHbw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJw7x8DAcB6InwHxcyAGACFwA2s=","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJx7wcDAAAADpADp","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjYGRgYARiCSCWBGIAAWQANw==","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALDxTHBMcPxbo02aU0Sx2uwOp8vt8fr8FqQBVw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjY2RgYAdiOSCWB2IzIDYHYgAHYgC+","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJwzYGRgMARiDyD2BGIACOQA9w==","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":2,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":2},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzYmRgAAABLwBM","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzZmRgAAABMwBN","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1},{"map":{"compressionlevel":-1,"height":1,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzYWRgAAABNwBO","encoding":"base64","height":1,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":1,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/TilesetNature.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":1},"probability":1}]} \ No newline at end of file diff --git a/ZoFo/Content/MapData/TileStamps/stone buildings.stamp b/ZoFo/Content/MapData/TileStamps/stone buildings.stamp new file mode 100644 index 0000000..47d327e --- /dev/null +++ b/ZoFo/Content/MapData/TileStamps/stone buildings.stamp @@ -0,0 +1 @@ +{"name":"Stone Buildings","variations":[{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJwNwwcNACAMALBxLMCwwPGvjzZpiYhqszucpsvt8fr8EWABDw==","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJxjZWBgYANidiDmAGJJIJYCYmkglgFiXSDWA2J9IDYAYgAWQAE/","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":4,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":4},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjZGBg4AJibiCWBWI5IJYHYkMgNgJiYyAGAA+EAQ8=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":3,"infinite":false,"layers":[{"compression":"zlib","data":"eJzjYWBg4AViPiBWAGJFIFYCYhMgNgViMyAGABGgASo=","encoding":"base64","height":3,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1},{"map":{"compressionlevel":-1,"height":2,"infinite":false,"layers":[{"compression":"zlib","data":"eJzzY2Bg8AfiACBOAuJkIE4BYgAb1AIX","encoding":"base64","height":2,"id":1,"name":"","opacity":1,"type":"tilelayer","visible":true,"width":3,"x":0,"y":0}],"nextlayerid":2,"nextobjectid":1,"orientation":"orthogonal","renderorder":"right-down","tiledversion":"1.10.2","tileheight":16,"tilesets":[{"firstgid":1,"source":"../TileSets/tileset 1 collision.tsj"}],"tilewidth":16,"type":"map","version":"1.10","width":3},"probability":1}]} \ No newline at end of file diff --git a/ZoFo/Content/Textures/AnimationTextures/Zombie/zombie_spritesheet_v1.png b/ZoFo/Content/Textures/AnimationTextures/Zombie/zombie_spritesheet_v1.png new file mode 100644 index 0000000..d54b7ba Binary files /dev/null and b/ZoFo/Content/Textures/AnimationTextures/Zombie/zombie_spritesheet_v1.png differ diff --git a/ZoFo/Content/Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png b/ZoFo/Content/Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png new file mode 100644 index 0000000..c8ca02c Binary files /dev/null and b/ZoFo/Content/Textures/AnimationTextures/Zombie/zombie_spritesheet_v2.png differ diff --git a/ZoFo/Content/Textures/Animations/zombie_attack.animation b/ZoFo/Content/Textures/Animations/zombie_attack.animation new file mode 100644 index 0000000..b8129db --- /dev/null +++ b/ZoFo/Content/Textures/Animations/zombie_attack.animation @@ -0,0 +1 @@ +{"id":"zombie_attack","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":64,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":3,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/zombie_damaged.animation b/ZoFo/Content/Textures/Animations/zombie_damaged.animation new file mode 100644 index 0000000..6d0609d --- /dev/null +++ b/ZoFo/Content/Textures/Animations/zombie_damaged.animation @@ -0,0 +1 @@ +{"id":"zombie_damaged","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":128,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":1,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/zombie_death.animation b/ZoFo/Content/Textures/Animations/zombie_death.animation new file mode 100644 index 0000000..97aaa9c --- /dev/null +++ b/ZoFo/Content/Textures/Animations/zombie_death.animation @@ -0,0 +1 @@ +{"id":"zombie_death","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":96,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":9,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/zombie_idle.animation b/ZoFo/Content/Textures/Animations/zombie_idle.animation new file mode 100644 index 0000000..b96e1a3 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/zombie_idle.animation @@ -0,0 +1 @@ +{"id":"zombie_idle","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":0,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":60}],"textureFrameInterval":0,"framesCount":2,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/Content/Textures/Animations/zombie_walk.animation b/ZoFo/Content/Textures/Animations/zombie_walk.animation new file mode 100644 index 0000000..f6dbfa5 --- /dev/null +++ b/ZoFo/Content/Textures/Animations/zombie_walk.animation @@ -0,0 +1 @@ +{"id":"zombie_walk","textureName":"Textures/AnimationTextures/Zombie/zombie_spritesheet_v1","startSpriteRectangle":{"X":0,"Y":32,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":5}],"textureFrameInterval":0,"framesCount":8,"isCycle":true,"offset":"0, 0"} diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 7274abf..b91c6a2 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -24,6 +24,7 @@ using ZoFo.GameCore.GUI; using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; using ZoFo.GameCore.GameObjects.MapObjects.StopObjects; using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies; +using ZoFo.GameCore.Graphics; using Newtonsoft.Json.Linq; using Newtonsoft.Json; namespace ZoFo.GameCore @@ -166,8 +167,14 @@ namespace ZoFo.GameCore { var ent = FindEntityById(update.IdEntity); - ent.position = (update as UpdatePosition).NewPosition; - DebugHUD.Instance.Log("newPosition " + ent.position); + ent.position = (update as UpdatePosition).NewPosition; + } + else if (update is UpdateAnimation) + { + var ent = FindEntityById(update.IdEntity); + + ((ent as Entity).graphicsComponent as AnimatedGraphicsComponent).StartAnimation((update as UpdateAnimation).animationId); + DebugHUD.Instance.Log("new Animation " + ent.position); } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs index 4e9b972..108e4ba 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs @@ -12,5 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient public class UpdateAnimation : UpdateData { public UpdateAnimation() { UpdateType = "UpdateAnimation"; } + public string animationId { get; set; } } } diff --git a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs index 2bad778..20e779e 100644 --- a/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs +++ b/ZoFo/GameCore/GameObjects/Entities/EntittyForAnimationTests.cs @@ -14,11 +14,11 @@ namespace ZoFo.GameCore.GameObjects.Entities //public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List { "тут пишите название анимации" }, "сдублируйте " + - public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "player_idle_rotate_weapon" }, "player_idle_rotate_weapon"); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "zombie_idle" }, "zombie_idle"); public EntittyForAnimationTests(Vector2 position) : base(position) { - graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*12, 16 * 16); + graphicsComponent.ObjectDrawRectangle = new Rectangle(0,0,16*20, 16 * 20); position = new Vector2(10, 10); } diff --git a/ZoFo/GameCore/GameObjects/Entities/Entity.cs b/ZoFo/GameCore/GameObjects/Entities/Entity.cs index 456d8da..3b88ad8 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Entity.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Entity.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ZoFo.GameCore.GameManagers; using ZoFo.GameCore.GameManagers.CollisionManager; namespace ZoFo.GameCore.GameObjects.Entities @@ -36,6 +37,17 @@ namespace ZoFo.GameCore.GameObjects.Entities Update(); base.UpdateLogic(); } + + public void StartAnimation(string animationId) + { + (graphicsComponent as Graphics.AnimatedGraphicsComponent).StartAnimation(animationId); + AppManager.Instance.server.AddData(new GameManagers.NetworkManager.Updates.ServerToClient.UpdateAnimation() + { + animationId = animationId, + IdEntity = Id + }); + + } } } diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs index bc504f9..4e2ce66 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Enemies/Zombie.cs @@ -11,12 +11,12 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies { class Zombie : Enemy { - public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent("Textures/icons/8"); + public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List { "zombie_damaged","zombie_walk","zombie_idle","zombie_attack","zombie_death" }, "zombie_walk"); public Zombie(Vector2 position) : base(position) { health = 5; speed =2; - collisionComponent.stopRectangle = new Rectangle(0, 0, 100, 100); + collisionComponent.stopRectangle = new Rectangle(0, 0, 52, 100); graphicsComponent.ObjectDrawRectangle = new Rectangle(0, 0, 100, 100); } @@ -26,12 +26,17 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies 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) + if (Random.Shared.NextDouble() > 0.9) { - velocity = Vector2.Zero; + + StartAnimation("zombie_damaged"); } - //position.X += velocity.X*t; - //position.Y += velocity.Y * t; + if (Random.Shared.NextDouble() > 0.9) + { + + StartAnimation("zombie_idle"); + } + } } } diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs index 42d89c2..9ecec00 100644 --- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs +++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs @@ -40,6 +40,7 @@ public class Player : LivingEntity float t; public void MovementLogic() { + StartAnimation("player_look_down");//gslkjfsnblkjsdfnnlkjbn;zkcjnb;kkjnzx;cjkb;kzjxb;kSErgo //velocity.X = 3+(float)Math.Sin(t); t++; if (InputPlayerRotation.X > 0.9) diff --git a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs index bc2d8ff..b6b7d45 100644 --- a/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs +++ b/ZoFo/GameCore/Graphics/AnimatedGraphicsComponent.cs @@ -125,8 +125,9 @@ namespace ZoFo.GameCore.Graphics buildSourceRectangle(); SetInterval(); - } + } + public void StopAnimation() { currentFrame = 0;