Files
minesweeper-coop/CoopSweeper/GameTypes/Field.cs
Marvin Rohrbach 002a851fc2 Add numbers
2018-05-25 11:30:18 +02:00

41 lines
962 B
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 GetDisplayState()
{
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;
}
}
}