/// <summary> /// 移動できるかチェックする /// </summary> private bool MoveCheck(Direction direction) { //次に移動する配列番号の取得 Vector2Int nextArrayPos = m_GeneratedMapBase.GetNextDirectionPosition(m_PlayerArrayPos, direction); //次に移動する配列番地にあるタイルの取得 GeneratedMapTile tile = m_MapData[nextArrayPos.x, nextArrayPos.y]; bool checkFlag = true; //チェック結果 //タイルの種類ごとに処理判別 switch (tile) { //壁だった場合 case GeneratedMapTile.Wall: checkFlag = false; Debug.Log("Wall"); break; //天井だった場合 case GeneratedMapTile.Ceil: checkFlag = false; Debug.Log("Ceil"); break; } return(checkFlag); }
/// <summary> /// 移動できるかチェックする /// </summary> private bool MoveCheck(Direction direction) { //次に移動する配列番号の取得 Vector2Int nextArrayPos = m_GeneratedMapBase.GetNextDirectionPosition(m_ArrayPos, direction); //次に移動する配列番地にあるタイルの取得 GeneratedMapTile tile = m_MapData[nextArrayPos.x, nextArrayPos.y]; bool checkFlag = true; //チェック結果 //タイルの種類ごとに処理判別 switch (tile) { //壁だった場合 case GeneratedMapTile.Wall: checkFlag = false; Debug.Log("Wall"); break; //天井だった場合 case GeneratedMapTile.Ceil: checkFlag = false; Debug.Log("Ceil"); break; } if (!((MapDataBySectionDivision)this.m_GeneratedMapBase).IsNotExistsObject(nextArrayPos, true)) { return(false); } return(checkFlag); }
/// <summary> /// 移動できるかチェックする /// </summary> private bool MoveCheck(Direction direction) { //次に移動する配列番号の取得 Vector2Int nextArrayPos = m_GeneratedMapBase.GetNextDirectionPosition(m_PlayerArrayPos, direction); //次に移動する配列番地にあるタイルの取得 if ((m_GeneratedMapBase.DungeonRect.x < 0 || m_GeneratedMapBase.DungeonRect.width <= nextArrayPos.x) || (m_GeneratedMapBase.DungeonRect.y < 0 || m_GeneratedMapBase.DungeonRect.height <= nextArrayPos.y)) { // マップからはみ出してしまう return(false); } GeneratedMapTile tile = m_MapData[nextArrayPos.x, nextArrayPos.y]; bool checkFlag = true; //チェック結果 //タイルの種類ごとに処理判別 //switch(tile) { // //壁だった場合 // case GeneratedMapTile.Wall: // checkFlag = false; // //Debug.Log("Wall"); // break; // //天井だった場合 // case GeneratedMapTile.Ceil: // checkFlag = false; // //Debug.Log("Ceil"); // break; //} if (!((MapDataBySectionDivision)this.m_GeneratedMapBase).IsNotExistsObject(nextArrayPos, false)) { //Debug.Log($"x={nextArrayPos.x}, y={nextArrayPos.y}"); return(false); } return(checkFlag); }