// 销毁所有指定类型的道具 public void destroyAllItem(SCENE_ITEM type = SCENE_ITEM.SI_MAX) { // 销毁所有道具 if (type == SCENE_ITEM.SI_MAX) { foreach (var item in mItemList) { int count = item.Value.Count; for (int i = 0; i < count; ++i) { (item.Value)[i].destroy(); } } mItemList.Clear(); } // 销毁指定类型的道具 else { if (!mItemList.ContainsKey(type)) { return; } int count = mItemList[type].Count; for (int i = 0; i < count; ++i) { mItemList[type][i].destroy(); } mItemList[type].Clear(); } }
public SceneItemBase(string name, SCENE_ITEM type) : base(name) { mType = type; mSelfControlDestroy = false; }
public SceneItemBox(SCENE_ITEM type) : base("ItemBox", type) { mSelfControlDestroy = true; mExplodeParticleName = "ItemBox_SOmobileFX_galaxy_2"; mBoxModelNodeName = "DJ_xiangzi"; }
public SceneLandMine(SCENE_ITEM type) : base("Landmine", type) { mSelfControlDestroy = true; mExplodeParticleName = "Landmine_3D_FireHit_01"; mLandmineModelName = "DJ_dilei"; }
public SceneMissile(SCENE_ITEM type) : base("Missile", type) { mSelfControlDestroy = true; mExplodeParticleName = "Missile_M_3D_Hit_02"; mExplodeParticleName1 = "Missile_M_3D_EarthMagic_02"; mMissileModelName = "DJ_daodan"; }
// 延迟创建一个道具 public void createItemDelay(SCENE_ITEM type, float time, ItemParamBase param) { CommandSceneItemManagerCreateItem cmd = newCmd(out cmd, true, true); cmd.mParam = param; cmd.mItemType = type; pushDelayCommand(cmd, this, time); cmd.addStartCommandCallback(onCreateItemCmd, null); mDelayCreateList.Add(cmd.mAssignID); }
// 创建一个道具 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 T createItem <T>(SCENE_ITEM type, ItemParamBase param) where T : SceneItemBase { return(createItem(type, param) as T); }
//------------------------------------------------------------------------------------------------ protected void registeItem <T>(SCENE_ITEM type) where T : SceneItemBase { mItemRegisteList.Add(type, typeof(T)); }
public override void init() { base.init(); mParam = null; mItemType = SCENE_ITEM.SI_MAX; }
public override string showDebugInfo() { SCENE_ITEM type = mSceneItem != null?mSceneItem.getItemType() : SCENE_ITEM.SI_MAX; return(this.GetType().ToString() + " : type : " + type); }
public override void init() { base.init(); mAttackSource = SCENE_ITEM.SI_MAX; }