unit ObjectMonster;

interface

uses
  CustomObject, Vec2f, System.SysUtils, IniFiles;

type
  TObjectMonster = class(TCustomObject)
  private
    FScale: Single;
    FHP: Integer;
    FDamage: Integer;
  published
    procedure Load(Aini: TIniFile); override;
    procedure SetActive(AAction: Boolean); override;
  end;

implementation

uses
  Resources, Units.Custom, BotMutant;

procedure TObjectMonster.Load(Aini: TIniFile);
var
  Str: String;
begin
  inherited;
  Str := 'Obj_' + IntToStr(ID);
  FScale := Aini.ReadFloat(Str, 'Scale', 1);
  FHP := Aini.ReadInteger(Str, 'HP', 100);
  FDamage := Aini.ReadInteger(Str, 'Damage', 50);
end;

procedure TObjectMonster.SetActive(AAction: Boolean);
var
  aUnit: TBotMutant;
begin
  if AAction and not FTalkAction then
  begin
    aUnit := TBotMutant.Create(Position);
    aUnit.SetParams(FScale, FHP, FDamage);

    TGlobals.GameModes.Level.UnitsList.Add(aUnit);
  end;
  inherited;
end;


end.
