Пример #1
0
    /// <summary>
    /// choose the destination layer for transformation;
    /// </summary>
    private void checkTranformation()
    {
        float move_dir = playerCharacter.GetComponent <PlayerController>().m_input.ver_axis_val;

        //movement on Z axis based on "Z axis movement unit"

        /*
         * if (!playerCharacter.GetComponent<PlayerController>().Z_restraint)
         * {
         *  Debug.Log("not arrive at " + cur_layer_index);
         *  return;
         * }
         */

        //movement on Z axis between two portals by only one input
        if (playerCharacter.GetComponent <PlayerController>().m_input.ver_axis_button == InputSystem.AxisButtomPressed.NoInput)
        {
            Debug.Log("Player is holding the key or has not pressed yet.");
            return;
        }

        /*
         * if (target_layer_index_up > -1 && move_dir > 0.0F)
         * {
         *  lm.LayersTransformation(cur_layer_index, target_layer_index_up);
         *
         *  Debug.Log("from layer " + cur_layer_index + " to " + target_layer_index_up);
         * }
         * else if (target_layer_index_down > -1 && move_dir < 0.0F)
         * {
         *  lm.LayersTransformation(cur_layer_index, target_layer_index_down);
         *
         *  Debug.Log("from layer " + cur_layer_index + " to " + target_layer_index_down);
         * }
         */
        if (UpArrowPortal && move_dir > 0.0F)
        {
            lm.LayersTransformation(cur_layer_index, UpArrowPortal.GetComponent <LayerSwitch>().CurLayerIndex, UpArrowPortal.transform.position);

            Debug.Log("from layer " + cur_layer_index + " to " + UpArrowPortal.GetComponent <LayerSwitch>().CurLayerIndex);
        }
        else if (DownArrowPortal && move_dir < 0.0F)
        {
            lm.LayersTransformation(cur_layer_index, DownArrowPortal.GetComponent <LayerSwitch>().CurLayerIndex, DownArrowPortal.transform.position);

            Debug.Log("from layer " + cur_layer_index + " to " + DownArrowPortal.GetComponent <LayerSwitch>().CurLayerIndex);
        }
    }