using Preparation.Utility;
namespace GameClass.GameObj
{
///
/// 发电机
///
public class Generator : GameObj
{
public Generator(XY initPos) :
base(initPos, GameData.numOfPosGridPerCell / 2, PlaceType.Land, GameObjType.Generator)
{
this.CanMove = false;
}
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Square;
private int degreeOfFRepair = 0;
public int DegreeOfFRepair
{
get => degreeOfFRepair;
set
{
lock (gameObjLock)
{
if(degreeOfFRepairGameData.degreeOfFixedGenerator ? GameData.degreeOfFixedGenerator : value;
}
}
}
public bool Repair(int addDegree)
{
if (DegreeOfFRepair==GameData.degreeOfFixedGenerator) return false;
DegreeOfFRepair+=addDegree;
if (DegreeOfFRepair==GameData.degreeOfFixedGenerator)
return true;
else return false;
}
}
}