/// <summary> /// 移除采集物 /// </summary> /// <param name="id"></param> public void RemoveCollectionObject(int id) { CollectionObject o = GetCollectionObject(id); if (o != null) { o.CleanUp(); } CollectionObjects.Remove(id); }
/// <summary> /// 获取采集物 /// </summary> /// <param name="id"></param> /// <returns></returns> public CollectionObject GetCollectionObject(int id) { CollectionObject o = null; if (CollectionObjects.TryGetValue(id, out o)) { return(o); } return(o); }
public CollectionObject CreateCollectionObject(int id, uint excelId, UnityEngine.Vector3 pos) { CollectionObject o = new CollectionObject(id, excelId, pos); if (o != null) { if (CollectionObjects.ContainsKey(o.Id) == false) { CollectionObjects.Add(o.Id, o); } else { GameDebug.LogError("Create collection object error, id " + o.Id + " has already exist!!!"); } } return(o); }
/// <summary> /// 创建采集物 /// </summary> /// <param name="data"></param> /// <returns></returns> public CollectionObject CreateCollectionObject(Neptune.Collection data) { if (CollectionObjects.ContainsKey(data.Id) == true) { GameDebug.LogError("Create collection object error, id " + data.Id + " has already exist!!!"); return(null); } CollectionObject o = new CollectionObject(data); if (o != null) { if (CollectionObjects.ContainsKey(o.Id) == false) { CollectionObjects.Add(o.Id, o); } else { GameDebug.LogError("Add collection object error, id " + o.Id + " has already exist!!!"); } } return(o); }