Example #1
0
 //创建下一个房间,返回房间的ID,并且要关闭下个房间的BoxCollider,防止玩家在房间接缝处来回跑会出bug,上个房间销毁后才会激活下个房间的BoxCollider(在RoomController中处理)
 public int CreateNextRoom()
 {
     MobGroup newmg = new MobGroup(mg.GetMobPrefabNormal(), mg.GetMobPrefabSmall(), mg.GetMobPrefabLarge(), POEStatics.MobPopulation, this.nextroomposition, Tools.GetRandomMobGroupType());
     Room nextroom = new Room(this.roomid + 1, StaticRoompPefab, this.nextroomposition, newmg);
     this.Open(this.directionToNextRoom, true);
     nextroom.Open(Tools.Opposite(this.directionToNextRoom), true);
     nextroom.bc.enabled = false;
     return nextroom.roomid;
 }
Example #2
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService wfes = provider.GetService(
                typeof(IWindowsFormsEditorService)) as
                                              IWindowsFormsEditorService;

            if (wfes != null)
            {
                MobGroup mg = new MobGroup();
                mg._wfes = wfes;

                wfes.ShowDialog(mg);
                value = "<Collection...>";
            }
            return(value);
        }
Example #3
0
 //构造函数,只有第一个房子用得到,后面用CreateNextRoom就行了
 public Room(int id, GameObject roomprefab, Vector3 p, MobGroup mobgroup)
 {
     if (StaticRoompPefab == null)
     {
         StaticRoompPefab = roomprefab;
     }
     this.mg = mobgroup;
     roomid = id;
     this.roomgo = GameObject.Instantiate(StaticRoompPefab, p, Quaternion.identity);  //第一次调用的时候,nextroomposition为Vector3.Zero,后面的房间才需要计算
     roomgo.name += " - " + roomid.ToString();
     rc = roomgo.GetComponent<RoomController>();
     nms = rc.Floor.GetComponent<NavMeshSurface>();
     bc = roomgo.GetComponent<BoxCollider>();
     bc.enabled = true;
     rc.thisroomid = id;
     this.CloseAll();
     nms.BuildNavMesh();
     nms.UpdateNavMesh(nms.navMeshData);
     this.directionToNextRoom = CalculateNextRoomDirection();
     this.nextroomposition = CalculateNextRoomPosition();
     roomdic.Add(this.roomid, this);
 }