private void HandleOnePlayerMode()
{
// Movements.
Vector2 movement = Vector2.zero;
if (m_PlayerId == CharacterController.ePlayerId.PLAYER_1)
{
Dictionary<ControllerInputManager.eControllerId, Vector2> movements = ControllerInputManager.Instance.GetLeftJoystick();
foreach (Vector2 movementTemp in movements.Values)
{
movement = movementTemp;
break;
}
}
else
{
Dictionary<ControllerInputManager.eControllerId, Vector2> movements = ControllerInputManager.Instance.GetRightJoystick();
foreach (Vector2 movementTemp in movements.Values)
{
movement = movementTemp;
break;
}
}
if (movement != Vector2.zero)
{
float weightFactor = 1.0f;
if (m_GrabbedObstacleJoin != null && m_GrabbedObstacleHandle != null)
{
weightFactor = m_GrabbedObstacleHandle.m_Obstacle.FullWeightFactor;
}
movement.x *= Time.deltaTime * SPEED.x * weightFactor;
movement.y *= Time.deltaTime * SPEED.y * weightFactor;
Vector3 newMovement = /*Quaternion.Euler(m_HandCamera.transform.eulerAngles) */ new Vector3(movement.x, 0.0f, movement.y);
transform.position += newMovement;
}
// Buttons (controllers)
if ((m_PlayerId == CharacterController.ePlayerId.PLAYER_1 && ControllerInputManager.Instance.GetButton(ControllerInputManager.eButtonAliases.CHARACTER_1_GRAB.ToString()).Count > 0) ||
(m_PlayerId == CharacterController.ePlayerId.PLAYER_2 && ControllerInputManager.Instance.GetButton(ControllerInputManager.eButtonAliases.CHARACTER_2_GRAB.ToString()).Count > 0))
{
GrabObstacle();
}
else
{
StartCoroutine("ReleaseObstacle");
}
}