コード例 #1
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static List <int> GetCrossZone(int baseCell, int lenght, Database.Records.MapRecords map)
        {
            List <int> openedList = new List <int>();

            openedList.Add(baseCell);
            int cCell = baseCell;

            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = map.Engine.PathfindingMaker.NextCell(cCell, 1);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = map.Engine.PathfindingMaker.NextCell(cCell, 3);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = map.Engine.PathfindingMaker.NextCell(cCell, 5);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            for (int i = 0; i <= lenght - 1; i++)
            {
                cCell = map.Engine.PathfindingMaker.NextCell(cCell, 7);
                openedList.Add(cCell);
            }
            cCell = baseCell;
            return(openedList);
        }
コード例 #2
0
ファイル: MapEngine.cs プロジェクト: nightwolf93/Crystal
 public MapEngine(Database.Records.MapRecords map)
 {
     Map = map;
     PathfindingMaker = new Pathfinding("", this.Map, 0, 0);
     Spawner = new Map.SpawnerEngine(this);
     Players = new Map.PlayersMapEngine(this);
 }
コード例 #3
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static int sNextCell(int cell, int dir, Database.Records.MapRecords _map)
        {
            switch (dir)
            {
            case 0:
                return(cell + 1);

            case 1:
                return(cell + _map.Width);

            case 2:
                return(cell + (_map.Width * 2) - 1);

            case 3:
                return(cell + _map.Width - 1);

            case 4:
                return(cell - 1);

            case 5:
                return(cell - _map.Width);

            case 6:
                return(cell - (_map.Width * 2) + 1);

            case 7:
                return(cell - _map.Width + 1);
            }
            return(-1);
        }
コード例 #4
0
ファイル: MapEngine.cs プロジェクト: XaferDev/Crystal
 public MapEngine(Database.Records.MapRecords map)
 {
     Map = map;
     PathfindingMaker = new Pathfinding("", this.Map, 0, 0);
     Spawner          = new Map.SpawnerEngine(this);
     Players          = new Map.PlayersMapEngine(this);
 }
コード例 #5
0
 public InteractiveObject(Database.Records.MapRecords map, Enums.InteractiveObjectEnum typeID, int cellid, InteractiveObjectState state, bool isInteractive)
 {
     this.Map           = map;
     this.TypeID        = typeID;
     this.CellID        = cellid;
     this.State         = state;
     this.IsInteractive = isInteractive;
 }
コード例 #6
0
ファイル: Pathfinding.cs プロジェクト: nightwolf93/Crystal
 public Pathfinding(string path, Database.Records.MapRecords map, int startCell, int startDir)
 {
     _strPath = path;
     _map = map;
     _startCell = startCell;
     _startDir = startDir;
     this.init();
 }
コード例 #7
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
 public Pathfinding(string path, Database.Records.MapRecords map, int startCell, int startDir)
 {
     _strPath   = path;
     _map       = map;
     _startCell = startCell;
     _startDir  = startDir;
     this.init();
 }
コード例 #8
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static List <int> GetLineZone(int baseCell, int lenght, int dir, Database.Records.MapRecords map)
        {
            var cells = new List <int>();

            for (int i = 0; i <= lenght; i++)
            {
            }
            return(cells);
        }
コード例 #9
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static int GetRemoteCaseInThisDir(int dir, int distance, int cell, Database.Records.MapRecords map)
        {
            int lastCell = cell;

            for (int i = 0; i <= distance; i++)
            {
                lastCell = sNextCell(lastCell, dir, map);
            }
            return(lastCell);
        }
コード例 #10
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static List <int> GetJoinCell(int cell, Database.Records.MapRecords map)
        {
            List <int> cells = new List <int>();

            cells.Add(map.Engine.PathfindingMaker.NextCell(cell, 1));
            cells.Add(map.Engine.PathfindingMaker.NextCell(cell, 3));
            cells.Add(map.Engine.PathfindingMaker.NextCell(cell, 5));
            cells.Add(map.Engine.PathfindingMaker.NextCell(cell, 7));
            return(cells);
        }
コード例 #11
0
ファイル: PaddockCache.cs プロジェクト: XaferDev/Crystal
 public static void Init()
 {
     Cache = Records.PaddockRecord.FindAll().ToList();
     foreach (var paddock in Cache)
     {
         Database.Records.MapRecords map = World.Helper.MapHelper.FindMap(paddock.MapID);
         if (map != null)
         {
             map.Engine.Paddocks.Add(paddock);
         }
     }
 }
コード例 #12
0
 public Cell(int id, Database.Records.MapRecords map)
 {
     _map = map;
     ID   = id;
     try
     {
         X = Pathfinding.GetCellXCoord(id, map.Width);
         Y = Pathfinding.GetCellYCoord(id, map.Width);
     }
     catch (Exception e)
     {
     }
 }
コード例 #13
0
ファイル: Cell.cs プロジェクト: nightwolf93/Crystal
        public Cell(int id, Database.Records.MapRecords map)
        {
            _map = map;
            ID = id;
            this.Parent = this;
            try
            {
                X = Pathfinding.GetCellXCoord(id, map.Width);
                Y = Pathfinding.GetCellYCoord(id, map.Width);
            }
            catch (Exception e)
            {

            }
        }
コード例 #14
0
ファイル: World.cs プロジェクト: XaferDev/Crystal
        public static void GoToMap(WorldClient client, Database.Records.MapRecords map, int cellid, bool FirstMap = false)
        {
            if (!FirstMap && client.Character.Map != null)
            {
                client.Character.Map.Engine.RemovePlayer(client);
            }

            client.Character.MapID  = map.ID;
            client.Character.CellID = cellid;

            if (client.Character.Map != null)
            {
                client.Character.Map.Engine.AddPlayer(client);
                client.Character.Map.Engine.ShowMap(client);
                //Handlers.GameHandler.GameInformationsRequest(client, "");
            }
            else
            {
                client.Action.SystemMessage("Carte introuvable ID : <b>" + map.ID + "</b>");
            }
        }
コード例 #15
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static List <int> GetCircleZone(int baseCell, int radius, Database.Records.MapRecords map)
        {
            List <int> openedList = new List <int>();

            openedList.Add(baseCell);
            for (int i = 0; i <= radius - 1; i++)
            {
                foreach (int cell in openedList.ToArray())
                {
                    List <int> joinedCells = GetJoinCell(cell, map);
                    foreach (int jCell in joinedCells)
                    {
                        if (!openedList.Contains(jCell))
                        {
                            openedList.Add(jCell);
                        }
                    }
                }
            }
            return(openedList);
        }
コード例 #16
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
        public static List <int> GetAllCellsForThisLinePath(int dir, int baseCell, int remoteCell, Database.Records.MapRecords map)
        {
            List <int> cells = new List <int>();

            if (!map.Engine.PathfindingMaker.InLine(baseCell, remoteCell))
            {
                return(cells);
            }
            bool pathFinished = false;
            int  timeOut      = 0;

            while (!pathFinished)
            {
                baseCell = map.Engine.PathfindingMaker.GetCaseIDFromDirection(baseCell, char.Parse(GetDirChar(dir)), false);
                if (baseCell == remoteCell)
                {
                    pathFinished = true;
                }
                else
                {
                    cells.Add(baseCell);
                }
                timeOut++;
                if (timeOut >= 30)
                {
                    break;
                }
            }
            return(cells);
        }
コード例 #17
0
ファイル: Pathfinding.cs プロジェクト: XaferDev/Crystal
 public static int RandomJoinCell(int cell, Database.Records.MapRecords map)
 {
     return(sNextCell(cell, InLineDirPossible[Utilities.Basic.Rand(0, 3)], map));
 }