コード例 #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);
        }
コード例 #2
0
ファイル: ED_ActorCom.cs プロジェクト: ALunGame/LCFramework
        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>());
        }
コード例 #3
0
 public void AddActor(ED_ActorCom actorCom)
 {
     MapEditorHelper.SetParent(actorCom.gameObject, ActorRoot.gameObject);
 }
コード例 #4
0
 public void AddTrigger(ED_MapTriggerCom triggerCom)
 {
     MapEditorHelper.SetParent(triggerCom.gameObject, TriggerRoot.gameObject);
 }
コード例 #5
0
        public ED_ActorPathPointCom CreatePoint()
        {
            GameObject newGo = MapEditorHelper.CreateObj(pointGo, gameObject);

            return(newGo.GetComponent <ED_ActorPathPointCom>());
        }