UpdateGotData

This commit is contained in:
rawer470 2024-08-20 17:58:02 +03:00
parent 784ae57519
commit 46b829826e
2 changed files with 28 additions and 21 deletions

View file

@ -201,8 +201,6 @@ namespace ZoFo.GameCore
if ((update as UpdateGameObjectCreated).GameObjectType == "Player")
{
created_gameObject = new Player((update as UpdateGameObjectCreated).position.GetVector2());
players.Add(created_gameObject as Player);
myPlayer = players[0];
gameObjects.Add(created_gameObject);
}
else
@ -245,11 +243,11 @@ namespace ZoFo.GameCore
DeleteObject(ent);
}
else if (update is UpdatePlayerParametrs)
else if (update is UpdatePlayerParametrs && update.IdEntity == myPlayer.Id) //aaa
{
UpdatePlayerHealth(update as UpdatePlayerParametrs);
}
else if (update is UpdateLoot)
else if (update is UpdateLoot && update.IdEntity == myPlayer.Id)//aaa
{
if ((update as UpdateLoot).quantity == 0)
{
@ -259,6 +257,13 @@ namespace ZoFo.GameCore
if (ent != null)
(ent as Player).lootData.AddLoot_Client((update as UpdateLoot).lootName, (update as UpdateLoot).quantity);
}
else if (update is UpdateCreatePlayer)
{
Vector2 pos = (update as UpdateCreatePlayer).position.GetVector2();
Player player = new Player(pos);
myPlayer = player;
players.Add(player);
}
}
public void UpdatePlayerHealth(UpdatePlayerParametrs update)

View file

@ -3,12 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateCreatePlayer : UpdateData
{
public int PlayerId { get; set; }
public SerializableVector2 position { get; set; }
public UpdateCreatePlayer()
{
isImportant = true;