Add deleteObject
This commit is contained in:
parent
ec550ea093
commit
22ce0fd58f
3 changed files with 18 additions and 2 deletions
|
@ -12,5 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
|||
public class UpdateGameObjectDeleted : UpdateData
|
||||
{
|
||||
public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; }
|
||||
public string GameObjectType;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,10 +137,23 @@ namespace ZoFo.GameCore
|
|||
}
|
||||
|
||||
AddData(new UpdateGameObjectCreated()
|
||||
{ GameObjectType = gameObject.GetType().Name }
|
||||
{ GameObjectType = gameObject.GetType().Name }
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаляет игровой объект
|
||||
/// </summary>
|
||||
/// <param name="gameObject"></param>
|
||||
public void DeleteObject(GameObject gameObject)
|
||||
{
|
||||
gameObjects.Remove(gameObject);
|
||||
AddData(new UpdateGameObjectDeleted()
|
||||
{ GameObjectType = gameObject.GetType().Name}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue