public Vector2 Calculate(Obstaculo obstaculo, float secs) { if (Mouse.GetState().LeftButton == ButtonState.Pressed) { alvo = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); } Vector2 desired = alvo - obstaculo.getPosition(); desired = Vector2.Normalize(desired) * obstaculo.getMaxVelocidade(); return(desired - obstaculo.getVelocidade()); }
public Vector2 Calculate(Obstaculo obstaculo, float secs) { float jitterTimeSlice = jitter * secs * 9; Vector2 tmp = new Vector2( RandomClamped() * jitterTimeSlice, RandomClamped() * jitterTimeSlice); wanderTarget += tmp; wanderTarget = Vector2.Normalize(wanderTarget) * radius; Vector2 target = obstaculo.getPosition(); target += obstaculo.direcao * distance; target += wanderTarget; return(new BehaviorSeek(target).Calculate(obstaculo, secs)); }