using Engine.Scene.Component.BuiltIn;
using OpenTK.Mathematics;

namespace DoomDeathmatch.Component.Util;

public class CopySizeComponent : Engine.Scene.Component.Component
{
  public Vector3 Coefficient { get; set; } = Vector3.One;
  public Transform? Target { get; set; }

  public override void Update(double parDeltaTime)
  {
    if (Target == null)
      return;

    if (Coefficient.X != 0)
      GameObject.Transform.Size.X = Target.Size.X * Coefficient.X;

    if (Coefficient.Y != 0)
      GameObject.Transform.Size.Y = Target.Size.Y * Coefficient.Y;

    if (Coefficient.Z != 0)
      GameObject.Transform.Size.Z = Target.Size.Z * Coefficient.Z;
  }
}