57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using MMOserver.Game.Channel.Maps.ZoneData;
|
|
using MMOserver.Game.Engine;
|
|
|
|
namespace MMOserver.Game.Channel.Maps;
|
|
|
|
/*
|
|
* 마을(로비)
|
|
*/
|
|
public class Robby : AMap
|
|
{
|
|
private readonly EnumMap enumMap;
|
|
private readonly int mapId;
|
|
|
|
public Robby(int mapId, EnumMap enumMap = EnumMap.ROBBY)
|
|
{
|
|
this.enumMap = enumMap;
|
|
this.mapId = mapId;
|
|
}
|
|
|
|
public override EnumMap GetMapType()
|
|
{
|
|
return enumMap;
|
|
}
|
|
|
|
public override int GetMapId()
|
|
{
|
|
return mapId;
|
|
}
|
|
|
|
public override (int, int, int, int) GetNearZone(int zoneId, Vector3? position)
|
|
{
|
|
if (position == null || zoneId < 0)
|
|
{
|
|
return base.GetNearZone(zoneId, position);
|
|
}
|
|
|
|
Zone? zone = GetZone(zoneId);
|
|
if (zone == null)
|
|
{
|
|
return base.GetNearZone(zoneId, position);
|
|
}
|
|
|
|
int quadrant = zone.GetFourquadrant(position);
|
|
int row = zone.Row;
|
|
int col = zone.Col;
|
|
|
|
return quadrant switch
|
|
{
|
|
1 => (zoneId, ZoneAt(row - 1, col), ZoneAt(row, col - 1), ZoneAt(row - 1, col - 1)), // 위, 좌, 좌상단
|
|
2 => (zoneId, ZoneAt(row - 1, col), ZoneAt(row, col + 1), ZoneAt(row - 1, col + 1)), // 위, 우, 우상단
|
|
3 => (zoneId, ZoneAt(row + 1, col), ZoneAt(row, col + 1), ZoneAt(row + 1, col + 1)), // 아래, 우, 우하단
|
|
4 => (zoneId, ZoneAt(row + 1, col), ZoneAt(row, col - 1), ZoneAt(row + 1, col - 1)), // 아래, 좌, 좌하단
|
|
_ => base.GetNearZone(zoneId, position) // 0 = 중앙, 현재 존만
|
|
};
|
|
}
|
|
}
|