Created
February 22, 2020 14:19
-
-
Save abebemukuru/02b8a2e7e1e5e8ac5a9b2fb93400fb11 to your computer and use it in GitHub Desktop.
フィールドデータ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// フィールドタイプ | |
/// </summary> | |
[System.Flags] | |
public enum EFIELD_TYPE | |
{ | |
eNONE = -1, | |
eROOM = 1 << 0, // 部屋 | |
ePATH = 1 << 1, // 通路 ※部屋と通路を区別する必要がなければ、↓みたいにひと括りにする | |
//eGROUND, // 地面 | |
ePLAYER = 1 << 2, // プレイヤー | |
eENEMY = 1 << 3, // 敵 | |
eWALL = 1 << 4, // 壁 | |
} | |
/// <summary> | |
/// フィールドデータ | |
/// </summary> | |
public class FieldData | |
{ | |
// 位置X | |
public int m_nPosX = 0; | |
// 位置Y | |
public int m_nPosY = 0; | |
// フィールドタイプ | |
public EFIELD_TYPE m_eType = EFIELD_TYPE.eNONE; | |
/// <summary> | |
/// コンストラクタ | |
/// </summary> | |
/// <param name="nX"></param> | |
/// <param name="nY"></param> | |
public FieldData(int nX,int nY,EFIELD_TYPE eType = EFIELD_TYPE.eWALL ) | |
{ | |
m_nPosX = nX; | |
m_nPosY = nY; | |
m_eType = eType; | |
} | |
/// <summary> | |
/// フィールドタイプを追加 | |
/// </summary> | |
/// <param name="eType"></param> | |
public void AddFieldType( EFIELD_TYPE eType ) | |
{ | |
if( !m_eType.HasFlag( eType ) ) | |
{ | |
m_eType |= eType; | |
} | |
} | |
/// <summary> | |
/// フィールドタイプを外す | |
/// </summary> | |
/// <param name="eType"></param> | |
public void RemoveFieldType(EFIELD_TYPE eType ) | |
{ | |
if( m_eType.HasFlag( eType ) ) | |
{ | |
m_eType &= ~eType; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment