3
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 he is returning me the following error:
CS0019 error The "*" operator cannot be applied to type operands "Vars.vetor" and "float"
I wonder if you could 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 class Vector2 supports this kind of thing. That is, how it does it?
Great! I didn’t know this kind of method. =)
– Francisco