private void AddCheckSector(HashSet <SSectorIndex> setCheckSector, SSectorIndex pSectorIndex) { if (eCheckOption == ESectorAroundCheckOption.FourWay) { for (int i = 0; i < 3; i++) { int iIndexX = pSectorIndex.iX - 1 + i; setCheckSector.Add(new SSectorIndex(iIndexX, pSectorIndex.iY)); } for (int i = 0; i < 3; i++) { int iIndexY = pSectorIndex.iY - 1 + i; setCheckSector.Add(new SSectorIndex(pSectorIndex.iX, iIndexY)); } } else if (eCheckOption == ESectorAroundCheckOption.EightWay) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int iIndexX = pSectorIndex.iX - 1 + i; int iIndexY = pSectorIndex.iY - 1 + j; setCheckSector.Add(new SSectorIndex(iIndexX, iIndexY)); } } } }
private bool CheckArroundIs_AlreadyExistUnit(ref SSectorIndex pSectorIndex) { _setCheckSector.Clear(); if (eCheckOption == ESectorArroundCheckOption.FourWay) { for (int i = pSectorIndex.iX - 1; i < 3; i++) { SSectorIndex sCurrentCheckSector = new SSectorIndex(i, pSectorIndex.iY); if (pSectorIndex.CheckIsEqual(ref sCurrentCheckSector) == false && _mapUseSector.ContainsValue(new SSectorIndex(i, pSectorIndex.iY))) { return(false); } } for (int i = pSectorIndex.iY - 1; i < 3; i++) { SSectorIndex sCurrentCheckSector = new SSectorIndex(pSectorIndex.iX, i); if (pSectorIndex.CheckIsEqual(ref sCurrentCheckSector) == false && _mapUseSector.ContainsValue(new SSectorIndex(pSectorIndex.iX, i))) { return(false); } } } else if (eCheckOption == ESectorArroundCheckOption.EightWay) { for (int i = pSectorIndex.iX - 1; i < 3; i++) { for (int j = pSectorIndex.iY - 1; j < 3; j++) { SSectorIndex sCurrentCheckSector = new SSectorIndex(i, j); if (pSectorIndex.CheckIsEqual(ref sCurrentCheckSector) == false && _mapUseSector.ContainsValue(new SSectorIndex(i, j))) { return(false); } } } } return(true); }
public bool CheckIsEqual(ref SSectorIndex pTargetSectorIndex) { return(iX == pTargetSectorIndex.iX && iY == pTargetSectorIndex.iY); }
private bool CheckIs_AlreadyUse_SectorAround(HashSet <SSectorIndex> setCheckSector, SSectorIndex pSectorIndex) { if (eCheckOption == ESectorAroundCheckOption.FourWay) { for (int i = 0; i < 3; i++) { int iIndexX = pSectorIndex.iX - 1 + i; if (setCheckSector.Contains(new SSectorIndex(iIndexX, pSectorIndex.iY))) { return(true); } } for (int i = 0; i < 3; i++) { int iIndexY = pSectorIndex.iY - 1 + i; if (setCheckSector.Contains(new SSectorIndex(pSectorIndex.iX, iIndexY))) { return(true); } } } else if (eCheckOption == ESectorAroundCheckOption.EightWay) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int iIndexX = pSectorIndex.iX - 1 + i; int iIndexY = pSectorIndex.iY - 1 + j; if (setCheckSector.Contains(new SSectorIndex(iIndexX, iIndexY))) { return(true); } } } } return(false); }