I have a code where player moves up on Swipe up & down on Swipe down. However, Player moves only up in both cases. I am unable to understand why player is not moving down. My code is as follows:
public void PerformInLift()
{
anim.SetInteger(“AnimIndex” , 5);
transform.position = m_mountPosition; rigidbody2D.velocity = new Vector2(0f , 0f);
if (m_isGoingUp)
{
SetState(PlayerState.LiftUp);
m_targetPosition.x = transform.position.x;
m_targetPosition.y = transform.position.y + m_jumpHeight;
m_targetPosition.z = transform.position.z;
}
else if (m_isGoingDown)
{
SetState(PlayerState.LiftDown);
m_targetPosition.x = transform.position.x;
m_targetPosition.y = transform.position.y - m_jumpHeight;
m_targetPosition.z = transform.position.z;
}
}
In the above code, the line that actually does the movement is indicated in BOLD text.
I am using Unity 4.6.1f1. Thanks
Regards,
Bhanu