Hand.HandleTwoPlayerMode C# (CSharp) Method

HandleTwoPlayerMode() private method

private HandleTwoPlayerMode ( ) : void
return void
    private void HandleTwoPlayerMode()
    {
        // Movements.
        Vector2 movement = Vector2.zero;

        Dictionary<ControllerInputManager.eControllerId, Vector2> movements = ControllerInputManager.Instance.GetLeftJoystick();
        foreach (ControllerInputManager.eControllerId controllerId in movements.Keys)
        {
            if (CharacterController.Instance.IsPlayerController(m_PlayerId, controllerId))
            {
                movement = movements[controllerId];
                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 = new Vector3(movement.x, 0.0f, movement.y);
            transform.position += newMovement;
        }

        // Buttons (controllers and mouse)
        List<ControllerInputManager.eControllerId> controllers = ControllerInputManager.Instance.GetButton(ControllerInputManager.eButtonAliases.GRAB.ToString());
        bool buttonPressed = false;

        foreach (ControllerInputManager.eControllerId controllerId in controllers)
        {
            if (CharacterController.Instance.IsPlayerController(m_PlayerId, controllerId))
            {
                buttonPressed = true;
                break;
            }
        }

        if (buttonPressed)
        {
            GrabObstacle();
        }
        else
        {
            StartCoroutine("ReleaseObstacle");
        }
    }