unit ObjectDoor;

interface

uses
  CustomObject, Vec2f, IniFiles;

type
  TObjectDoor = class(TCustomObject)
  private
    FIsOpened: Boolean;
  public
    procedure SetActive(AAction: Boolean); override;
  published
    property IsOpened: Boolean read FIsOpened write FIsOpened;
  end;

implementation

uses
  Resources, Level.Map;

procedure TObjectDoor.SetActive(AAction: Boolean);
begin
  Inherited;
  if not IsOpened then
  begin
    if AAction then
      Field.FieldType := ftNone
    else
      Field.FieldType := ftWall;
  end
  else
  begin
    if AAction then
      Field.FieldType := ftWall
    else
      Field.FieldType := ftNone;
  end;
end;

end.
