Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public void AddActor(ED_ActorCom actorCom)
 {
     MapEditorHelper.SetParent(actorCom.gameObject, ActorRoot.gameObject);
 }
Exemplo n.º 3
0
 public void AddTrigger(ED_MapTriggerCom triggerCom)
 {
     MapEditorHelper.SetParent(triggerCom.gameObject, TriggerRoot.gameObject);
 }