public void FindAttackRange() { GraphSearch mSearch = new GraphSearch(mTileMap.MapInfo.mGraph); mSearch.AttackRange(mPositionX, mPositionY, mRange); mAttackRangeList = mSearch.GetCloseList(); //int positionIndex = mTileMap.MapInfo.XYToIndex (mPositionX, mPositionY); mAttackRangeList.RemoveAt(0); foreach (Node i in mAttackRangeList) { int index = i.mIndex; DTileMap.TileType temp = mTileMap.MapInfo.GetTileTypeIndex(index); if (temp == DTileMap.TileType.Player1) { mAttackList.Add(DTileMap.TileType.Player1); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } else if (temp == DTileMap.TileType.Player2) { mAttackList.Add(DTileMap.TileType.Player2); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } else if (temp == DTileMap.TileType.Player3) { mAttackList.Add(DTileMap.TileType.Player3); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } else if (temp == DTileMap.TileType.Player4) { mAttackList.Add(DTileMap.TileType.Player4); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } else if (temp == DTileMap.TileType.Target1) { mAttackList.Add(DTileMap.TileType.Target1); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } else if (temp == DTileMap.TileType.Target2) { mAttackList.Add(DTileMap.TileType.Target2); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } else if (temp == DTileMap.TileType.Target3) { mAttackList.Add(DTileMap.TileType.Target3); mAttackPosition.Add(mTileMap.MapInfo.GetTileLocationIndex(index)); } } }
public void FindWalkRange(int movement) { GraphSearch mSearch = new GraphSearch(mTileMap.MapInfo.mGraph); mSearch.RangeSearch(mPositionX, mPositionY, movement); mWalkRangeList = mSearch.GetCloseList(); foreach (Node i in mWalkRangeList) { int index = i.mIndex; DTileMap.TileType temp = mTileMap.MapInfo.GetTileTypeIndex(index); if (temp == DTileMap.TileType.Floor) { mTileMap.MapInfo.SetTileTypeIndex(index, DTileMap.TileType.Walkable, true); } if (temp == DTileMap.TileType.Sewer) { mTileMap.MapInfo.SetTileTypeIndex(index, DTileMap.TileType.TrueSewer, true); } } }