Add updates for interaction

This commit is contained in:
Mootfrost777 2024-08-17 00:59:41 +03:00
parent 4d6c32bd37
commit 540727f071
4 changed files with 22 additions and 2 deletions

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
{
public class UpdateGameObjectDeleted : UpdateData //Хранит объект, который надоу удлить
{
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; }
}
}

View file

@ -1,6 +1,6 @@
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
public class UpdateInteractionAvailable(int idEntity, bool isReady)
public class UpdateInteractionReady(int idEntity, bool isReady)
: UpdateData // при изменении возможности повзаимодействовать с объектом
{
public int IdEntity { get; set; } = idEntity;

View file

@ -20,6 +20,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
[JsonDerivedType(typeof(UpdateTileCreated))]
[JsonDerivedType(typeof(UpdateInput))]
[JsonDerivedType(typeof(UpdatePlayerExit))]
[JsonDerivedType(typeof(UpdateInteractionReady))]
[JsonDerivedType(typeof(UpdateInteraction))]
public class UpdateData
{

View file

@ -16,6 +16,11 @@ public class Interactable : Entity
private void ChangeInteraction(object sender, CollisionComponent e, bool isReady)
{
AppManager.Instance.server.AddData(new UpdateInteractionAvailable((sender as Player).Id, isReady));
AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady));
}
public void OnInteraction()
{
}
}