Merge branch 'DevelopmentX' into TriggerZoneFeature
This commit is contained in:
commit
a62bbc16bb
30 changed files with 239 additions and 147 deletions
|
@ -124,54 +124,54 @@
|
||||||
#begin Textures/Animations/player_left_idle.animation
|
#begin Textures/Animations/player_left_idle.animation
|
||||||
/copy: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
|
#begin Textures/Animations/player_look_down.animation
|
||||||
/copy:Textures/Animations/player_look_down.animation
|
/copy:Textures/Animations/player_look_down.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_left_down_weapon.animation
|
#begin Textures/Animations/player_look_down_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_left_down_weapon.animation
|
/copy:Textures/Animations/player_look_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
|
#begin Textures/Animations/player_look_left.animation
|
||||||
/copy:Textures/Animations/player_look_left.animation
|
/copy:Textures/Animations/player_look_left.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_down_weapon.animation
|
#begin Textures/Animations/player_look_left_down.animation
|
||||||
/copy:Textures/Animations/player_look_right_down_weapon.animation
|
/copy:Textures/Animations/player_look_left_down.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_down.animation
|
#begin Textures/Animations/player_look_left_down_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_right_down.animation
|
/copy:Textures/Animations/player_look_left_down_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_up_weapon.animation
|
#begin Textures/Animations/player_look_left_up.animation
|
||||||
/copy:Textures/Animations/player_look_right_up_weapon.animation
|
/copy:Textures/Animations/player_look_left_up.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_up.animation
|
#begin Textures/Animations/player_look_left_up_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_right_up.animation
|
/copy:Textures/Animations/player_look_left_up_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right_weapon.animation
|
#begin Textures/Animations/player_look_left_weapon.animation
|
||||||
/copy:Textures/Animations/player_look_right_weapon.animation
|
/copy:Textures/Animations/player_look_left_weapon.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_right.animation
|
#begin Textures/Animations/player_look_right.animation
|
||||||
/copy:Textures/Animations/player_look_right.animation
|
/copy:Textures/Animations/player_look_right.animation
|
||||||
|
|
||||||
#begin Textures/Animations/player_look_up_weapon.animation
|
#begin Textures/Animations/player_look_right_down.animation
|
||||||
/copy:Textures/Animations/player_look_up_weapon.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
|
#begin Textures/Animations/player_look_up.animation
|
||||||
/copy: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
|
#begin Textures/Animations/player_right_idle.animation
|
||||||
/copy:Textures/Animations/player_right_idle.animation
|
/copy:Textures/Animations/player_right_idle.animation
|
||||||
|
|
||||||
|
@ -196,6 +196,21 @@
|
||||||
#begin Textures/Animations/testAnimationExample.animation
|
#begin Textures/Animations/testAnimationExample.animation
|
||||||
/copy: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
|
#begin Textures/AnimationTextures/Character/hr-level1_idle.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -280,6 +295,30 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/AnimationTextures/unicorn.png
|
/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
|
#begin Textures/GUI/background/base.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
"TileSets/TileSet 1.tsj",
|
"TileSets/TileSet 1.tsj",
|
||||||
"TileSets/WallSet.tsj"
|
"TileSets/WallSet.tsj"
|
||||||
],
|
],
|
||||||
|
"stampsFolder": "D:/C#/Я смотрел ваши ХАКАТОНЫ/ZoFo/ZoFo/Content/MapData/TileStamps",
|
||||||
"tileset.lastUsedFormat": "json",
|
"tileset.lastUsedFormat": "json",
|
||||||
"tileset.margin": 0,
|
"tileset.margin": 0,
|
||||||
"tileset.spacing": 0,
|
"tileset.spacing": 0,
|
||||||
|
|
1
ZoFo/Content/MapData/TileStamps/boulders.stamp
Normal file
1
ZoFo/Content/MapData/TileStamps/boulders.stamp
Normal file
File diff suppressed because one or more lines are too long
1
ZoFo/Content/MapData/TileStamps/stone buildings.stamp
Normal file
1
ZoFo/Content/MapData/TileStamps/stone buildings.stamp
Normal file
|
@ -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}]}
|
Binary file not shown.
After Width: | Height: | Size: 5 KiB |
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
1
ZoFo/Content/Textures/Animations/zombie_attack.animation
Normal file
1
ZoFo/Content/Textures/Animations/zombie_attack.animation
Normal file
|
@ -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"}
|
|
@ -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"}
|
1
ZoFo/Content/Textures/Animations/zombie_death.animation
Normal file
1
ZoFo/Content/Textures/Animations/zombie_death.animation
Normal file
|
@ -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"}
|
1
ZoFo/Content/Textures/Animations/zombie_idle.animation
Normal file
1
ZoFo/Content/Textures/Animations/zombie_idle.animation
Normal file
|
@ -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"}
|
1
ZoFo/Content/Textures/Animations/zombie_walk.animation
Normal file
1
ZoFo/Content/Textures/Animations/zombie_walk.animation
Normal file
|
@ -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"}
|
|
@ -24,6 +24,9 @@ using ZoFo.GameCore.GUI;
|
||||||
using ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables;
|
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;
|
using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies;
|
||||||
|
using ZoFo.GameCore.Graphics;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
namespace ZoFo.GameCore
|
namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
public class Client
|
public class Client
|
||||||
|
@ -54,13 +57,21 @@ namespace ZoFo.GameCore
|
||||||
|
|
||||||
public void OnDataSend(string data)
|
public void OnDataSend(string data)
|
||||||
{
|
{
|
||||||
List<UpdateData> updateDatas = JsonSerializer.Deserialize<List<UpdateData>>(data);
|
//List<UpdateTileCreated> updateDatas = JsonSerializer.Deserialize<List<UpdateTileCreated>>(data);
|
||||||
|
JArray jToken = JsonConvert.DeserializeObject(data) as JArray;
|
||||||
|
|
||||||
|
//string[] brands = jToken.SelectToken("")?.ToObject<string[]>();
|
||||||
|
foreach (JToken update in jToken.Children())
|
||||||
|
{
|
||||||
|
string a = update.ToString();
|
||||||
|
UpdateTileCreated u = System.Text.Json.JsonSerializer.Deserialize<UpdateTileCreated>(a);
|
||||||
|
}
|
||||||
// тут будет switch
|
// тут будет switch
|
||||||
AppManager.Instance.debugHud.Log(data);
|
AppManager.Instance.debugHud.Log(data);
|
||||||
foreach (var item in updateDatas)
|
//foreach (var item in updateDatas)
|
||||||
{
|
//{
|
||||||
GotData(item);
|
// GotData(item);
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void GameEndedUnexpectedly() { }
|
public void GameEndedUnexpectedly() { }
|
||||||
|
@ -112,22 +123,21 @@ namespace ZoFo.GameCore
|
||||||
mapObjects.Add(
|
mapObjects.Add(
|
||||||
new MapObject(
|
new MapObject(
|
||||||
(update as UpdateTileCreated).Position,
|
(update as UpdateTileCreated).Position,
|
||||||
(update as UpdateTileCreated).Size.ToVector2(),
|
(update as UpdateTileCreated).Size.GetPoint().ToVector2(),
|
||||||
(update as UpdateTileCreated).sourceRectangle,
|
(update as UpdateTileCreated).sourceRectangle.GetRectangle(),
|
||||||
(update as UpdateTileCreated).tileSetName
|
(update as UpdateTileCreated).tileSetName
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else if (update is UpdateStopObjectCreated)
|
//else if (update is UpdateStopObjectCreated)
|
||||||
{
|
//{
|
||||||
stopObjects.Add(
|
// stopObjects.Add(
|
||||||
new StopObject(
|
// new StopObject(
|
||||||
(update as UpdateStopObjectCreated).Position,
|
// (update as UpdateStopObjectCreated).Position,
|
||||||
(update as UpdateStopObjectCreated).Size.ToVector2(),
|
// (update as UpdateStopObjectCreated).Size.ToVector2(),
|
||||||
(update as UpdateStopObjectCreated).sourceRectangle,
|
// (update as UpdateStopObjectCreated).sourceRectangle,
|
||||||
(update as UpdateStopObjectCreated).tileSetName,
|
// (update as UpdateStopObjectCreated).tileSetName
|
||||||
(update as UpdateStopObjectCreated).collisions
|
// ));
|
||||||
));
|
//}
|
||||||
}
|
|
||||||
else if (update is UpdateGameObjectCreated)
|
else if (update is UpdateGameObjectCreated)
|
||||||
{
|
{
|
||||||
GameObject created_gameObject;
|
GameObject created_gameObject;
|
||||||
|
@ -158,7 +168,13 @@ namespace ZoFo.GameCore
|
||||||
var ent = FindEntityById(update.IdEntity);
|
var ent = FindEntityById(update.IdEntity);
|
||||||
|
|
||||||
ent.position = (update as UpdatePosition).NewPosition;
|
ent.position = (update as UpdatePosition).NewPosition;
|
||||||
//DebugHUD.Instance.Log("newPosition " + ent.position);
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,13 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
PropertyNameCaseInsensitive = true
|
PropertyNameCaseInsensitive = true
|
||||||
};
|
};
|
||||||
TileMap tileMap =
|
TileMap tileMap =
|
||||||
JsonSerializer.Deserialize<TileMap>(File.ReadAllText(string.Format(_templatePath, mapName)), options);
|
JsonSerializer.Deserialize<TileMap>(File.ReadAllText(Path.Combine(AppContext.BaseDirectory, string.Format(_templatePath, mapName))), options);
|
||||||
|
|
||||||
// Загрузка TileSet-ов по TileSetInfo
|
// Загрузка TileSet-ов по TileSetInfo
|
||||||
List<TileSet> tileSets = new List<TileSet>();
|
List<TileSet> tileSets = new List<TileSet>();
|
||||||
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
|
foreach (TileSetInfo tileSetInfo in tileMap.TileSets)
|
||||||
{
|
{
|
||||||
TileSet tileSet = LoadTileSet(Path.Combine("Content", "MapData", "TileMaps", tileSetInfo.Source));
|
TileSet tileSet = LoadTileSet(Path.Combine(AppContext.BaseDirectory, "Content", "MapData", "TileMaps", tileSetInfo.Source));
|
||||||
tileSet.FirstGid = tileSetInfo.FirstGid;
|
tileSet.FirstGid = tileSetInfo.FirstGid;
|
||||||
tileSets.Add(tileSet);
|
tileSets.Add(tileSet);
|
||||||
}
|
}
|
||||||
|
@ -75,14 +75,15 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
(i / chunk.Height) * tileMap.TileHeight + chunk.Y * tileMap.TileHeight);
|
(i / chunk.Height) * tileMap.TileHeight + chunk.Y * tileMap.TileHeight);
|
||||||
|
|
||||||
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
|
Tile tile = tileSet.Tiles[number]; // По факту может быть StopObjectom, но на уровне Tiled это все в первую очередь Tile
|
||||||
|
string textureName = Path.Combine(AppContext.BaseDirectory, "Content", "Textures", "TileSetImages",
|
||||||
|
Path.GetFileName(tileSet.Image).Replace(".png", ""));
|
||||||
switch (tile.Type)
|
switch (tile.Type)
|
||||||
{
|
{
|
||||||
case "Tile":
|
case "Tile":
|
||||||
AppManager.Instance.server.RegisterGameObject(new MapObject(position,
|
AppManager.Instance.server.RegisterGameObject(new MapObject(position,
|
||||||
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
||||||
sourceRectangle,
|
sourceRectangle,
|
||||||
"Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", "")));
|
textureName));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "StopObject":
|
case "StopObject":
|
||||||
|
@ -91,7 +92,7 @@ namespace ZoFo.GameCore.GameManagers.MapManager
|
||||||
AppManager.Instance.server.RegisterGameObject(new StopObject(position,
|
AppManager.Instance.server.RegisterGameObject(new StopObject(position,
|
||||||
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
new Vector2(tileSet.TileWidth, tileSet.TileHeight),
|
||||||
sourceRectangle,
|
sourceRectangle,
|
||||||
"Textures/TileSetImages/" + Path.GetFileName(tileSet.Image).Replace(".png", ""),
|
textureName,
|
||||||
collisionRectangles.ToArray()));
|
collisionRectangles.ToArray()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
{
|
{
|
||||||
while(socket.Connected)
|
while(socket.Connected)
|
||||||
{
|
{
|
||||||
byte[] bytes = new byte[2048];
|
byte[] bytes = new byte[65535];
|
||||||
var countAnsw = socket.Receive(bytes); //Вылетает если кто то закрыл
|
var countAnsw = socket.Receive(bytes, SocketFlags.Partial); //Вылетает если кто то закрыл
|
||||||
string update = Encoding.UTF8.GetString(bytes, 0, countAnsw); // обновление отосланные сервером
|
string update = Encoding.UTF8.GetString(bytes, 0, countAnsw); // обновление отосланные сервером
|
||||||
GetDataSent(update);
|
GetDataSent(update);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
||||||
|
{
|
||||||
|
public class SerializablePoint
|
||||||
|
{
|
||||||
|
public int X;
|
||||||
|
public int Y;
|
||||||
|
|
||||||
|
public SerializablePoint(Point point) { X = point.X; Y = point.Y;}
|
||||||
|
public Point GetPoint() { return new Point(X, Y);}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
[JsonSerializable(typeof(SerializableRectangle))]
|
||||||
|
public class SerializableRectangle
|
||||||
|
{
|
||||||
|
public SerializablePoint Size { get; set; }
|
||||||
|
public SerializablePoint Location { get; set; }
|
||||||
|
public int X { get; set; }
|
||||||
|
public int Y { get; set; }
|
||||||
|
public SerializableRectangle()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SerializableRectangle(Rectangle rectangle) { X = rectangle.X; Y = rectangle.Y;
|
||||||
|
Size = new SerializablePoint(rectangle.Size); Location = new SerializablePoint(rectangle.Location); }
|
||||||
|
|
||||||
|
public Rectangle GetRectangle()
|
||||||
|
{
|
||||||
|
return new Rectangle() { X = X, Y = Y, Size = Size.GetPoint(), Location = Location.GetPoint() };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,7 +53,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
public static IPAddress GetIp()
|
public static IPAddress GetIp()
|
||||||
{
|
{
|
||||||
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
string hostName = Dns.GetHostName(); // Retrive the Name of HOST
|
||||||
var ipList = Dns.GetHostByName(hostName).AddressList;
|
var ipList = Dns.GetHostEntry(hostName).AddressList;
|
||||||
|
|
||||||
foreach (var ip in ipList)
|
foreach (var ip in ipList)
|
||||||
{
|
{
|
||||||
|
@ -80,15 +80,15 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
//Что это?
|
//Что это?
|
||||||
//по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT
|
//по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT
|
||||||
List<UpdateData> datasToSend = new List<UpdateData>();
|
List<UpdateData> datasToSend = new List<UpdateData>();
|
||||||
for (int i = 0; i < 5 && i<updates.Count; i++)
|
for (int i = 0; i < 200 && i<updates.Count; i++)
|
||||||
datasToSend.Add(updates[i]);
|
datasToSend.Add(updates[i]);
|
||||||
string data = JsonSerializer.Serialize(datasToSend);
|
string data = JsonSerializer.Serialize(datasToSend);
|
||||||
var databytes = Encoding.UTF8.GetBytes(data);
|
var databytes = Encoding.UTF8.GetBytes(data);
|
||||||
foreach (var item in clients)
|
foreach (Socket socket in clients)
|
||||||
{
|
{
|
||||||
item.SendAsync(databytes);
|
clients[0].SendAsync(databytes, SocketFlags.Partial);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 5 && i< datasToSend.Count; i++)
|
for (int i = 0; i < 200 && i< datasToSend.Count; i++)
|
||||||
updates.RemoveAt(0);
|
updates.RemoveAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
Socket client = (Socket)socket;
|
Socket client = (Socket)socket;
|
||||||
while (client.Connected)
|
while (client.Connected)
|
||||||
{
|
{
|
||||||
var buff = new byte[1024];
|
var buff = new byte[65535];
|
||||||
var answ = client.Receive(buff);
|
var answ = client.Receive(buff, SocketFlags.Partial);
|
||||||
string response = Encoding.UTF8.GetString(buff, 0, answ);
|
string response = Encoding.UTF8.GetString(buff, 0, answ);
|
||||||
GetDataSend(response);
|
GetDataSend(response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
public class UpdateAnimation : UpdateData
|
public class UpdateAnimation : UpdateData
|
||||||
{
|
{
|
||||||
public UpdateAnimation() { UpdateType = "UpdateAnimation"; }
|
public UpdateAnimation() { UpdateType = "UpdateAnimation"; }
|
||||||
|
public string animationId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
|
@ -19,21 +20,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
||||||
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; }
|
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; }
|
||||||
public Texture2D TextureTile { get; set; }
|
public Texture2D TextureTile { get; set; }
|
||||||
public Vector2 Position { get; set; }
|
public Vector2 Position { get; set; }
|
||||||
public Point Size { get; set; }
|
public SerializablePoint Size { get; set; }
|
||||||
public Rectangle sourceRectangle { get; set; }
|
public SerializableRectangle sourceRectangle { get; set; }
|
||||||
public string tileSetName { get; set; }
|
public string tileSetName { get; set; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// При создании тайла TODO move to another file
|
|
||||||
/// </summary>
|
|
||||||
public class UpdateStopObjectCreated : UpdateData
|
|
||||||
{
|
|
||||||
public UpdateStopObjectCreated() { UpdateType = "UpdateStopObjectCreated"; }
|
|
||||||
public Texture2D TextureTile { get; set; }
|
|
||||||
public Vector2 Position { get; set; }
|
|
||||||
public Point Size { get; set; }
|
|
||||||
public Rectangle sourceRectangle { get; set; }
|
|
||||||
public string tileSetName { get; set; }
|
|
||||||
public Rectangle[] collisions { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,7 @@ namespace ZoFo.GameCore.GameManagers
|
||||||
{
|
{
|
||||||
//List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/");
|
//List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/");
|
||||||
|
|
||||||
string a = Path.Combine("Content", "sounds");
|
string[] k = Directory.GetFiles(Path.Combine(AppContext.BaseDirectory, "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
|
||||||
string[] k;
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
||||||
{
|
|
||||||
k = Directory.GetFiles(Path.Combine("bin", "Debug", "net8.0", "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
k = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "Content", "sounds")).Where(x => x.EndsWith("xnb")).ToArray();
|
|
||||||
}
|
|
||||||
if (k.Length > 0)
|
if (k.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ namespace ZoFo.GameCore.GameObjects.Entities
|
||||||
//public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List<string> { "тут пишите название анимации" }, "сдублируйте " +
|
//public override GraphicsComponent graphicsComponent { get; } = new GraphicsComponent(new List<string> { "тут пишите название анимации" }, "сдублируйте " +
|
||||||
|
|
||||||
|
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "player_idle_rotate_weapon" }, "player_idle_rotate_weapon");
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_idle" }, "zombie_idle");
|
||||||
|
|
||||||
public EntittyForAnimationTests(Vector2 position) : base(position)
|
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);
|
position = new Vector2(10, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
using ZoFo.GameCore.GameManagers.CollisionManager;
|
using ZoFo.GameCore.GameManagers.CollisionManager;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GameObjects.Entities
|
namespace ZoFo.GameCore.GameObjects.Entities
|
||||||
|
@ -36,6 +37,17 @@ namespace ZoFo.GameCore.GameObjects.Entities
|
||||||
Update();
|
Update();
|
||||||
base.UpdateLogic();
|
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
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Enemies
|
||||||
{
|
{
|
||||||
class Zombie : Enemy
|
class Zombie : Enemy
|
||||||
{
|
{
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent("Textures/icons/8");
|
public override GraphicsComponent graphicsComponent { get; } = new AnimatedGraphicsComponent(new List<string> { "zombie_damaged","zombie_walk","zombie_idle","zombie_attack","zombie_death" }, "zombie_walk");
|
||||||
public Zombie(Vector2 position) : base(position)
|
public Zombie(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
health = 5;
|
health = 5;
|
||||||
speed =2;
|
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);
|
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
|
AppManager.Instance.server.players[0].position - position
|
||||||
);
|
);
|
||||||
velocity=new Vector2(duration.X * speed, duration.Y*speed);
|
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;
|
if (Random.Shared.NextDouble() > 0.9)
|
||||||
//position.Y += velocity.Y * t;
|
{
|
||||||
|
|
||||||
|
StartAnimation("zombie_idle");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ public class Player : LivingEntity
|
||||||
public void MovementLogic()
|
public void MovementLogic()
|
||||||
{
|
{
|
||||||
IsTryingToShoot = true;
|
IsTryingToShoot = true;
|
||||||
|
StartAnimation("player_look_down");//gslkjfsnblkjsdfnnlkjbn;zkcjnb;kkjnzx;cjkb;kzjxb;kSErgo
|
||||||
//velocity.X = 3+(float)Math.Sin(t);
|
//velocity.X = 3+(float)Math.Sin(t);
|
||||||
t++;
|
t++;
|
||||||
if (InputPlayerRotation.X > 0.9)
|
if (InputPlayerRotation.X > 0.9)
|
||||||
|
|
|
@ -125,6 +125,7 @@ namespace ZoFo.GameCore.Graphics
|
||||||
|
|
||||||
buildSourceRectangle();
|
buildSourceRectangle();
|
||||||
SetInterval();
|
SetInterval();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopAnimation()
|
public void StopAnimation()
|
||||||
|
@ -163,6 +164,7 @@ namespace ZoFo.GameCore.Graphics
|
||||||
}
|
}
|
||||||
|
|
||||||
interval--;
|
interval--;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch)
|
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch)
|
||||||
|
@ -187,8 +189,9 @@ namespace ZoFo.GameCore.Graphics
|
||||||
destinationRectangle.Y -= CameraPosition.Y;
|
destinationRectangle.Y -= CameraPosition.Y;
|
||||||
|
|
||||||
destinationRectangle = Scaling(destinationRectangle);
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture,
|
|
||||||
destinationRectangle, sourceRectangle, Color.White);
|
_spriteBatch.Draw(texture, destinationRectangle, sourceRectangle, Color.White, Rotation,
|
||||||
|
Vector2.Zero, Flip, 0);
|
||||||
}
|
}
|
||||||
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
|
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +216,8 @@ namespace ZoFo.GameCore.Graphics
|
||||||
|
|
||||||
destinationRectangle = Scaling(destinationRectangle);
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture,
|
_spriteBatch.Draw(texture,
|
||||||
destinationRectangle, sourceRectangle, Color.White);
|
destinationRectangle, sourceRectangle, Color.White, 0,
|
||||||
|
Vector2.Zero, Flip, 0);
|
||||||
}
|
}
|
||||||
private void buildSourceRectangle()
|
private void buildSourceRectangle()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace ZoFo.GameCore.Graphics
|
||||||
public void LoadAnimations()
|
public void LoadAnimations()
|
||||||
{
|
{
|
||||||
Animations = new List<AnimationContainer>();
|
Animations = new List<AnimationContainer>();
|
||||||
string[] animationFilesNames = Directory.GetFiles("Content/Textures/Animations");
|
string[] animationFilesNames = Directory.GetFiles(Path.Combine(AppContext.BaseDirectory, "Content", "Textures", "Animations"));
|
||||||
|
|
||||||
StreamReader reader;
|
StreamReader reader;
|
||||||
foreach (var fileName in animationFilesNames)
|
foreach (var fileName in animationFilesNames)
|
||||||
|
|
|
@ -9,6 +9,9 @@ public abstract class GraphicsComponent
|
||||||
public static int scaling = 1;
|
public static int scaling = 1;
|
||||||
public string mainTextureName;//TODO костыль - пофиксить
|
public string mainTextureName;//TODO костыль - пофиксить
|
||||||
|
|
||||||
|
public SpriteEffects Flip = SpriteEffects.None;
|
||||||
|
public float Rotation;
|
||||||
|
|
||||||
public abstract void LoadContent();
|
public abstract void LoadContent();
|
||||||
public abstract void Update();
|
public abstract void Update();
|
||||||
public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch);
|
public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch);
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
|
|
||||||
namespace ZoFo.GameCore.Graphics;
|
|
||||||
|
|
||||||
public interface IGraphicsComponent
|
|
||||||
{
|
|
||||||
public Rectangle ObjectDrawRectangle { get; set; }
|
|
||||||
public static int scaling = 1;
|
|
||||||
public string mainTextureName { get; set; }//TODO костыль - пофиксить
|
|
||||||
|
|
||||||
public abstract void LoadContent();
|
|
||||||
public abstract void Update();
|
|
||||||
public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch);
|
|
||||||
public abstract void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle);
|
|
||||||
}
|
|
|
@ -8,7 +8,6 @@ using ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.Graphics
|
namespace ZoFo.GameCore.Graphics
|
||||||
{
|
{
|
||||||
|
|
||||||
public class StaticGraphicsComponent : GraphicsComponent
|
public class StaticGraphicsComponent : GraphicsComponent
|
||||||
{
|
{
|
||||||
private Texture2D texture;
|
private Texture2D texture;
|
||||||
|
@ -53,19 +52,23 @@ namespace ZoFo.GameCore.Graphics
|
||||||
destinationRectangle.X -= CameraPosition.X;
|
destinationRectangle.X -= CameraPosition.X;
|
||||||
destinationRectangle.Y -= CameraPosition.Y;
|
destinationRectangle.Y -= CameraPosition.Y;
|
||||||
destinationRectangle = Scaling(destinationRectangle);
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture, destinationRectangle, Color.White);
|
_spriteBatch.Draw(texture, destinationRectangle, texture.Bounds, Color.White, Rotation,
|
||||||
|
Vector2.Zero, Flip, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
|
public override void Draw(Rectangle destinationRectangle, SpriteBatch _spriteBatch, Rectangle sourceRectangle)
|
||||||
{
|
{
|
||||||
//DebugHUD.Instance.Log("draw ");
|
//DebugHUD.Instance.Log("draw ");
|
||||||
|
// Uncomment to go brrrr
|
||||||
|
//Rotation = new Random().Next(1, 365);
|
||||||
|
|
||||||
destinationRectangle.X -= CameraPosition.X;
|
destinationRectangle.X -= CameraPosition.X;
|
||||||
destinationRectangle.Y -= CameraPosition.Y;
|
destinationRectangle.Y -= CameraPosition.Y;
|
||||||
|
|
||||||
destinationRectangle = Scaling(destinationRectangle);
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture,
|
_spriteBatch.Draw(texture,
|
||||||
destinationRectangle, sourceRectangle, Color.White);
|
destinationRectangle, sourceRectangle, Color.White, Rotation,
|
||||||
|
Vector2.Zero, Flip, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@ using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
|
||||||
using ZoFo.GameCore.GameObjects.MapObjects;
|
using ZoFo.GameCore.GameObjects.MapObjects;
|
||||||
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
using ZoFo.GameCore.GameObjects.MapObjects.StopObjects;
|
||||||
using ZoFo.GameCore.Graphics;
|
using ZoFo.GameCore.Graphics;
|
||||||
|
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
|
||||||
|
|
||||||
namespace ZoFo.GameCore
|
namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
|
@ -172,30 +173,13 @@ namespace ZoFo.GameCore
|
||||||
{
|
{
|
||||||
|
|
||||||
gameObjects.Add(gameObject);
|
gameObjects.Add(gameObject);
|
||||||
if (gameObject is StopObject)
|
|
||||||
{
|
|
||||||
AddData(new UpdateStopObjectCreated()
|
|
||||||
{
|
|
||||||
Position = (gameObject as StopObject).position,
|
|
||||||
sourceRectangle = (gameObject as StopObject).sourceRectangle,
|
|
||||||
Size = (gameObject as StopObject).graphicsComponent.ObjectDrawRectangle.Size,
|
|
||||||
collisions = (gameObject as StopObject).collisionComponents.Select(x=>x.stopRectangle).ToArray(),
|
|
||||||
tileSetName = ((gameObject as StopObject).graphicsComponent as StaticGraphicsComponent)._textureName
|
|
||||||
});//TODO
|
|
||||||
foreach (var item in (gameObject as StopObject).collisionComponents)
|
|
||||||
{
|
|
||||||
collisionManager.Register(item);
|
|
||||||
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (gameObject is MapObject)
|
if (gameObject is MapObject)
|
||||||
{
|
{
|
||||||
AddData(new UpdateTileCreated()
|
AddData(new UpdateTileCreated()
|
||||||
{
|
{
|
||||||
Position = (gameObject as MapObject).position,
|
Position = (gameObject as MapObject).position,
|
||||||
sourceRectangle = (gameObject as MapObject).sourceRectangle,
|
sourceRectangle = new SerializableRectangle((gameObject as MapObject).sourceRectangle),
|
||||||
Size = (gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size,
|
Size = new SerializablePoint((gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size),
|
||||||
tileSetName = ((gameObject as MapObject).graphicsComponent as StaticGraphicsComponent)._textureName
|
tileSetName = ((gameObject as MapObject).graphicsComponent as StaticGraphicsComponent)._textureName
|
||||||
});//TODO
|
});//TODO
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue