// 延迟销毁一个道具,销毁时是强制销毁 public void destroyItemDelay(SceneItemBase item, float delayTime) { CommandSceneItemManagerDestroyItem cmd = newCmd(out cmd, true, true); cmd.mSceneItem = item; pushDelayCommand(cmd, this, delayTime); cmd.addStartCommandCallback(onDestroyItemCmd, null); mDelayDestroyList.Add(cmd.mAssignID); }
// 销毁一个道具,force为真则表示直接销毁,否则通知道具开始销毁 public void destroyItem(SceneItemBase item, bool force = false) { if (!item.getSelfControlDestroy() || force) { item.destroy(); mItemList[item.getItemType()].Remove(item); } else { item.notifyDestroy(); } }
// 创建一个道具 public SceneItemBase createItem(SCENE_ITEM type, ItemParamBase param) { if (!mItemRegisteList.ContainsKey(type)) { return(null); } SceneItemBase item = UnityUtility.createInstance <SceneItemBase>(mItemRegisteList[type], type); item.init(param); if (mItemList.ContainsKey(type)) { mItemList[type].Add(item); } else { List <SceneItemBase> itemList = new List <SceneItemBase>(); itemList.Add(item); mItemList.Add(type, itemList); } return(item); }
public override void init() { base.init(); mSceneItem = null; }