Ejemplo n.º 1
0
    public Vector3 FindNextTwinPosition(Vector3 direction)
    {
        if (simAxis == "x")
        {
            if (direction == Vector3.forward || direction == Vector3.forward * -1)
            {
                direction = CubeHelper.GetTopPosition(transform.position + direction);
            }
            else
            {
                direction = CubeHelper.GetTopPosition(transform.position + direction * -1);
            }
        }
        else if (direction == Vector3.right || direction == Vector3.right * -1)
        {
            direction = CubeHelper.GetTopPosition(transform.position + direction);
        }
        else
        {
            direction = CubeHelper.GetTopPosition(transform.position + direction * -1);
        }

        if (direction.y - transform.position.y > 1)
        {
            direction = transform.position;
        }
        return(direction);
    }