public ED_ActorCom CreateActor(ActorCnf actorData) { ED_MapAreaCom areaCom = GetArea(); if (areaCom == null) { Debug.LogError("创建地图失败,没有区域!!!!"); return(null); } if (startUid > endUid) { Debug.LogError("此地图Uid已用完!!!!"); return(null); } ED_ActorCom actorCom = MapEditorDef.CreateActorGo(); actorCom.Init(CalcActorUid(), actorData.id, actorData.name, actorData.isPlayer, this); //预制体 if (actorData.prefab != null) { GameObject actorPrefab = (GameObject)PrefabUtility.InstantiatePrefab(actorData.prefab.GetObj()); MapEditorHelper.SetParent(actorPrefab.gameObject, actorCom.gameObject); } areaCom.AddActor(actorCom); return(actorCom); }
public ED_ActorPathCom CreatePath() { Transform pathTrans = transform.Find("Prefab/Path"); GameObject newGo = MapEditorHelper.CreateObj(pathTrans.gameObject, PathRoot.gameObject); ED_ActorPathCom pathCom = newGo.GetComponent <ED_ActorPathCom>(); pathCom.pointGo = transform.Find("Prefab/PathPoint").gameObject; return(newGo.GetComponent <ED_ActorPathCom>()); }
public void AddActor(ED_ActorCom actorCom) { MapEditorHelper.SetParent(actorCom.gameObject, ActorRoot.gameObject); }
public void AddTrigger(ED_MapTriggerCom triggerCom) { MapEditorHelper.SetParent(triggerCom.gameObject, TriggerRoot.gameObject); }
public ED_ActorPathPointCom CreatePoint() { GameObject newGo = MapEditorHelper.CreateObj(pointGo, gameObject); return(newGo.GetComponent <ED_ActorPathPointCom>()); }