I have the following structure:
public struct vetor
{
public float X, Y;
public vetor(float X, float Y)
{
this.X = X;
this.Y = Y;
}
}
And this code:
Vars.vetor _visao;
Vars.vetor _recoil; //Os 2 possuem valores, eu tirei para ilustrar melhor
Vars.vetor towrite = _visao - _recoil * 2.0f;
But it is returning the following error:
Error CS0019 The "*" operator can not be applied to operands of types "Vars.vetor" and "float"
I would like to know if you would like to make this code work as follows:
towrite.X = _visao.X - _recoil.X * 2.0f;
towrite.Y = _visao.Y - _recoil.Y * 2.0f;
I thought this was impossible until I saw that the class Vector2 supports this kind of thing. That is, how does she do it?