UpdateGotData
This commit is contained in:
parent
784ae57519
commit
46b829826e
2 changed files with 28 additions and 21 deletions
|
@ -133,10 +133,10 @@ namespace ZoFo.GameCore
|
|||
networkManager.SendData();//set to ticks
|
||||
if (myPlayer != null)
|
||||
GraphicsComponent.CameraPosition =
|
||||
((GraphicsComponent.CameraPosition.ToVector2() *0.9f +
|
||||
((GraphicsComponent.CameraPosition.ToVector2() * 0.9f +
|
||||
(myPlayer.position + myPlayer.graphicsComponent.ObjectDrawRectangle.Size.ToVector2() / 2 - AppManager.Instance.CurentScreenResolution.ToVector2() / (2 * GraphicsComponent.scaling)
|
||||
) * 0.1f
|
||||
) )
|
||||
))
|
||||
.ToPoint();
|
||||
}
|
||||
public void SendData()
|
||||
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue