Files
2018-12-15 16:07:03 +01:00

55 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace CoopSweeper.GameTypes
{
class Field : IField
{
public Field()
{
State = FieldState.NONE;
CheckID = 0;
}
public bool ContainsBomb { get; set; }
public FieldState State { get; set; }
public int SurroundingBombs { get; set; }
public int CheckID { get; set; }
public DisplayState DisplayState
{
get
{
switch (State)
{
case FieldState.QUESTIONMARK:
case FieldState.NONE:
case FieldState.FLAG:
return (DisplayState)State;
case FieldState.REVEALED:
if (ContainsBomb)
return DisplayState.BOMB;
return (DisplayState)SurroundingBombs;
}
return DisplayState.ERROR;
}
}
public IField Clone()
{
return new Field()
{
State = State,
ContainsBomb = ContainsBomb,
SurroundingBombs = SurroundingBombs,
CheckID = CheckID
};
}
}
}