Esempio n. 1
0
        private void ObjectCrossToMap(GameObject OBJ, Direction dir)
        {
            GameMap Map = GetMap(OBJ.MapEID);
            //LOG(OBJ.Name + " 尝试从 "+Map.Name+" 向 "+dir + " 越地图边界");
            ExistenceID NewMapID = ExistenceID.Null;

            if (Map != null)
            {
                switch (dir)
                {
                case Direction.EAST:
                    NewMapID = Map.EastMap;
                    break;

                case Direction.SOUTH:
                    NewMapID = Map.SouthMap;
                    break;

                case Direction.WEST:
                    NewMapID = Map.WestMap;
                    break;

                case Direction.NORTH:
                    NewMapID = Map.NorthMap;
                    break;
                }
                GameMap NewMap = GetMap(NewMapID);
                if (NewMap != null)
                {
                    Map.gObjects.Remove(OBJ);
                    switch (dir)
                    {
                    case Direction.EAST:
                        OBJ.X = 0;
                        break;

                    case Direction.SOUTH:
                        OBJ.Y = 0;
                        break;

                    case Direction.WEST:
                        OBJ.X = (byte)(G.MapSize - 1);
                        break;

                    case Direction.NORTH:
                        OBJ.Y = (byte)(G.MapSize - 1);
                        break;
                    }
                    OBJ.MapEID = NewMap.EID;
                    NewMap.gObjects.Add(OBJ);
                    //LOG(OBJ.Name + " 越地图边界到达 "+NewMap.Name+" (X:" + OBJ.X + ",Y:" + OBJ.Y + ")");
                }
                else
                {
                    //LOG(OBJ.Name + " 越地图边界失败,前方没有地图。");
                }
                OBJ.Status = ObjectStatus.IDEL;
            }
        }
Esempio n. 2
0
        internal void RemoveObjectFromMap(GameObject Obj, ExistenceID MapEID)
        {
            GameMap map = GetMap(MapEID);

            if (map != null)
            {
                map.RemoveObject(Obj);
                Obj.LOG(Obj.Name + " 离开了……");
            }
        }
Esempio n. 3
0
        internal bool AddObjectIntoMap(GameObject Obj, ExistenceID MapEID)
        {
            GameMap map = GetMap(MapEID);

            if (map == null)
            {
                map = gMaps[0];
            }

            map.AddObject(Obj);
            return(true);
        }
Esempio n. 4
0
 private GameMap GetMap(ExistenceID mapEID)
 {
     return(gMaps.Find(x => x.EID.Equals(mapEID)));
 }