Add deleteObject

This commit is contained in:
Mootfrost777 2024-08-17 18:21:15 +03:00
parent ec550ea093
commit 22ce0fd58f
3 changed files with 18 additions and 2 deletions

View file

@ -12,5 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
public class UpdateGameObjectDeleted : UpdateData
{
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; }
public string GameObjectType;
}
}

View file

@ -13,6 +13,8 @@ public class Collectable : Interactable
public override void OnInteraction(object sender, CollisionComponent e)
{
//
AppManager.Instance.server.AddData(new UpdateLoot());
AppManager.Instance.server.DeleteObject(this);
}
}

View file

@ -141,6 +141,19 @@ namespace ZoFo.GameCore
);
}
/// <summary>
/// Удаляет игровой объект
/// </summary>
/// <param name="gameObject"></param>
public void DeleteObject(GameObject gameObject)
{
gameObjects.Remove(gameObject);
AddData(new UpdateGameObjectDeleted()
{ GameObjectType = gameObject.GetType().Name}
);
}
}
#endregion
}