当拾取物品后,添加物品到背包栏,通过回调函数来销毁 场景中的 掉落在场景当中 刚才被拾取的 物品 实体。
Inventory.cs
...
//回调函数
public delegate void callback_pickUpItem(int a);
///当 把物品添加到物品栏之后
public void addItemToInventory(ItemDropData itemDropData,callback_pickUpItem callback_)
{
callback_(0);
}//
...
ItemPickUp.cs
...
/// <summary>
/// 掉落 物品 数据
/// </summary>
private ItemDropData dropData = null;
...
Inventory cb_Inventory = new Inventory();
/// <summary>
/// 拾取动画播放完毕,播放 拾取音效,并且添加物品到背包中。
/// </summary>
public void addItemIntoInventory()
{
if (uIInventoryManager != null
//&& uIInventoryManager.canPickUpItem(dropData)
)
{
//uIInventoryManager.pickUpItem(this);
//当添加完 物品到 物品栏 之后,销毁场景中 的拾取物品
cb_Inventory.addItemToInventory(dropData, destoryItemDrop);
}//
}//
private void destoryItemDrop(int i)
{
Debug.Log(" destoryItemDrop ");
//Destroy(this);
}//
...
本文地址:https://blog.csdn.net/BuladeMian/article/details/109262556
您可能感兴趣的文章:
- RabbitMQ单机集群搭建出现Error: unable to perform an operation on node 'rabbit1@ClusterNode1'
- DotNetty在window和linux下的性能对比
- .net core 图片合并,图片水印,等比例缩小,SixLabors.ImageSharp
- WPF简单的分页控件实现
- ASP.NET中实现中文简/繁体自动转换的类
- 前后端分离,https站点无法通过Ajax访问http资源(Mixed Content,The page at 'https://xxx.com' was loaded over HTTPS)
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论