Hi guys, I'm having a hard time figure it out.
I'm moving my character by setting is rigidbody.velocity like this :
void Update () {
var right = inputState.GetButtonValue (inputButtons [0]);
var left = inputState.GetButtonValue (inputButtons [1]);
if ((right || left)&& !esquive) {
var tmpSpeed = speed;
var VelX = tmpSpeed * (float)inputState.direction;
body2d.velocity = new Vector2 (VelX, body2d.velocity.y);
}
Now, this is all fine but when I try to change it with magic or skill uses, understand when another behavior script is triggered, there seem to have a conflict between the different body.velocity requests and my player just keep on walking...
For instance a simple "forward dash" like
void OnEnable()
{
body = GetComponentInParent ();
body.velocity = new Vector2 (500, 20);
}
only works if i'm not trying to walk at the same time... I don't know how to easily fix it, I'm thinking about toggling the inputmanager during the dash but it seems so overworked ^^
Any help would be really appreciated :)
↧