Exemple #1
0
    // FOR DEBUGGING
    private void OnMouseDown()
    {
        if (Player == null)
        {
            Player = GameObject.FindGameObjectWithTag("Player");
        }

        Vector3 worldPos = GetInputWorldPosition(Input.mousePosition);
        float   roundedClickedPosition = (float)Math.Round(worldPos.y, 2, MidpointRounding.ToEven);
        float   roundedPlayerPosition  = (float)Math.Round(Player.transform.position.y, 2, MidpointRounding.ToEven);

        if (roundedPlayerPosition == roundedClickedPosition)
        {
            playerMovementManager.MovePlayer(worldPos);
        }
        else if (roundedClickedPosition < roundedPlayerPosition)
        {
            playerMovementManager.MovePlayerToLowerPlatform(worldPos);
        }
        else if (roundedClickedPosition > roundedPlayerPosition)
        {
            playerMovementManager.MovePlayerToHigherPlatform(worldPos);
        }
    }